Chemical Systems Reader: Interface

class mlip.data.chemical_systems_readers.chemical_systems_reader.ChemicalSystemsReader(config: ChemicalSystemsReaderConfig, data_download_fun: Callable[[str | PathLike, str | PathLike], None] | None = None)

Abstract base class for reading data from disk into the internal format of lists of ChemicalSystem objects, one list for training data, one for validation, and one for test data.

__init__(config: ChemicalSystemsReaderConfig, data_download_fun: Callable[[str | PathLike, str | PathLike], None] | None = None)

Constructor.

Parameters:
  • config – The configuration defining how and where to load the data from.

  • data_download_fun – A function to download data from an external remote system. If None (default), then this class assumes file paths are local. This function must take two paths as input, source and target, and download the data at source into the target location.

abstract load(postprocess_fun: ~typing.Callable[[list[~mlip.data.chemical_system.ChemicalSystem], list[~mlip.data.chemical_system.ChemicalSystem], list[~mlip.data.chemical_system.ChemicalSystem]], tuple[list[~mlip.data.chemical_system.ChemicalSystem], list[~mlip.data.chemical_system.ChemicalSystem], list[~mlip.data.chemical_system.ChemicalSystem]]] | None = <function filter_systems_with_unseen_atoms_and_assign_atomic_species>) tuple[list[ChemicalSystem], list[ChemicalSystem], list[ChemicalSystem]]

Loads the dataset into its internal format.

Parameters:

postprocess_fun – Function to call to postprocess the loaded dataset before returning it. Accepts train, validation and test systems (list[ChemicalSystems]), runs some postprocessing (filtering for example) and returns the postprocessed train, validation and test systems. If postprocess_fun is None then no postprocessing will be done. By default, it will run assign_atomic_species_and_filter_systems_with_unseen_atoms() which assigns atomic species on ChemicalSystem objects and filters out systems from the validation and test sets that contain chemical elements that are not present in the train systems.

Returns:

A tuple of loaded training, validation and test datasets (in this order). The internal format is a list of ChemicalSystem objects.