Monte Carlo Constraints

class clease.montecarlo.constraints.CollectiveVariableConstraint(xmin=0.0, xmax=1.0, getter=None)[source]

Constraint that ensures that the collective variable defined by the getter stays within certain bounds

Parameters:

xmin: float

Minimum value for the collective variable

xmax: float

Maximum value for the collective variable

getter: MCObserver

MCObsrever that support peak keyword that returns the collective variable after the proposed move

class clease.montecarlo.constraints.ConstrainElementInserts(atoms, index_by_basis, element_by_basis)[source]

Constrain inserting the elements by basis. This constraint is intended to be used together with SGCMonteCarlo

atoms: Atoms object

ASE Atoms object used in the MC simulation

index_by_basis: list

Indices ordered by basis (same as index_by_basis parameter in ClusterExpansionSettings). If an Atoms object has 10 sites where the first 4 belongs to the first basis, the next 3 belongs to the next basis and the last 3 belongs to the last basis, the index_by_basis would be [[0, 1, 2, 3], [4, 5, 6], [7, 8, 9]]

element_by_basis: list

List specifying which elements are allowed in each basis. If there are two basis where Si and O are allowed in the fist basis while Si and C are allowed in the second basis, the argument would be [[‘Si’, ‘O’], [‘Si’, ‘C’]]

class clease.montecarlo.constraints.ConstrainSwapByBasis(atoms: Atoms, index_by_basis: Sequence[Sequence[int]])[source]

Constraint that restricts swaps of atoms within a given basis. This constraint is intended to be used together with canonical Monte Carlo calculations where the trial moves consist of swapping two atoms.

Parameters:

atoms: Atoms object

ASE Atoms object used in the MC simulation

index_by_basis: List[List[int]]

Indices ordered by basis (same as index_by_basis parameter in the ClusterExpansionSettings settings object.). If an Atoms object has 10 sites where the first 4 belongs to the first basis, the next 3 belongs to the next basis and the last 3 belongs to the last basis, the index_by_basis would be [[0, 1, 2, 3], [4, 5, 6], [7, 8, 9]].

Note: swaps are only allowed within each basis, not across two basis.

class clease.montecarlo.constraints.FixedElement(element)[source]

Class for forcing an element of a certiain type to stay fixed.

Parameters:

element: str

Name of the element that is supposed to stay fixed

class clease.montecarlo.constraints.FixedIndices(fixed_indices: Sequence[int])[source]

Constrain a given set of indices during an MC run. Any suggested system changes by the MC algorithm are rejected if they invovle an index in the fixed indices.

Parameters:

fixed_indices: sequence of integers

The indices of the atoms object which are to be fixed.

class clease.montecarlo.constraints.MCConstraint[source]

Class for that prevents the MC sampler to run certain moves

class clease.montecarlo.constraints.PairConstraint(elements, pair_cluster, trans_matrix, atoms)[source]

Pair constraint is a constraint that prevents two species from being part of a pair cluster

Parameters:

elements: list

List of symbols (e.g. [Al, X] or [X, X])

pair_cluster: Cluster

Instance of a the Cluster class. An instance of a cluster class can for instance be obtained from a ClusterExpansionSettings object via settings.cluster_list.get_by_name(“c2_d000_0”)[0]

trans_matrix: list of dicts

Translation matrix for indices. This can be obtained from the trans_matrix attribute of the ClusterExpansionSettings object

atoms: Atoms object

Atoms object used for MC calculations