Cluster Expansion Settings
- clease.settings.CEBulk(concentration: Concentration, crystalstructure='sc', a=None, c=None, covera=None, u=None, **kwargs)[source]
Specify cluster expansion settings for bulk materials defined based on crystal structures.
- Parameters:
concentration (Union[Concentration, dict]) – Concentration object or dictionary specifying the basis elements and concentration range of constituting species
crystalstructure (str) – Must be one of sc, fcc, bcc, hcp, diamond, zincblende, rocksalt, cesiumchloride, fluorite or wurtzite.
a (float) – Lattice constant.
c (float) – Lattice constant.
covera (float) – c/a ratio used for hcp. Default is ideal ratio: sqrt(8/3).
u (float) – Internal coordinate for Wurtzite structure.
For more kwargs, see docstring of
clease.settings.ClusterExpansionSettings
.
- clease.settings.CECrystal(concentration: Concentration, spacegroup=1, basis=None, cell=None, cellpar=None, ab_normal=(0, 0, 1), crystal_kwargs=None, **kwargs)[source]
Store CE settings on bulk materials defined based on space group.
- Parameters:
concentration (Union[Concentration, dict]) – Concentration object or dictionary specifying the basis elements and concentration range of constituting species
spacegroup (int | string | Spacegroup instance) – Space group given either as its number in International Tables or as its Hermann-Mauguin symbol.
basis (List[float]) – List of scaled coordinates. Positions of the unique sites corresponding to symbols given either as scaled positions or through an atoms instance.
cell (3x3 matrix) – Unit cell vectors.
cellpar ([a, b, c, alpha, beta, gamma]) – Cell parameters with angles in degree. Is not used when cell is given.
ab_normal (vector) – Is used to define the orientation of the unit cell relative to the Cartesian system when cell is not given. It is the normal vector of the plane spanned by a and b.
crystal_kwargs (dict | None) – Extra kwargs to be passed into the ase.spacegroup.crystal function. Nothing additional is added if None. Defaults to None.
For more kwargs, see docstring of
clease.settings.ClusterExpansionSettings
.
- class clease.settings.ClusterExpansionSettings(prim: Atoms, concentration: Concentration | dict, size: List[int] | None = None, supercell_factor: int | None = 27, db_name: str = 'clease.db', max_cluster_dia: Sequence[float] = (5.0, 5.0, 5.0), include_background_atoms: bool = False, basis_func_type='polynomial')[source]
Base class for all Cluster Expansion settings.
- Parameters:
prim (Atoms) – The primitive atoms object.
concentration (Union[Concentration, dict]) – Concentration object or dictionary specifying the basis elements and concentration range of constituting species.
size (List[int] | None, optional) – Size of the supercell (e.g., [2, 2, 2] for 2x2x2 cell).
supercell_factor
is ignored if bothsize
andsupercell_factor
are specified. Defaults to None.supercell_factor (int, optional) – Maximum multipilicity factor for limiting the size of supercell created from the primitive cell.
supercell_factor
is ignored if both size and supercell_factor are specified. Defaults to 27.db_name (str, optional) – Name of the database file. Defaults to
'clease.db'
.max_cluster_dia (Sequence[float], optional) – A list of int or float containing the maximum diameter of clusters (in Å). Defaults to
(5., 5., 5.)
, i.e. a 5 Å cutoff for 2-, 3-, and 4-body clusters.include_background_atoms (bool, optional) – Whether background elements are to be included. An element is considered to be a background element, if there is only 1 possible species which be ever be placed in a given basis. Defaults to False.
basis_func_type (str, optional) – Type of basis function to use. Defaults to ‘polynomial’.
- property atomic_concentration_ratio: float
Ratio between true concentration (normalised to atoms) and the internal concentration used. For example, if one of the two basis is fully occupied, and hence ignored internally, the internal concentration is half of the actual atomic concentration.
- property atoms: Atoms
The currently active template.
- property background_indices: List[int]
Get indices of the background atoms.
- property cluster_list: ClusterList
Get the cluster list, will be created upon request
- create_cluster_list_and_trans_matrix()[source]
Prepares the internal cache objects by calculating cluster related properties
- property db_name: str
Name of the underlaying data base.
- ensure_clusters_exist() None [source]
Ensure the cluster list and trans matrix has been populated. They are not calculated upon creaton of the settings instance, for performance reasons. They will be constructed if required. Nothing is done if the cache exists.
- classmethod from_dict(dct: Dict[str, Any]) ClusterExpansionSettings [source]
Load a new ClusterExpansionSettings class from a dictionary representation.
Example
>>> from clease.settings import CEBulk, Concentration, ClusterExpansionSettings >>> conc = Concentration([['Au', 'Cu']]) >>> settings = CEBulk(conc, crystalstructure='fcc', a=4.1) >>> dct = settings.todict() # Get the dictionary representation >>> # Remove the existing settings, perhaps due to being in a new environment >>> del settings >>> # Load in the settins from the dictionary representation >>> settings = ClusterExpansionSettings.from_dict(dct)
- get_active_sublattices() List[bool] [source]
List of booleans indicating if a (grouped) sublattice is active
- get_all_figures_as_atoms() List[Atoms] [source]
Get the list of all possible figures, in their ASE Atoms representation.
- get_cluster_corresponding_to_cf_name(cf_name: str) Cluster [source]
Find the Cluster object which corresponds to a CF name. The cluster will not be specialized to the decoration number if such exists in the cf name.
Example
>>> from clease.settings import CEBulk, Concentration >>> conc = Concentration([['Au', 'Cu']]) >>> settings = CEBulk(conc, crystalstructure='fcc', a=4.1) >>> cluster = settings.get_cluster_corresponding_to_cf_name("c1_0") >>> cluster.size 1
- get_prim_cell_id(write_if_missing=False) int [source]
Retrieve the ID of the primitive cell in the database. Raises a PrimitiveCellNotFound error if it is not found and write_if_missing is False. If
write_if_missing
is True a primitive cell is written to the database if it is missing.Returns the ID (an integer) of the row which corresponds to the primitive cell.
- get_sublattice_site_ratios() ndarray [source]
Return the ratios of number of sites per (grouped) sublattice
- property ignored_species_and_conc: Dict[str, float]
Return the ignored species and their concentrations normalised to the total number of atoms.
- classmethod load(fd, **kwargs)
Method for loading class object from JSON
- property max_cluster_dia: ndarray
The maximum cluster diameter, expressed in a NumPy array starting from 2-body clusters at index 0. Diameters are given in units of Ångstrom.
- property multiplicity_factor: Dict[str, float]
Return the multiplicity factor of each cluster.
- property non_background_indices: List[int]
Indices of sites which are not background
- property num_active_sublattices: int
Number of active sublattices
- property num_cf: int
Return the number of correlation functions.
- prepare_new_active_template(template)[source]
Prepare necessary data structures when setting new template.
- property prim_cell: Atoms
The primitive atoms object of the model.
- requires_build() bool [source]
Check if the cluster list and trans matrix exist. Returns True the cluster list and trans matrix needs to be built.
- save(fd)
Method for writing class object to a JSON file.
- todict() Dict [source]
Return a dictionary representation of the settings class.
Example
>>> from clease.settings import CEBulk, Concentration >>> conc = Concentration([['Au', 'Cu']]) >>> settings = CEBulk(conc, crystalstructure='fcc', a=4.1) >>> dct = settings.todict() # Get the dictionary representation
- property trans_matrix: TransMatrix
Get the translation matrix, will be created upon request
- clease.settings.settings_from_json(fname) ClusterExpansionSettings [source]
Initialize settings from JSON.
Exists due to compatibility. You should instead use ClusterExpansionSettings.load(fname)
Parameters:
- fname: str
JSON file where settings are stored