Ewald Processor#
Implementation of Ewald processor class for a fixed size supercell.
An Ewald processor is optimized to compute electrostatic interaction energy and changes in electrostatic energy from a list of local flips for use in Monte Carlo sampling.
If you are using a Hamiltonian with a Cluster expansion and an Ewald summation electrostatic term, you should use the CompositeProcessor with a ClusterExpansionProcessor and an EwaldProcessor class.
- class EwaldProcessor(cluster_subspace, supercell_matrix, ewald_term, coefficient=1.0)[source]#
Bases:
Processor
Processor for CE’s including an EwaldTerm.
A Processor class that handles changes for the electrostatic interaction energy using an Ewald Summation term.
Initialize an EwaldProcessor.
- Parameters:
cluster_subspace (ClusterSubspace) – a cluster subspace.
supercell_matrix (ndarray) – an array representing the supercell matrix with respect to the Cluster Expansion prim structure.
ewald_term (EwaldTerm) – an instance of EwaldTerm to compute electrostatic energies.
coefficient (float) – Fitting coefficient to scale Ewald energy by.
- 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 string
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 string and the second element is the index for the new species to place at that site.
- Returns:
change in correlation vector
- Return type:
array
- compute_property(occupancy)[source]#
Compute the Ewald electrostatic energy for a given occupancy array.
- Parameters:
occupancy (ndarray) – encoded occupancy array
- Returns:
Ewald electrostatic energy
- Return type:
float
- compute_property_change(occupancy, flips)[source]#
Compute change in electrostatic energy 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:
electrostatic energy change
- Return type:
float
- property ewald_matrix#
Get the electrostatic interaction matrix.
The matrix used is the one set in the EwaldTerm of the given ClusterExpansion.
- property ewald_summation#
Get the pymatgen EwaldSummation object.