Featurizers

descriptorDefinitions.KS2022

This KS2022 feature vector calculator is a highly optimized modification of our previous work calculating Ward2017 features. It is improved in terms of both feature selection and speed.

Most critically, it uses symmetry analysis to avoid redundant calculations of chemically equivalent atoms, typically speeding up the calculation by a factor of 3 to 10 for ordered structures. Feature-optimization was also carried out to remove several unphysical features or representations, such as space group being represented as a real number, rather than category. If you use this code, plese cite (as in KS2022.cite()):

  • Adam M. Krajewski, Jonathan W. Siegel, Jinchao Xu, Zi-Kui Liu, “Extensible Structure-Informed Prediction of Formation Energy with improved accuracy and usability employing neural networks”, Computational Materials Science, Volume 208, 2022, 111254

The core purpose of this module is to calculate numpy ndarray with 256 features constructed by considering all local chemical environments existing in an atomic structure. Their list is available in the labels_KS2022.csv and will be discussed in our upcoming publication (Spring 2024).

class LocalAttributeGenerator(struct, local_env_func, nn_generator=VoronoiNN())[source]

Bases: object

A wrapper class which contains an instance of an NN generator (the default is a VoronoiNN), a structure, and a function which computes the local environment attributes.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_env_func – A function which computes the local environment attributes for a given site.

  • nn_generator (VoronoiNN) – A VoronoiNN generator object.

generate_local_attributes(n)[source]

Wrapper pointing to a given Site index.

Parameters:

n (int) – The index of the site for which the local environment attributes are being computed.

Returns:

A list of the local environment attributes for the site. The type will depend on the function used to compute the attributes. By default, this is a list of two numpy arrays computed by local_env_function.

cite()[source]

Citation/s for the descriptor.

Return type:

List[str]

generate_descriptor(struct)[source]

Main functionality sharing API with every other featurizer in pySIPEFNN. Generates the KS2022 descriptor for a given structure. As explained in the top-level documentation, this descriptor is very efficient for ordered structures, and is minimizes expensive computation by considering site equivalences due to symmetry.

Parameters:

struct (Structure) – A pymatgen Structure object. It can be any ordered (e.g., crystal) or disordered (e.g., glass) structure with collapsed (defined) occupancies.

Return type:

ndarray

Returns:

A 256-length numpy ndarray of the descriptor. See labels_KS2022.csv for the meaning of each element of the array.

generate_voronoi_attributes(struct, local_funct=<function local_env_function>)[source]

Generates the local environment attributes for a given structure using a VoronoiNN generator. Critically, this implementation uses ``get_equivalentSitesMultiplicities`` to skip the expensive ``generate_local_attributes`` call when it is not guaranteed to be needed based on the symmetry of the structure.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_funct – A function which computes the local environment attributes for a given site. By default, this is the prototype function local_env_function, but you can neatly customize this to your own needs at this level, if you so desire (e.g. to use a compiled alternative you have written).

Return type:

tuple[ndarray, ndarray]

Returns:

A tuple of two numpy arrays. Each contains concatenated outputs of respecive tuples from local_env_function. Please note that, at this stage, the order of rows does not have to correspond to the order of sites in the structure and usually does not.

get_equivalentSitesMultiplicities(struct, angle_tolerance=0.1, symprec=0.001)[source]

Takes a pymatgen Structure object, obtains an spglib symmetry dataset through the SpacegroupAnalyzer wrapper of `pymatgen`, and returns a dictionary of the multiplicities of equivalent sites.```

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • angle_tolerance (float) – The angle tolerance for the symmetry analysis. By default, this is 0.1.

  • symprec (float) – The symmetry precision for the symmetry analysis. By default, this is 0.001 when called from here.

Return type:

Dict[int, int]

Returns:

A dictionary of the multiplicities of equivalent sites. The keys are the indices of the sites in the structure, and the values are the integer multiplicities.

local_env_function(local_env, site)[source]

A prototype function which computes a weighted average over neighbors, weighted by the area of the Voronoi cell between them. This allows concurrently capturing impact of neighbor-neighbor interactions and geometric effects. Critically, in contrast to cut-off based methods, the interaction is guaranteed to be continous as a function of displacement.

Parameters:
  • local_env (dict) – A dictionary of the local environment of a site, as returned by a VoronoiNN generator. Contains a number of critical geometric attributes like face distances, face areas, and corresponding face-bound volumes.

  • site (PeriodicSite) – The Site number for which the local environment is being computed.

Return type:

List[ndarray]

Returns:

A nested list of np.ndarray``s. Contains several geometric attributes concatenated with gometry weighted neighbor-neighbor elemental attributes, and (2) a list of ``np.ndarray of geometry independent elemental attributes of the site.

most_common(attribute_properties)[source]

Calculates the attributes corresponding to the most common elements.

Parameters:

attribute_properties (ndarray) – A numpy array of the local environment attributes generated from generate_voronoi_attributes.

Return type:

ndarray

Returns:

A numpy array of the attributes corresponding to the most common elements.

onlyStructural(descriptor)[source]

Returns only the part of the KS2022 descriptor that has to depend on structure, useful in cases where the descriptor is used as a fingerprint to compare polymorphs of the same compound. Please note, this does not mean it selects all structure-dependent features which span nearly entire descriptor, but only the part of the descriptor which is explicitly structure-dependent.

Parameters:

descriptor (ndarray) – A 256-length numpy ndarray of the KS2022 descriptor. Generated by the generate_descriptor function.

Return type:

ndarray

Returns:

A 103-length numpy ndarray of the structure-dependent part of the KS2022 descriptor.

profile(test='JVASP-10001', nRuns=10, persistResult=True)[source]

Profiles the descriptor in series using one of the test structures.

Parameters:
  • test (str) – The name of the test structure. By default, this is 'JVASP-10001'. Currently implemented tests are: 'JVASP-10001' and 'diluteNiAlloy'.

  • nRuns (int) – The number of runs. By default, this is 10.

  • persistResult (bool) – Whether to persist the result to a file ('KS2022_TestResult.csv') to allow for inspection. By default, this is True.

Return type:

None

profileParallel(test='JVASP-10001', nRuns=1000, makeSupercell222=False)[source]

Profiles the descriptor in parallel using one of the test structures.

Parameters:
  • test (str) – The name of the test structure. By default, this is 'JVASP-10001'. Currently implemented tests are: 'JVASP-10001' and 'diluteNiAlloy'.

  • nRuns (int) – The number of total runs done in parallel by 8 workers. By default, this is 1000.

  • makeSupercell222 (bool) – Whether to make a 2x2x2 supercell of the structure before profiling, increasing the number of atoms by a factor of 8, but should not increase time thanks to the symmetry consierations. By default, this is False.

Return type:

None

descriptorDefinitions.KS2022_dilute

This KS2022 feature vector calculator is a special-case optimized modification of our the base KS2022.

It generates exactly the same information as the base KS2022 but can be an order of magnitude faster for dilute structures, where only a single atom is different from the base structure. Under the hood, it compares the structure in question with implicit 'pure' or explicity given base structure (for multi-component cases) to determine which of the local chemical environments that may be equivalent but do not have to be equivalent are actually equivalent. If you use this code, plese cite (as in KS2022.cite()):

  • Adam M. Krajewski, Jonathan W. Siegel, Jinchao Xu, Zi-Kui Liu, “Extensible Structure-Informed Prediction of Formation Energy with improved accuracy and usability employing neural networks”, Computational Materials Science, Volume 208, 2022, 111254

The core purpose of this module is to calculate numpy ndarray with 256 features constructed by considering all local chemical environments existing in an atomic structure. Their list is available in the labels_KS2022.csv and will be discussed in our upcoming publication (Spring 2024).

class LocalAttributeGenerator(struct, local_env_func, nn_generator=VoronoiNN())[source]

Bases: object

A wrapper class which contains an instance of an NN generator (the default is a VoronoiNN), a structure, and a function which computes the local environment attributes. Note, unlike other ``KS2022`` calculators, this one has two ways of wrapping the calculation. One is the standard, but the other one has different output and collects a set of information critical to validating of proper equivalency of local chemical environments in a dilute structure.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_env_func – A function which computes the local environment attributes for a given site.

  • nn_generator (VoronoiNN) – A VoronoiNN generator object.

generate_local_attributes(n)[source]

Wrapper pointing to a given Site index.

Parameters:

n (int) – The index of the site for which the local environment attributes are being computed.

Return type:

List[ndarray]

Returns:

A list of the local environment attributes for the site. The type will depend on the function used to compute the attributes. By default, this is a list of two numpy arrays computed by local_env_function.

generate_local_attributes_diluteSite(n)[source]

This function is a special-case wrapper needed for certain sites to determine the equivalency of possibly equivalent local chemical environments in a dilute structure. It performs the same function as generate_local_attributes but also collects a set of critical information, which it returns as dict in the output list.

Parameters:

n (int) – The index of the site for which the local environment attributes are being computed.

Return type:

List[Union[ndarray, dict]]

Returns:

A list of (a) the local environment attributes for the site and (b) a dictionary of the local chemical environment characteristics of the neighbors of the dilute site. The type of the first two elements will depend on the function used to compute the attributes. By default, this is a list of two numpy arrays computed by local_env_function.

cite()[source]

Citation/s for the descriptor.

Return type:

List[str]

findDilute(struct)[source]

Function for automatically detecting the dilute site index in otherwise a pure/elemental atomic structure. It works for exactly one dilute species in a single component matrix. If the structure is multi-component, the user must provide the base Structure object manually to the generate_descriptor function.

Parameters:

struct (Structure) – A pymatgen Structure object following a set of rules described above.

Return type:

int

Returns:

The index of the dilute site in the structure.

generate_descriptor(struct, baseStruct='pure')[source]

Main functionality sharing API with every other featurizer in pySIPEFNN. Generates the KS2022 descriptor for a given dilute structure. As explained in the top-level documentation, this descriptor requires additional input of reference structure corresponding to the Structure the calculation is being performed for. This is a special-case optimized modification of the base KS2022.

Parameters:
  • struct (Structure) – A pymatgen Structure object. It can be any ordered (e.g., crystal) or disordered (e.g., glass) structure with collapsed (defined) occupancies and exactly one dilute site different from the baseStruct Structure or be a pure elemental solid with a single dilute site if the baseStruct is provided as a magic string 'pure'.

  • baseStruct (Union[str, Structure]) – A pymatgen Structure object of defect-free version of the struct. It can also be a magic string 'pure' which equates to assuming the base structure is a pure elemental solid. By default, this is 'pure' as this is the most common use case for people we work with, but we do test it with complex topologically close packed structures too.

Return type:

ndarray

Returns:

A 256-length numpy ndarray of the descriptor. See labels_KS2022.csv for the meaning of each element of the array.

generate_voronoi_attributes(struct, baseStruct='pure', local_funct=<function local_env_function>)[source]

Generates the local environment attributes for a given structure using a VoronoiNN generator. Note, this is not the same function as the one in the base KS2022, but a much more elaborate one that takes an additional argument `baseStruct` which is critical in optimizing the process flow for dilute structures.

Parameters:
  • struct (Structure) – A pymatgen Structure object with the defect site at any position. It can be a a single defect in a pure elemental solid, but it does not have to as long as the baseStruct without the defect is provided.

  • local_funct – A function which computes the local environment attributes for a given site. By default, this is the prototype function local_env_function, but you can neatly customize this to your own needs at this level, if you so desire (e.g. to use a compiled alternative you have written).

  • baseStruct (Union[str, Structure]) – A pymatgen Structure object of defect-free version of the struct. It can also be a magic string 'pure' which equates to assuming the base structure is a pure elemental solid. By default, this is 'pure' as this is the most common use case for people we work with, but we do test it with complex topologically close packed structures too.

Return type:

tuple[ndarray, ndarray]

Returns:

A tuple of two numpy arrays. Each contains concatenated outputs of respecive tuples from local_env_function. Please note that, at this stage, the order of rows does not have to correspond to the order of sites in the structure and usually does not.

local_env_function(local_env, site)[source]

A prototype function which computes a weighted average over neighbors, weighted by the area of the Voronoi cell between them. This allows concurrently capturing impact of neighbor-neighbor interactions and geometric effects. Critically, in contrast to cut-off based methods, the interaction is guaranteed to be continous as a function of displacement.

Parameters:
  • local_env (dict) – A dictionary of the local environment of a site, as returned by a VoronoiNN generator. Contains a number of critical geometric attributes like face distances, face areas, and corresponding face-bound volumes.

  • site (PeriodicSite) – The Site number for which the local environment is being computed.

Return type:

List[ndarray]

Returns:

A nested list of np.ndarray``s. Contains several geometric attributes concatenated with gometry weighted neighbor-neighbor elemental attributes, and (2) a list of ``np.ndarray of geometry independent elemental attributes of the site.

most_common(attribute_properties)[source]

Calculates the attributes corresponding to the most common elements.

Parameters:

attribute_properties (ndarray) – A numpy array of the local environment attributes generated from generate_voronoi_attributes.

Return type:

ndarray

Returns:

A numpy array of the attributes corresponding to the most common elements.

onlyStructural(descriptor)[source]

Returns only the part of the KS2022 descriptor that has to depend on structure, useful in cases where the descriptor is used as a fingerprint to compare polymorphs of the same compound. Please note, this does not mean it selects all structure-dependent features which span nearly entire descriptor, but only the part of the descriptor which is explicitly structure-dependent.

Parameters:

descriptor (ndarray) – A 256-length numpy ndarray of the KS2022 descriptor. Generated by the generate_descriptor function.

Return type:

ndarray

Returns:

A 103-length numpy ndarray of the structure-dependent part of the KS2022 descriptor.

profile(test='JVASP-10001', nRuns=10, persistResult=True)[source]

Profiles the descriptor in series using one of the test structures.

Parameters:
  • test (str) – The name of the test structure. By default, this is 'JVASP-10001'. Currently implemented tests are: 'JVASP-10001' and 'diluteNiAlloy'.

  • nRuns (int) – The number of runs. By default, this is 10.

  • persistResult (bool) – Whether to persist the result to a file ('KS2022_TestResult.csv') to allow for inspection. By default, this is True.

Return type:

None

profileParallel(test='JVASP-10001', nRuns=1000, makeSupercell222=False)[source]

Profiles the descriptor in parallel using one of the test structures.

Parameters:
  • test (str) – The name of the test structure. By default, this is 'JVASP-10001'. Currently implemented tests are: 'JVASP-10001' and 'diluteNiAlloy'.

  • nRuns (int) – The number of total runs done in parallel by 8 workers. By default, this is 1000.

  • makeSupercell222 (bool) – Whether to make a 2x2x2 supercell of the structure before profiling, increasing the number of atoms by a factor of 8, but should not increase time thanks to the symmetry consierations. By default, this is False.

Return type:

None

descriptorDefinitions.KS2022_randomSolutions

This KS2022 feature vector calculator is a special-input converter modification of our the base KS2022. Unlike the KS2022_dilute which reduces the computation, this one is designed to take an anonymous Structure and Composition pair and obtain vales of the KS2022 features at infinite random supercell size.

It does that by expanding the ensamble of local chemical environments by iteratively adding supercells of the structure until the features and composition converge. If you use this code, plese cite (as in KS2022.cite()):

  • Adam M. Krajewski, Jonathan W. Siegel, Jinchao Xu, Zi-Kui Liu, “Extensible Structure-Informed Prediction of Formation Energy with improved accuracy and usability employing neural networks”, Computational Materials Science, Volume 208, 2022, 111254

The core purpose of this module is to calculate numpy ndarray with 256 features constructed by considering all local chemical environments existing in an atomic structure. Their list is available in the labels_KS2022.csv and will be discussed in our upcoming publication (Spring 2024).

class LocalAttributeGenerator(struct, local_env_func, nn_generator=VoronoiNN())[source]

Bases: object

A wrapper class which contains an instance of an NN generator (the default is a VoronoiNN), a structure, and a function which computes the local environment attributes.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_env_func – A function which computes the local environment attributes for a given site.

  • nn_generator (VoronoiNN) – A VoronoiNN generator object.

generate_local_attributes(n)[source]

Wrapper pointing to a given Site index.

Parameters:

n (int) – The index of the site for which the local environment attributes are being computed.

Returns:

A list of the local environment attributes for the site. The type will depend on the function used to compute the attributes. By default, this is a list of two numpy arrays computed by local_env_function.

cite()[source]

Citation/s for the descriptor.

Return type:

List[str]

generate_descriptor(struct, comp, minimumSitesPerExpansion=50, featureConvergenceCriterion=0.005, compositionConvergenceCriterion=0.01, minimumElementOccurrences=10, plotParameters=False, printProgress=True, returnMeta=False)[source]

Main functionality. Generates the KS2022 descriptor for a given composition randomly distributed on a given structure until the convergence criteria are met. The descriptor is KS2022 which is compatible with all KS2022 models. It approaches values that would be reached by infinite supercell size.

Parameters:
  • struct (Structure) – A pymatgen Structure object that will be used as the basis for the structure to be generated. It can be occupied by any species without affecting the result since all will be replaced by the composition.

  • comp (Composition) – A pymatgen Composition object that will be randomly distributed on the structure within accuracy determined by the compositionConvergenceCriterion.

  • minimumSitesPerExpansion (int) – The minimum number of sites that the base structure will be expanded to (doubling dimension-by-dimension) before it is used as an expansion step in each iteration adding local chemical environment information to the global pool. Optimal value will depend on the number of species and their relative fractions in the composition. Generally, low values will result in slower convergence (<20ish) and too high values (>150ish) will result in slower computation. The default value is 50.

  • featureConvergenceCriterion (float) – The maximum difference between any feature belonging to the current iteration (statistics based on the global ensemble of local chemical environments) and the previous two iterations (before the last expansion, and the one before that) expressed as a fraction of the maximum value of each structure-dependent KS2022 feature found in the OQMD database at the time of SIPFENN creation (see maxFeaturesInOQMD array). The default value is 0.005, corresponding to 0.5% of the maximum value.

  • compositionConvergenceCriterion (float) – The maximum average difference between any element fraction belonging in the current composition (superposition of all expansions) and the target composition (comp). The default value is 0.01, corresponding to deviation depending on the number of elements in the composition.

  • minimumElementOccurrences (int) – The minimum number of times all elements must occur in the composition before it is considered converged. This is to prevent the algorithm from converging before very dilute elements have had a chance to occur. The default value is 10.

  • plotParameters (bool) –

    If True, the convergence history will be plotted using plotly and, by default, will display as an interactive plot in your default web browser, allowing you to zoom and pan. The figure below shows an example of such plot for a complex BCC 6-component high entropy alloy. The default value is False.

    KS2022_randomSolution_ConvergencePlot

  • printProgress (bool) – If True, the progress will be printed to the console. The default value is True.

  • returnMeta (bool) – If True, a dictionary containing the convergence history will be returned in addition to the descriptor. The default value is False.

Return type:

Union[ndarray, Tuple[ndarray, dict]]

Returns: By default, a numpy array containing the KS2022 descriptor. Please note the stochastic nature of the algorithm, and that the result may vary slightly between runs and parameters. If returnMeta is True, a tuple containing the descriptor and a dictionary containing the convergence history will be returned.

generate_voronoi_attributes(struct, local_funct=<function local_env_function>)[source]

Generates the local environment attributes for a given structure using a VoronoiNN generator.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_funct – A function which computes the local environment attributes for a given site. By default, this is the prototype function local_env_function, but you can neatly customize this to your own needs at this level, if you so desire (e.g. to use a compiled alternative you have written).

Return type:

tuple[ndarray, ndarray]

Returns:

A tuple of two numpy arrays. Each contains concatenated outputs of respecive tuples from local_env_function. Please note that, at this stage, the order of rows does not have to correspond to the order of sites in the structure and usually does not.

local_env_function(local_env, site)[source]

A prototype function which computes a weighted average over neighbors, weighted by the area of the Voronoi cell between them. This allows concurrently capturing impact of neighbor-neighbor interactions and geometric effects. Critically, in contrast to cut-off based methods, the interaction is guaranteed to be continous as a function of displacement.

Parameters:
  • local_env (dict) – A dictionary of the local environment of a site, as returned by a VoronoiNN generator. Contains a number of critical geometric attributes like face distances, face areas, and corresponding face-bound volumes.

  • site (PeriodicSite) – The Site number for which the local environment is being computed.

Return type:

List[ndarray]

Returns:

A nested list of np.ndarray``s. Contains several geometric attributes concatenated with gometry weighted neighbor-neighbor elemental attributes, and (2) a list of ``np.ndarray of geometry independent elemental attributes of the site.

most_common(attribute_properties)[source]

Calculates the attributes corresponding to the most common elements.

Parameters:

attribute_properties (ndarray) – A numpy array of the local environment attributes generated from generate_voronoi_attributes.

Return type:

ndarray

Returns:

A numpy array of the attributes corresponding to the most common elements.

onlyStructural(descriptor)[source]

Returns only the part of the KS2022 descriptor that has to depend on structure, useful in cases where the descriptor is used as a fingerprint to compare polymorphs of the same compound. Please note, this does not mean it selects all structure-dependent features which span nearly entire descriptor, but only the part of the descriptor which is explicitly structure-dependent.

Parameters:

descriptor (ndarray) – A 256-length numpy ndarray of the KS2022 descriptor. Generated by the generate_descriptor function.

Return type:

ndarray

Returns:

A 103-length numpy ndarray of the structure-dependent part of the KS2022 descriptor.

profile(test='FCC', comp=Composition('Cr12.8 Fe12.8 Co12.8 Ni12.8 Cu12.8 Al35.9'), nIterations=1, plotParameters=False, returnDescriptorAndMeta=False)[source]

Profiles the descriptor in parallel using one of the test structures.

Parameters:
  • test (str) – The test structure to use. Options are ‘FCC’, ‘BCC’, and ‘HCP’.

  • comp (Composition) – The composition to use. Should be a Composition pymatgen object.

  • nIterations (int) – The number of iterations to run. If 1, the descriptor will be calculated once and may be available in the return value. If >1, the descriptor will be calculated nIterations times and the result will be persisted in f’TestResult_KS2022_randomSolution_{test}_{nIterations}iter.csv’ file in the current working directory.

  • plotParameters (bool) – If True, the convergence history will be plotted using plotly. The default value is False.

  • returnDescriptorAndMeta (bool) – If True, a tuple containing the descriptor and a dictionary containing the convergence history will be returned. The default value is False.

Return type:

Optional[Tuple[ndarray, dict]]

Returns:

Depending on the value of nIterations and returnDescriptorAndMeta, the return value will be either a tuple of the descriptor and a dictionary containing the convergence history, or None. In either case, the descriptor will be persisted in f’TestResult_KS2022_randomSolution_{test}_{nIterations}iter.csv’ file.

descriptorDefinitions.Ward2017

This feature calculator is original Python source code written by Jonathan Siegel and Adam M. Krajewski for the pySIPFENN package. The feature vector it calculates is based on the past work by Ward from Wolverton group, hence the name Ward2017. If you use this code, plese cite both us and the authors of the original approach (as in Ward2017.cite()):

  • Adam M. Krajewski, Jonathan W. Siegel, Jinchao Xu, Zi-Kui Liu, “Extensible Structure-Informed Prediction of Formation Energy with improved accuracy and usability employing neural networks”, Computational Materials Science, Volume 208, 2022, 111254

  • L. Ward, R. Liu, A. Krishna, V. I. Hegde, A. Agrawal, A. Choudhary, and C. Wolverton, “Including crystal structure attributes in machine learning models of formation energies via Voronoi tessellations,” Physical Review B, vol. 96, no. 2, 7, 2017

The core purpose of this module is to calculate numpy ndarray with 271 features constructed by considering all local chemical environments existing in an atomic structure. Their list is available in the labels_Ward2017.csv and is discussed in our SIPFENN paper cited above.

class LocalAttributeGenerator(struct, local_env_func, element_dict, nn_generator=VoronoiNN())[source]

Bases: object

A wrapper class which contains an instance of an NN generator (the default is a VoronoiNN), a structure, and a function which computes the local environment attributes.

generate_local_attributes(n)[source]

Generates the local environment attributes for a given site in the structure.

Parameters:

n (int) – the index of the site to consider

Returns:

The local environment around site n.

cite()[source]

Citation/s for the descriptor.

Return type:

List[str]

generate_WC_attributes(strc, neighbor_dict_raw, levels)[source]

Generates the WC attributes for a given structure. The WC attributes are the ordering parameters for each shell of the Voronoi tessellation. Slightly different than what is implemented by Ward-Wolverton. Only considers immediate backtracking.

Parameters:
  • strc (Structure) – A pymatgen Structure object.

  • neighbor_dict_raw – A dictionary of the neighbors of each site in the structure.

  • levels – The number of shells to consider.

Return type:

List[float]

Returns:

A list of the WC attributes computed from the given structure.

generate_descriptor(struct)[source]

Main functionality. Generates the Ward2017 descriptor for a given structure.

Parameters:

struct (Structure) – A pymatgen Structure object.

Return type:

ndarray

Returns:

A 271-lenght numpy array of the descriptor.

generate_voronoi_attributes(struct, local_funct=<function local_env_function>)[source]
Generates the local environment attributes for a given structure using a VoronoiNN generator.

The local environment attributes consist of averages over the neighbors of each site in the structure.

Parameters:
  • struct (Structure) – A pymatgen Structure object.

  • local_funct – A function which computes the local environment attributes for a given site.

Returns:

A list of local attributes calculated using local_funct from the input structure.

local_env_function(local_env, site, element_dict)[source]

A prototype function which computes a weighted average over neighbors, weighted by the area of the voronoi cell between them.

Parameters:
  • local_env – A dictionary of the local environment of a site, as returned by a VoronoiNN generator.

  • site – The site number for which the local environment is being computed.

Return type:

list

Returns:

A list of the local environment attributes.

magpie_mode(attribute_properties, axis=0)[source]

Calculates the attributes corresponding to the most common elements.

Parameters:

attribute_properties – A list of attribute properties calculated for all of the elements in the structure

Returns:

The average of the attributes over all elements which occur most often.

profile(test='JVASP-10001', nRuns=10)[source]

Profiles the descriptor in series using one of the test structures.

profileParallel(test='JVASP-10001', nRuns=1000)[source]

Profiles the descriptor in parallel using one of the test structures.