Converter

class colabfit.tools.converters.BaseConverter

A Converter is used to load a list of ase.Atoms objects and convert them to Configuration objects.

load(file_path, name_field, elements, default_name='', labels_field=None, verbose=False, **kwargs)

Loads a list of Configuration objects.

Parameters
  • file_path (str) – The path to the data files.

  • name_field (str) – The key for accessing the info dictionary of a Configuration object to return the name of the Configuration.

  • elements (list) – A list of strings of element names. Order matters or file types where a mapping from atom number to element type isn’t provided (e.g., CFG files).

  • default_name (str) – The name to attach to the Configuration object if name_field does not exist on Configuration.info. Default is an empty string.

  • labels_field (str) – The key for accessing the info dictionary of a Configuration object that returns a set of string labels.

  • verbose (bool) – If True, prints the loading progress. Default is False.

class colabfit.tools.converters.CFGConverter

A Converter for the CFG files used by the Moment Tensor Potential software

class colabfit.tools.converters.EXYZConverter

A Converter for Extended XYZ files

class colabfit.tools.converters.FolderConverter(reader)

This converter serves as a generic template from loading configurations from collections of files. It is useful for loading from storage formats like JSON, HDF5, or nested folders of output files from DFT codes.

_load(file_path, name_field, elements, default_name, labels_field, verbose, glob_string, **kwargs)

Arguments are the same as for other converters, but with the following changes:

file_path (str):

The path to the parent directory containing the data files.

glob_string (str):

A string to use with Path(file_path).rglob(glob_string) to generate a list of files to be passed to self.reader

All additional kwargs will be passed to the reader function as self.reader(..., **kwargs)