npl.descriptors package

Submodules

npl.descriptors.global_feature_classifier module

class npl.descriptors.global_feature_classifier.AdsorptionFeatureVector(symbols)[source]

Bases: SimpleFeatureClassifier

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

get_features(symbols)[source]
class npl.descriptors.global_feature_classifier.AtomicCoordinationTypes(symbols)[source]

Bases: SimpleFeatureClassifier

compute_atom_feature(atom_index, particle)[source]
compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

compute_n_features(particle)[source]
class npl.descriptors.global_feature_classifier.CoordinationFeatureClassifier(symbols)[source]

Bases: SimpleFeatureClassifier

Feature classifier that counts how often each coordination number appears if vacancies (atoms of element ‘X’) are present in an otherwise PURE particle.

Form of the feature vector: [n_aa_bonds, n_a(cn=0), n_a(cn=1), … n_a(cn=12)]

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

class npl.descriptors.global_feature_classifier.DipoleMomentCalculator(symbols)[source]

Bases: SimpleFeatureClassifier

compute_feature_vector(particle, charges=[1, -1])[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

class npl.descriptors.global_feature_classifier.ExtendedTopologicalFeaturesClassifier(symbols)[source]

Bases: GlobalFeatureClassifier

Extension of the Topological Feature Classifier Class. Computes the topological feature vector for more than 2 metals in the nanoparticle

compute_atom_feature(particle, index)[source]
compute_atom_features(particle)[source]
compute_feature_vector(particle)[source]
downgrade_feature_vector(particle, neighborhood, old_atom_features, change)[source]
get_bond_types()[source]
get_coordination_index(particle, index, symbol)[source]
get_feature_labels()[source]

Generate a list of feature labels for the extended topological feature vector.

The feature labels include: - Bond counts for all possible pairs of elements. - Sublayer indices for each element. - Coordination numbers for each element from 0 to 12.

Returns:

list: A list of feature labels.

get_layer_types()[source]
get_number_of_feature()[source]
get_sublayer_indices(particle)[source]
update_atom_feature(particle, index)[source]
update_feature_vector(particle, neighborhood)[source]
class npl.descriptors.global_feature_classifier.GeneralizedCoordinationNumber(particle)[source]

Bases: SimpleFeatureClassifier

Class that only works for Monometallic Nanopaticles

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

class npl.descriptors.global_feature_classifier.GlobalFeatureClassifier[source]

Bases: object

Base class for classifiers that produce a feature vector directly from a particle without the need for precomputing local environments.

Valid implementations have to implement the compute_feature_vector(particle) method.

compute_feature_vector(particle)[source]
get_feature_key()[source]
set_feature_key(feature_key)[source]
class npl.descriptors.global_feature_classifier.LayererTopologicalDescriptors(symbols, particle)[source]

Bases: SimpleFeatureClassifier

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

compute_layers(particle)[source]
get_layer_indices(particle)[source]
get_layers_occupacy(particle)[source]
class npl.descriptors.global_feature_classifier.SimpleFeatureClassifier(symbols)[source]

Bases: GlobalFeatureClassifier

Base class for classifiers which provides handling of two elements and calculation of bond counts.

Entries for different elements in feature vectors have to be ordered consistently. This class uses an alphabetical ordering of TWO elements. The returned feature vector consists of [n_aa_bonds/n_atoms, n_ab_bonds/n_atoms, n_bb_bonds/n_atoms, n_a_atoms*0.1].

Args:

symbols (list): A list of symbols representing the elements.

Attributes:

symbol_a (str): The first symbol in the ordered list of symbols. symbol_b (str): The second symbol in the ordered list of symbols. feature_key (str): The key used to store the feature vector in the particle object.

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

compute_respective_bond_counts(particle)[source]

Compute the respective bond counts for the given particle.

Args:

particle (Particle): The particle object for which to compute the bond counts.

Returns:

tuple: A tuple containing the counts of AA bonds, BB bonds, and AB bonds.

class npl.descriptors.global_feature_classifier.TopologicalFeatureClassifier(symbols)[source]

Bases: SimpleFeatureClassifier

Classifier for a generalization of the topological descriptors by Kozlov et al. (2015).

Implemented for TWO elements, which are sorted alphabetically.The returned feature vector will have the form [n_aa_bonds/n_atoms, n_ab_bonds/n_atoms, n_bb_bonds/n_atoms, n_a_atoms*0.1, n_a(cn=0), n_a(cn=1), …, n_a(cn=12].

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

get_feature_labels()[source]

Generate a list of feature labels for the topological feature vector.

The feature labels include: - Bond counts for AA, BB, and AB bonds. - Number of atoms of type A. - Coordination numbers for atoms of type A and B from 0 to 12.

Returns:

list: A list of feature labels.

class npl.descriptors.global_feature_classifier.testTopologicalFeatureClassifier(symbols)[source]

Bases: SimpleFeatureClassifier

Classifier for a generalization of the topological descriptors by Kozlov et al. (2015). Implemented for TWO elements, which are sorted alphabetically.The returned feature vector will have the form [n_aa_bonds/n_atoms, n_ab_bonds/n_atoms, n_bb_bonds/n_atoms, n_a_atoms*0.1, n_a(cn=0), n_a(cn=1), …, n_a(cn=12].

compute_feature_vector(particle)[source]

Compute the feature vector for the given particle.

Args:

particle (Particle): The particle object for which to compute the feature vector.

get_feature_labels()[source]

Generate a list of feature labels for the topological feature vector.

The feature labels include: - Bond counts for AA, BB, and AB bonds. - Number of atoms of type A. - Coordination numbers for atoms of type A from 0 to 12.

Returns:

list: A list of feature labels.

npl.descriptors.local_environment_calculator module

class npl.descriptors.local_environment_calculator.LocalEnvironmentCalculator[source]

Bases: object

Base class for local environment calculators.

Intended use: Implementations should implement predict_local_environment() which calculates and returns the local environment of a single atom.

compute_local_environment(particle, atom_index)[source]
compute_local_environments(particle)[source]
predict_local_environment(particle, lattice_index)[source]
class npl.descriptors.local_environment_calculator.NeighborCountingEnvironmentCalculator(symbols)[source]

Bases: LocalEnvironmentCalculator

Calculate a local environment of the form [n_a, n_b], where n_a denotes the number of surrounding a atoms.

Currently restricted to two elements which are ordered alphabetically. Requires a valid neighbor list.

predict_local_environment(particle, lattice_index)[source]
class npl.descriptors.local_environment_calculator.SOAPCalculator(l_max)[source]

Bases: LocalEnvironmentCalculator

Experimental class. Compute the spherical harmonics power spectrum for each atom and element.

Based on the code provided by Dr. Johannes Margraf. See https://arxiv.org/abs/1901.10971v1 Ceriotti et al. for details, used convention etc.

predict_local_environment(particle, lattice_index)[source]

npl.descriptors.local_environment_feature_classifier module

class npl.descriptors.local_environment_feature_classifier.CoordinationNumberClassifier(local_environment_calculator)[source]

Bases: LocalEnvironmentFeatureClassifier

compute_n_features(particle)[source]
predict_atom_feature(particle, atom_index, recompute_local_environment=False)[source]
class npl.descriptors.local_environment_feature_classifier.KMeansClassifier(n_cluster, local_environment_calculator, feature_key)[source]

Bases: LocalEnvironmentFeatureClassifier

compute_n_features(particle)[source]
kmeans_clustering(training_set)[source]
predict_atom_feature(particle, atom_index, recompute_local_environment=False)[source]
class npl.descriptors.local_environment_feature_classifier.LocalEnvironmentFeatureClassifier(local_environment_calculator)[source]

Bases: object

LocalEnvironmentFeatureClassifier is a class that classifies features of local environments around atoms in a particle.

Attributes:

local_environment_calculator: An instance responsible for computing local environments. feature_key: A key to identify the feature being computed.

Methods:
__init__(local_environment_calculator):

Initializes the classifier with a local environment calculator.

compute_atom_features(particle, recompute_local_environments=False):

Computes features for each atom in the particle. Optionally recomputes local environments.

compute_feature_vector(particle, recompute_atom_features=True, recompute_local_environments=False):

Computes the feature vector for the particle. Optionally recomputes atom features and local environments.

compute_atom_feature(particle, atom_index, recompute_local_environment=False):

Computes the feature for a specific atom in the particle.

get_feature_key():

Returns the feature key.

set_feature_key(feature_key):

Sets the feature key.

compute_n_features(particle):

Abstract method to compute the number of features for the particle. Must be implemented by subclasses.

predict_atom_feature(particle, lattice_index, recompute_local_environment=False):

Abstract method to predict the feature of a specific atom. Must be implemented by subclasses.

compute_atom_feature(particle, atom_index, recompute_local_environment=False)[source]
compute_atom_features(particle, recompute_local_environments=False)[source]
compute_feature_vector(particle, recompute_atom_features=True, recompute_local_environments=False)[source]
compute_n_features(particle)[source]
get_feature_key()[source]
predict_atom_feature(particle, lattice_index, recompute_local_environment=False)[source]
set_feature_key(feature_key)[source]
class npl.descriptors.local_environment_feature_classifier.TopologicalEnvironmentClassifier(local_environment_calculator, symbols)[source]

Bases: LocalEnvironmentFeatureClassifier

compute_n_features(particle)[source]
predict_atom_feature(particle, atom_index, recompute_local_environment=False)[source]

Module contents

class npl.descriptors.LocalEnvironmentCalculator[source]

Bases: object

Base class for local environment calculators.

Intended use: Implementations should implement predict_local_environment() which calculates and returns the local environment of a single atom.

compute_local_environment(particle, atom_index)[source]
compute_local_environments(particle)[source]
predict_local_environment(particle, lattice_index)[source]