catlearn.fingerprint package¶
Submodules¶
catlearn.fingerprint.adsorbate module¶
Slab adsorbate fingerprint functions for machine learning.
-
class
catlearn.fingerprint.adsorbate.
AdsorbateFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
-
ads_av
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with averages of the atomic properties of the adsorbate.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
ads_sum
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with averages of the atomic properties of the adsorbate.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_atoms_ads
(atoms=None)¶ Function that takes an atoms object and returns a fingerprint vector containing the count of each element in the adsorbate.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_cn
(atoms)¶ Count the number of neighbors of the site, which has a n number of neighbors. This is equivalent to a bag of coordination numbers over the site neighbors. These can be used in the “alpha parameters” linear model.
Please cite: Roling LT, Abild-Pedersen F. Structure-Sensitive Scaling Relations: Adsorption Energies from Surface Site Stability. ChemCatChem. 2018 Apr 9;10(7):1643-50.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_cn_general
(atoms)¶ Count the number of neighbors of the site, which has a n number of neighbors. This is equivalent to a bag of coordination numbers over the site neighbors. These can be used in the “alpha parameters” linear model for alloys.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_edges_ads
(atoms)¶ Returns bag of connections, counting only the bonds within the adsorbate.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_edges_all
(atoms)¶ Returns bag of connections, counting all bonds within the adsorbate and between adsorbate atoms and surface. If we assign an energy to each type of bond, considering first neighbors only, this fingerprint would work independently in a linear model. The length of the vector is atom_types * ads_atom_types.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_edges_chemi
(atoms)¶ Returns bag of connections, counting only the bonds within the adsorbate and the connections between adsorbate and surface.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bulk
(atoms=None)¶ Return a fingerprint vector with propeties averaged over the bulk atoms.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
count_chemisorbed_fragment
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector containing the count over atom types, that are neighbors to the chemisorbing atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
ctime
(atoms=None)¶ Return the contents of atoms.info[‘ctime’] as a feature.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
db_size
(atoms=None)¶ Return a fingerprint containing the number of layers in the slab, the number of surface atoms in the unit cell and the adsorbate coverage.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
dbid
(atoms=None)¶ Return the contents of atoms.info[‘id’] as a feature.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
delta_energy
(atoms=None)¶ Return the contents of atoms.info[‘key_value_pairs’][‘delta_energy’] as a feature.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
en_difference_active
(atoms=None)¶ Returns a list of electronegativity metrics, squared and summed over adsorbate bonds including those with the surface.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
en_difference_ads
(atoms=None)¶ Returns a list of electronegativity metrics, squared and summed over bonds within the adsorbate atoms.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
en_difference_chemi
(atoms=None)¶ Returns a list of electronegativity metrics, squared and summed over adsorbate-site bonds.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
generalized_cn
(atoms)¶ Returns the averaged generalized coordination number over the site. Calle-Vallejo et al. Angew. Chem. Int. Ed. 2014, 53, 8316-8319.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
max_site
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
mean_chemisorbed_atoms
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector containing properties of the closest add atom to a surface metal atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
mean_site
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
mean_surf_ligands
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector containing the count of nearest neighbors and properties of the nearest neighbors.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
median_site
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
min_site
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
strain
(atoms=None)¶ Return a fingerprint with the espected strain of the site atoms and the termination atoms.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
sum_site
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties summed over the surface metal atoms closest to an add atom.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
term
(atoms=None)¶ Return a fingerprint vector with propeties averaged over the termination atoms.
Parameters: atoms (object) –
-
catlearn.fingerprint.bulk module¶
Slab adsorbate fingerprint functions for machine learning.
-
class
catlearn.fingerprint.bulk.
BulkFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
-
bulk_average
(atoms=None)¶ Return a fingerprint vector with propeties of the element name saved in the atoms.info[‘key_value_pairs’][‘bulk’]
-
bulk_std
(atoms=None)¶ Return a fingerprint vector with propeties of the element name saved in the atoms.info[‘key_value_pairs’][‘bulk’]
-
bulk_summation
(atoms=None)¶ Return a fingerprint vector with propeties of the element name saved in the atoms.info[‘key_value_pairs’][‘bulk’]
-
xyz_id
(atoms=None)¶
-
catlearn.fingerprint.chalcogenide module¶
Slab adsorbate fingerprint functions for machine learning.
-
class
catlearn.fingerprint.chalcogenide.
ChalcogenideFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
-
formal_charges
(atoms)¶ Return a fingerprint based on formal charges.
Parameters: atoms (object) –
-
max_cation
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) –
-
mean_cation
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) –
-
median_cation
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) –
-
min_cation
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties averaged over the surface metal atoms closest to an add atom.
Parameters: atoms (object) –
-
sum_cation
(atoms=None)¶ Function that takes an atoms objects and returns a fingerprint vector with properties summed over the surface metal atoms closest to an add atom.
Parameters: atoms (object) –
-
catlearn.fingerprint.convoluted module¶
Slab adsorbate convoluted fingerprint functions for machine learning.
-
class
catlearn.fingerprint.convoluted.
ConvolutedFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
-
conv_bulk
(atoms=None)¶ Return a fingerprint vector with propeties convoluted over the bulk atoms.
Parameters: atoms (object) – A single atoms object.
-
conv_term
(atoms=None)¶ Return a fingerprint vector with propeties convoluted over the terminal atoms.
Parameters: atoms (object) – A single atoms object.
-
-
catlearn.fingerprint.convoluted.
check_length
(labels, result, atoms)¶ Check that two lists have the same length.
If not, print an informative error message containing a databse id if present.
Parameters: - labels (list) – A list of feature names.
- result (list) – A fingerprint.
- atoms (object) – A single atoms object.
catlearn.fingerprint.graph module¶
Functions to build a neighbor matrix feature representation.
-
class
catlearn.fingerprint.graph.
GraphFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
Function to build a fingerprint vector based on an atoms object.
-
neighbor_mean_vec
(data)¶ Transform neighborlist into a neighbor averaged feature vector.
Parameters: data (object) – Target data object from which to generate features. Returns: features – A 1d numpy array of the feature vector. Return type: array
-
neighbor_sum_vec
(data)¶ Transform neighborlist into a neighbor sum feature vector.
Parameters: data (object) – Target data object from which to generate features. Returns: features – A 1d numpy array of the feature vector. Return type: array
-
catlearn.fingerprint.molecule module¶
Functions to build a gas phase molecule fingerprint.
-
class
catlearn.fingerprint.molecule.
AutoCorrelationFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
Class for constructing an autocorrelation fingerprint.
-
get_autocorrelation
(atoms)¶ Return the autocorrelation fingerprint for a molecule.
-
catlearn.fingerprint.particle module¶
Nanoparticle fingerprint functions.
These functions will typically perform well at describing chemical ordering within alloyed nanoparticles. However, they may be applicable to other applications where bond counting or coordination numbers are important descriptors.
This class inherits from the catlearn.fingerprint.BaseGenerator function.
-
class
catlearn.fingerprint.particle.
ParticleFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
Function to build a fingerprint vector based on an atoms object.
-
bond_count_vec
(data)¶ Bond counting with a distribution measure for coordination.
Parameters: data (object) – Data object with atomic distances. Returns: track_nnmat – List with summed number of atoms with given coordination numbers. Return type: list
-
connections_vec
(data)¶ Sum atoms with a certain number of connections.
-
distribution_vec
(data)¶ Return atomic distribution measure.
-
nearestneighbour_vec
(data)¶ Nearest neighbour average, Topics in Catalysis, 2014, 57, 33.
This is a slightly modified version of the code found in the ase.ga module.
Parameters: data (object) – Data object with atomic numbers available. Returns: nnlist – Feature vector that will be n**2 where n is the number of atomic species passed to the class. Return type: list
-
rdf_vec
(data)¶ Return list of partial rdfs for use as fingerprint vector.
-
catlearn.fingerprint.prototype module¶
Prototype fingerprint based on Magpie.
-
class
catlearn.fingerprint.prototype.
PrototypeFingerprintGenerator
(atoms, sites, system_name='', target='id', delete_temp=True, properties=[])¶ Bases:
object
Function to build prototype fingerprint in pandas.DataFrame.
Based on a list of ase.atoms object.
-
generate
()¶ Generate Prototype fingerprint and return all the fingerprint.
Returns: FP Return type: pandas.Frame
-
generate_all
()¶
-
run_proto
()¶ Call Magpie to generate Prototype FP and write to proto_FP.csv.
-
update_str
()¶
-
write_proto_input
()¶ Write Prototype input for Magpie.
-
-
class
catlearn.fingerprint.prototype.
PrototypeSites
(site_dict=None)¶ Bases:
object
Prototype site objective for generating prototype input.
catlearn.fingerprint.standard module¶
Standard fingerprint functions.
These feature sets should perform relatively well on a variety of different systems. They are general descriptors based predominantly on the elemental properties and in some cases structure.
This class inherits from the catlearn.fingerprint.BaseGenerator function.
-
class
catlearn.fingerprint.standard.
StandardFingerprintGenerator
(**kwargs)¶ Bases:
catlearn.featurize.base.BaseGenerator
Function to build a fingerprint vector based on an atoms object.
-
bag_edges
(atoms)¶ Returns the bag of connections, defined as counting connections between types of elements pairs. We define the bag as a vector, e.g. return [Number of C-H connections, # C-C, # C-O, …, # M-X]
Parameters: atoms (object) – Returns: features Return type: list
-
bag_edges_cn
(atoms)¶ Returns the bag of connections folded with coordination numbers of the node atoms.
Parameters: atoms (object) – Returns: features Return type: list
-
bag_element_cn
(atoms)¶ Bag elements folded with coordination numbers, e.g. number of C with CN = 4, number of C with CN = 3, ect.
Parameters: atoms (object) – ASE Atoms object. Returns: features – If None was passed, the elements are strings, naming the feature. Return type: list
-
bag_elements
(atoms)¶ Returns the bag of elements, defined as counting occurence of elements in a given structure. This is mostly useful for subtracting atomization energies.
Parameters: atoms (object) – Returns: features Return type: list
-
composition_vec
(data)¶ Function to return a feature vector based on the composition.
Parameters: data (object) – Data object with atomic numbers available. Returns: features – Vector containing a count of the different atomic types, e.g. for CH3OH the vector [1, 4, 1] would be returned. Return type: array
-
distance_vec
(data)¶ Averaged distance between e.g. A-A atomic pairs.
Parameters: data (object) – Data object with Cartesian coordinates and atomic numbers available. Returns: features – Vector of averaged distances between homoatomic atoms. Return type: ndarray
-
eigenspectrum_vec
(data)¶ Sorted eigenspectrum of the Coulomb matrix.
Parameters: data (object) – Data object with Cartesian coordinates and atomic numbers available. Returns: features – Sorted Eigen values of the coulomb matrix, n atoms is size. Return type: ndarray
-
element_mass_vec
(data)¶ Function to return a vector based on mass parameter.
Parameters: data (object) – Data object with atomic masses available. Returns: features – Vector of the summed mass. Return type: ndarray
-
element_parameter_vec
(data)¶ Function to return a vector based on a defined paramter.
The vector is compiled based on the summed parameters for each elemental type as well as the sum for all atoms.
Parameters: data (object) – Data object with atomic numbers available. Returns: features – An n + 1 array where n in the length of self.atom_types. Return type: array
-
catlearn.fingerprint.voro module¶
Voronoi fingerprint based on Magpie.
-
class
catlearn.fingerprint.voro.
VoronoiFingerprintGenerator
(atoms, delete_temp=True)¶ Bases:
object
Function to build voronoi fingerprint in pandas.DataFrame.
Based on a list of ase.atoms object.
-
generate
()¶ Generate Voronoi fingerprint and return all the fingerprint.
Returns: FP Return type: pandas.Frame
-
run_voro
()¶ Call Magpie to generate Voronoi FP and write to voro_FP.csv.
-
write_voro_input
()¶ Write Voronoi input for Magpie.
-