The CorrelationsCalculator class

Initialization and methods

class clusterx.correlations.CorrelationsCalculator(*args, **kwargs)

Correlations calculator object.

Parameters:
basis_namestr

cluster basis to be used. Possible values are: indicator-binary, trigonometric, polynomial, and chebyshev.

  • indicator-binary: highly interpretable, non-orthogonal basis functions for binary compounds (also binary-linear, deprecated)

  • trigonomentric: orthonormal basis; constructed from sine and cosine functions; based on: Axel van de Walle, CALPHAD 33, 266 (2009)

  • polynomial: orthonormal basis; uses orthogonalized polynomials

  • chebyshev: orthonormsl basis; chebyshev polynomials for symmetrized sigmas (sigma in {-m/2, …, 0, …, m/2 }); based on: J.M. Sanchez, Physica 128A, 334-350 (1984)

parent_latticeParentLattice

the parent lattice of the cluster expansion.

clusters_poolClustersPool

The clusters pool to be used in the calculator.

filepathstr, default None

Initialize object from file generated by the CorrelationsCalculator.serialize(filepath) method. Overrides json_db_filepath (deprecated).

json_db_filepath(DEPRECATED) str, default None

Overrides all the above. Used to initialize from file. Path of a json file containing a serialized CorrelationsCalculator object, as generated by the CorrelationsCalculator.serialize() method.

Notes

For developers:

For implementing pickle serialization, hints were used from the following link: https://stackoverflow.com/questions/36458221/unpickling-object-of-type-x-in-the-new-method-of-class-x-calls-init-on-r

get_basis()

Return basis set name

get_binary_random_structure_correlations(concentration: float)

Return cluster correlations for binary quasirandom structure

get_cluster_correlations(structure: Structure, verbose: bool = False, flag=None)

Get cluster correlations for a structure

Parameters:
structureStructure

structure for which to calculate the correlations.

verbosebool, default False

If True, prints the progress of the calculation to the console.

get_cluster_orbit_pools_for_scell(scell: SuperCell)

Return array of cluster_pool objects, containing cluster orbits for a given supercell

Parameters:
scellParentLattice, SuperCell, or Structure

Object containing the lattice definition to determine the orbit of the clusters in the CorrelationsCalculator.

get_cluster_orbits_for_scell(scell: SuperCell, verbose: bool = False, **kwargs)

Return array of cluster orbits for a given supercell

Parameters:
scellParentLattice, SuperCell, or Structure

Object containing the lattice definition to determine the orbit of the clusters in the CorrelationsCalculator.

verbosebool, default False

If True, prints the progress of the calculation to the console.

get_correlation_matrix(structures_set: StructuresSet, outfile: str = None, verbose: bool = False)

Return correlation matrix for a structures set.

Parameters:
structures_setStructuresSet

a 2D numpy matrix is returned. every row in the matrix corresponds to a structure in the StructuresSet object.

outfilestr, default None

If given, the correlation matrix is written to a file with this name.

verbosebool, default False

If True, prints the progress of the calculation to the console.

get_cpool()

Return ClustersPool object of the calculator

get_orbit_lengths(structure: Structure)

Return integer array of orbit lengths

Parameters:
structureParentLattice, SuperCell, or Structure

Object containing the lattice definition to determine the orbit of the clusters in the CorrelationsCalculator.

reset_mc(mc: bool = False)

Reset memoization of cluster orbits

serialize(filepath: str = None, fmt: str = None, db_name: str = None)

Write correlations calculator to Atoms Json database

Parameters:
filepathstr

Name of the file to store the correlations_calculator object. It can contain the relative or absolute path. If not given, and if db_name (deprecated) is None, filepathh is set to “CCALC.pickle” and fmt is overriden (set to pickle).

fmtstr

It can take the values "pickle" or "json". So far, object can only be re-initiated from a "pickle" file, therefore this is the preferred format. If not given, it is inferred from the filepathh.

db_name(DEPRECATED) str

Name of the json file containing the database