Composite Processor#
Implementation of Composite processor class for a fixed size supercell.
If you have created a ClusterExpansion with additional terms, and don’t want the headache of manually and correctly setting up the corresponding CompositeProcessor, simply consider using the convenience class constructor method in the ensemble classes: Ensemble.from_clusterexpansion, that will take care of all these hiccups for you.
- class CompositeProcessor(cluster_subspace, supercell_matrix)[source]#
Bases:
Processor
CompositeProcessor class used for mixed models.
A Composite processor is merely a container for many different processors that acts as an interface such that it can be used in the same way as an individual processor. This can be used to mix models in any way that your heart desires.
The most common use case is a CompositeProcessor of a ClusterExpansionProcessor and an EwaldProcessor for use in ionic materials when the cluster expansion contains an Ewald term.
You can add any of the other processor class implemented to build a composite processor.
It is recommended to use the
from_cluster_expansion
to create an ensemble and the underlying processor automatically created rather than directly creating a processor. This will take care of creating the correctCompositeProcessor
orClusterExpansionProcessor
for you.Initialize a CompositeProcessor.
- Parameters:
cluster_subspace (ClusterSubspace) – a cluster subspace
supercell_matrix (ndarray) – an array representing the supercell matrix with respect to the cluster expansion prim structure.
- add_processor(processor)[source]#
Add a processor to composite.
- Parameters:
processor (Processor) – processor to add. All processors must have the same ClusterSubspace and supercell matrix.
- compute_feature_vector(occupancy)[source]#
Compute the feature vector for a given occupancy array.
Each entry in the correlation vector corresponds to a particular symmetrically distinct bit ordering.
- Parameters:
occupancy (ndarray) – encoded occupation array
- Returns:
correlation vector
- Return type:
array
- compute_feature_vector_change(occupancy, flips)[source]#
Compute the change in the feature vector from a list of flips.
- Parameters:
occupancy (ndarray) – encoded occupancy array
flips (list of tuple) – list of tuples with two elements. Each tuple represents a single flip where the first element is the index of the site in the occupancy array and the second element is the index for the new species to place at that site.
- Returns:
change in feature vector
- Return type:
array
- compute_property(occupancy)[source]#
Compute the value of the property for the given occupancy array.
- Parameters:
occupancy (ndarray) – encoded occupancy array
- Returns:
predicted property
- Return type:
float
- compute_property_change(occupancy, flips)[source]#
Compute the change in property from a set of flips.
- Parameters:
occupancy (ndarray) – encoded occupancy array
flips (list) – list of tuples for (index of site, specie code to set)
- Returns:
property difference between initial and final states
- Return type:
float
- property processors#
Return the list of processors in CompositeProcessor.