catlearn.api

catlearn.api.ase_atoms_api

Functions that interface ase with CatLearn.

catlearn.api.ase_atoms_api.database_to_list(fname, selection=None)

Return a list of atoms objects imported from an ase database.

Parameters:
  • fname (str) – path/filename of ase database.
  • selection (list) – search filters to limit the import.
catlearn.api.ase_atoms_api.extend_atoms_class(atoms)

A wrapper to add extra functionality to ase atoms objects.

Parameters:atoms (class) – An ase atoms object.
catlearn.api.ase_atoms_api.get_features(self)

Function to read feature vector from ase atoms object.

This function provides a uniform way in which to return a feature vector from an atoms object.

Parameters:self (class) – An ase atoms object to attach feature vector to.
Returns:fp – The feature vector attached to the atoms object.
Return type:array
catlearn.api.ase_atoms_api.get_graph(self)

Function to read networkx graph from ase atoms object.

This function provides a uniform way in which to return a graph object from an atoms object.

Parameters:self (class) – An ase atoms object to attach feature vector to.
Returns:graph – The networkx graph object attached to the atoms object.
Return type:object
catlearn.api.ase_atoms_api.get_neighborlist(self)

Function to read neighborlist from ase atoms object.

This function provides a uniform way in which to return a neighborlist from an atoms object.

Parameters:self (class) – An ase atoms object to attach feature vector to.
Returns:neighborlist – The neighbor list attached to the atoms object.
Return type:dict
catlearn.api.ase_atoms_api.images_connectivity(images, check_cn_max=False)

Return a list of atoms objects imported from an ase database.

Parameters:
  • fname (str) – path/filename of ase database.
  • selection (list) – search filters to limit the import.
catlearn.api.ase_atoms_api.images_pair_distances(images, mic=True)

Return a list of atoms objects imported from an ase database.

Parameters:
  • fname (str) – path/filename of ase database.
  • selection (list) – search filters to limit the import.
catlearn.api.ase_atoms_api.set_features(self, fp)

Function to write feature vector to ase atoms object.

This function provides a uniform way in which to attach a feature vector to an atoms object. Can be used in conjunction with the get_features function.

Parameters:
  • self (class) – An ase atoms object to attach feature vector to.
  • fp (array) – The feature vector to attach.
catlearn.api.ase_atoms_api.set_graph(self, graph)

Function to write networkx graph to ase atoms object.

This function provides a uniform way in which to attach a graph object to an atoms object. Can be used in conjunction with the ase_to_networkx function.

Parameters:
  • self (class) – An ase atoms object to attach feature vector to.
  • graph (object) – The networkx graph object to attach.
catlearn.api.ase_atoms_api.set_neighborlist(self, neighborlist)

Function to write neighborlist to ase atoms object.

This function provides a uniform way in which to attach a neighbor list to an atoms object. Can be used in conjunction with the get_neighborlist function.

Parameters:
  • self (class) – An ase atoms object to attach feature vector to.
  • neighborlist (dict) – The neighbor list dict to attach.

catlearn.api.ase_data_setup

Data generation functions to interact with ASE atoms objects.

catlearn.api.ase_data_setup.get_train(atoms, key, size=None, taken=None)

Return a training dataset.

Parameters:
  • atoms (list) – A list of ASE atoms objects.
  • size (int) – Size of training dataset.
  • taken (list) – List of candidates that have been used in unique dataset.
  • key (string) – Property on which to base the predictions stored in the atoms object as atoms.info[‘key_value_pairs’][key].
catlearn.api.ase_data_setup.get_unique(atoms, size, key)

Return a unique test dataset.

Parameters:
  • atoms (list) – A list of ASE atoms objects.
  • size (int) – Size of unique dataset to be returned.
  • key (string) – Property on which to base the predictions stored in the atoms object as atoms.info[‘key_value_pairs’][key].

catlearn.api.networkx_graph_api

API to convert from ASE and NetworkX.

catlearn.api.networkx_graph_api.ase_to_networkx(atoms, cutoffs=None)

Make the NetworkX graph form ASE atoms object.

The graph is dependent on the generation of the neighborlist. Currently this is handled by the version implemented in ASE.

Parameters:
  • atoms (object) – An ASE atoms object.
  • cutoffs (list) – A list of distance paramteres for each atom.
Returns:

atoms_graph – A networkx graph object.

Return type:

object

catlearn.api.networkx_graph_api.matrix_to_nl(matrix)

Returns a neighborlist as a dictionary. :param matrix: symmetric connection matrix. :type matrix: numpy array

Returns:nl – neighborlist.
Return type:dict
catlearn.api.networkx_graph_api.networkx_to_adjacency(graph)

Simple wrapper for graph to adjacency matrix.

Parameters:graph (object) – The networkx graph object.
Returns:matrix – The numpy adjacency matrix.
Return type:array