xnn.common.data.hub.materials_project.MP2018Builder#

class xnn.common.data.hub.materials_project.MP2018Builder[source]#

Bases: DatasetBuilder

Builder for the Materials Project crystals of 2018.6.1 (the MEGNet crystal benchmarks).

LABELS = ('formation_energy', 'band_gap', 'bulk_modulus', 'shear_modulus', 'log10_bulk_modulus', 'log10_shear_modulus')#

The labels a structure’s properties can hold.

load(*, split=None, cache_dir, label='formation_energy', n_train=None, n_val=None, seed=0, nonzero_band_gap=None, return_info=False, quiet=False)[source]#

Download, parse and split the crystals.

Parameters:
  • split (str or None) – None returns {"train", "val", "test"}; "train" / "val" / "test" that split; "all" every crystal with the label.

  • cache_dir (pathlib.Path) – Base cache directory; the files go to cache_dir/"mp_2018".

  • label (str, optional) – The structure’s properties: "formation_energy" (eV/atom, default), "band_gap" (eV), "bulk_modulus" / "shear_modulus" (GPa) or their base-10 logarithms "log10_bulk_modulus" / "log10_shear_modulus" (the papers’ targets).

  • n_train (int, optional) – Split sizes. By default the paper’s: 60,000 training crystals for the formation energy and the rest halved into validation and test; 80 % / 10 % / 10 % for the other labels.

  • n_val (int, optional) – Split sizes. By default the paper’s: 60,000 training crystals for the formation energy and the rest halved into validation and test; 80 % / 10 % / 10 % for the other labels.

  • seed (int, optional) – Seed of the random split, by default 0.

  • nonzero_band_gap (bool, optional) – Keep only the crystals with a band gap above zero (the paper’s band-gap regression, 45,901 crystals). By default on for label="band_gap".

  • return_info (bool, optional) – Add info = {"material_id": ...} to every structure.

  • quiet (bool, optional) – Suppress download progress output.

Returns:

dict of {str – Structure dicts with pos, atomic_numbers, cell, pbc and properties.

Return type:

list of dict} or list of dict

Raises:

ValueError – For an unknown label or split.