Offspring creators#
Crossover#
Crossover classes, that cross the elements in the supplied atoms objects. |
|
Implementation of the cut-and-splice paring operator. |
|
Operators that work on slabs. |
Mutation#
Mutation classes, that mutate the elements in the supplied atoms objects. |
|
Soft-mutation operator and associated tools |
|
A collection of mutations that can be used. |
Documentation#
Crossover classes, that cross the elements in the supplied atoms objects.
- class ase_ga.element_crossovers.ElementCrossover(element_pool, max_diff_elements, min_percentage_elements, verbose, rng=np.random)[source]#
Base class for all operators where the elements of the atoms objects cross.
- class ase_ga.element_crossovers.OnePointElementCrossover(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, rng=np.random)[source]#
Crossover of the elements in the atoms objects. Point of cross is chosen randomly.
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in
the individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- rng: Random number generator
By default numpy.random.
- class ase_ga.element_crossovers.TwoPointElementCrossover(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False)[source]#
Crosses two individuals by choosing two cross points at random
Mutation classes, that mutate the elements in the supplied atoms objects.
- class ase_ga.element_mutations.ElementMutation(element_pool, max_diff_elements, min_percentage_elements, verbose, num_muts=1, rng=np.random)[source]#
The base class for all operators where the elements of the atoms objects are mutated
- class ase_ga.element_mutations.RandomElementMutation(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an element with a randomly chosen element from the supplied pool of elements If the individual consists of different groups of elements the element pool can be supplied as a list of lists
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in the
individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- rng: Random number generator
By default numpy.random.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- ase_ga.element_mutations.mendeleiev_table()[source]#
Returns the mendeleiev table as a python list of lists. Each cell contains either None or a pair (symbol, atomic number), or a list of pairs for the cells * and **.
- ase_ga.element_mutations.get_row_column(element)[source]#
Returns the row and column of the element in the periodic table. Note that Lanthanides and Actinides are defined to be group (column) 3 elements
- class ase_ga.element_mutations.MoveDownMutation(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an element with an element one step (or more steps if fewer is forbidden) down the same column in the periodic table.
This mutation is introduced and used in: P. B. Jensen et al., Phys. Chem. Chem. Phys., 16, 36, 19732-19740 (2014)
The idea behind is that elements close to each other in the periodic table is chemically similar, and therefore exhibit similar properties. An individual in the population is typically close to fittest possible, exchanging an element with a similar element will normally result in a slight increase (or decrease) in fitness.
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in the
individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- rng: Random number generator
By default numpy.random.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- class ase_ga.element_mutations.MoveUpMutation(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an element with an element one step (or more steps if fewer is forbidden) up the same column in the periodic table.
This mutation is introduced and used in: P. B. Jensen et al., Phys. Chem. Chem. Phys., 16, 36, 19732-19740 (2014)
See MoveDownMutation for the idea behind
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in the
individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- rng: Random number generator
By default numpy.random.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- class ase_ga.element_mutations.MoveRightMutation(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an element with an element one step (or more steps if fewer is forbidden) to the right in the same row in the periodic table.
This mutation is introduced and used in: P. B. Jensen et al., Phys. Chem. Chem. Phys., 16, 36, 19732-19740 (2014)
See MoveDownMutation for the idea behind
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in the
individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- rng: Random number generator
By default numpy.random.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- class ase_ga.element_mutations.MoveLeftMutation(element_pool, max_diff_elements=None, min_percentage_elements=None, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an element with an element one step (or more steps if fewer is forbidden) to the left in the same row in the periodic table.
This mutation is introduced and used in: P. B. Jensen et al., Phys. Chem. Chem. Phys., 16, 36, 19732-19740 (2014)
See MoveDownMutation for the idea behind
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- max_diff_elements: The maximum number of different elements in the
individual. Default is infinite. If the elements are grouped max_diff_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- min_percentage_elements: The minimum percentage of any element in the
individual. Default is any number is allowed. If the elements are grouped min_percentage_elements should be supplied as a list with each input corresponding to the elements specified in the same input in element_pool.
- rng: Random number generator
By default numpy.random.
- Example: element_pool=[[A,B,C,D],[x,y,z]], max_diff_elements=[3,2],
min_percentage_elements=[.25, .5] An individual could be “D,B,B,C,x,x,x,x,z,z,z,z”
- class ase_ga.element_mutations.FullElementMutation(element_pool, verbose=False, num_muts=1, rng=np.random)[source]#
Mutation that exchanges an all elements of a certain type with another randomly chosen element from the supplied pool of elements. Any constraints on the mutation are inhereted from the original candidate.
Parameters:
- element_pool: List of elements in the phase space. The elements can be
grouped if the individual consist of different types of elements. The list should then be a list of lists e.g. [[list1], [list2]]
- rng: Random number generator
By default numpy.random.
Implementation of the cut-and-splice paring operator.
- class ase_ga.cutandsplicepairing.Positions(scaled_positions, cop, symbols, distance, origin)[source]#
Helper object to simplify the pairing process.
Parameters:
- scaled_positions: (Nx3) array
Positions in scaled coordinates
- cop: (1x3) array
Center-of-positions (also in scaled coordinates)
- symbols: str
String with the atomic symbols
- distance: float
Signed distance to the cutting plane
- origin: int (0 or 1)
Determines at which side of the plane the position should be.
- class ase_ga.cutandsplicepairing.CutAndSplicePairing(slab, n_top, blmin, number_of_variable_cell_vectors=0, p1=1, p2=0.05, minfrac=None, cellbounds=None, test_dist_to_slab=True, use_tags=False, rng=np.random, verbose=False)[source]#
The Cut and Splice operator by Deaven and Ho.
Creates offspring from two parent structures using a randomly generated cutting plane.
The parents may have different unit cells, in which case the offspring unit cell will be a random combination of the parent cells.
The basic implementation (for fixed unit cells) is described in:
doi: L.B. Vilhelmsen and B. Hammer, PRL, 108, 126101 (2012) <10.1103/PhysRevLett.108.126101>
The extension to variable unit cells is similar to:
The operator can furthermore preserve molecular identity if desired (see the use_tags kwarg). Atoms with the same tag will then be considered as belonging to the same molecule, and their internal geometry will not be changed by the operator.
If use_tags is enabled, the operator will also conserve the number of molecules of each kind (in addition to conserving the overall stoichiometry). Currently, molecules are considered to be of the same kind if their chemical symbol strings are identical. In rare cases where this may not be sufficient (i.e. when desiring to keep the same ratio of isomers), the different isomers can be differentiated by giving them different elemental orderings (e.g. ‘XY2’ and ‘Y2X’).
Parameters:
- slab: Atoms object
Specifies the cell vectors and periodic boundary conditions to be applied to the randomly generated structures. Any included atoms (e.g. representing an underlying slab) are copied to these new structures.
- n_top: int
The number of atoms to optimize
- blmin: dict
Dictionary with minimal interatomic distances. Note: when preserving molecular identity (see use_tags), the blmin dict will (naturally) only be applied to intermolecular distances (not the intramolecular ones).
- number_of_variable_cell_vectors: int (default 0)
The number of variable cell vectors (0, 1, 2 or 3). To keep things simple, it is the ‘first’ vectors which will be treated as variable, i.e. the ‘a’ vector in the univariate case, the ‘a’ and ‘b’ vectors in the bivariate case, etc.
- p1: float or int between 0 and 1
Probability that a parent is shifted over a random distance along the normal of the cutting plane (only operative if number_of_variable_cell_vectors > 0).
- p2: float or int between 0 and 1
Same as p1, but for shifting along the directions in the cutting plane (only operative if number_of_variable_cell_vectors > 0).
- minfrac: float between 0 and 1, or None (default)
Minimal fraction of atoms a parent must contribute to the child. If None, each parent must contribute at least one atom.
- cellbounds: ase_ga.utilities.CellBounds instance
Describing limits on the cell shape, see
CellBounds. Note that it only make sense to impose conditions regarding cell vectors which have been marked as variable (see number_of_variable_cell_vectors).- use_tags: bool
Whether to use the atomic tags to preserve molecular identity.
- test_dist_to_slab: bool (default True)
Whether to make sure that the distances between the atoms and the slab satisfy the blmin.
- rng: Random number generator
By default numpy.random.
- update_scaling_volume(population, w_adapt=0.5, n_adapt=0)[source]#
Updates the scaling volume that is used in the pairing
w_adapt: weight of the new vs the old scaling volume n_adapt: number of best candidates in the population that are used to calculate the new scaling volume
- get_new_individual(parents)[source]#
The method called by the user that returns the paired structure.
- generate_unit_cell(cell1, cell2, maxcount=10000)[source]#
Generates a new unit cell by a random linear combination of the parent cells. The new cell must satisfy the self.cellbounds constraints. Returns None if no such cell was generated within a given number of attempts.
Parameters:
- maxcount: int
The maximal number of attempts.
A collection of mutations that can be used.
- class ase_ga.standardmutations.RattleMutation(blmin, n_top, rattle_strength=0.8, rattle_prop=0.4, test_dist_to_slab=True, use_tags=False, verbose=False, rng=np.random)[source]#
An implementation of the rattle mutation as described in:
R.L. Johnston Dalton Transactions, Vol. 22, No. 22. (2003), pp. 4193-4207
Parameters:
- blmin: Dictionary defining the minimum distance between atoms
after the rattle.
n_top: Number of atoms optimized by the GA.
rattle_strength: Strength with which the atoms are moved.
rattle_prop: The probability with which each atom is rattled.
- test_dist_to_slab: whether to also make sure that the distances
between the atoms and the slab satisfy the blmin.
- use_tags: if True, the atomic tags will be used to preserve
molecular identity. Same-tag atoms will then be displaced collectively, so that the internal geometry is preserved.
- rng: Random number generator
By default numpy.random.
- class ase_ga.standardmutations.PermutationMutation(n_top, probability=0.33, test_dist_to_slab=True, use_tags=False, blmin=None, rng=np.random, verbose=False)[source]#
Mutation that permutes a percentage of the atom types in the cluster.
Parameters:
n_top: Number of atoms optimized by the GA.
probability: The probability with which an atom is permuted.
- test_dist_to_slab: whether to also make sure that the distances
between the atoms and the slab satisfy the blmin.
- use_tags: if True, the atomic tags will be used to preserve
molecular identity. Permutations will then happen at the molecular level, i.e. swapping the center-of- positions of two moieties while preserving their internal geometries.
- blmin: Dictionary defining the minimum distance between atoms
after the permutation. If equal to None (the default), no such check is performed.
- rng: Random number generator
By default numpy.random.
- class ase_ga.standardmutations.MirrorMutation(blmin, n_top, reflect=False, rng=np.random, verbose=False)[source]#
A mirror mutation, as described in TO BE PUBLISHED.
This mutation mirrors half of the cluster in a randomly oriented cutting plane discarding the other half.
Parameters:
- blmin: Dictionary defining the minimum allowed
distance between atoms.
n_top: Number of atoms the GA optimizes.
- reflect: Defines if the mirrored half is also reflected
perpendicular to the mirroring plane.
- rng: Random number generator
By default numpy.random.
- class ase_ga.standardmutations.StrainMutation(blmin, cellbounds=None, stddev=0.7, number_of_variable_cell_vectors=3, use_tags=False, rng=np.random, verbose=False)[source]#
Mutates a candidate by applying a randomly generated strain.
For more information, see also:
After initialization of the mutation, a scaling volume (to which each mutated structure is scaled before checking the constraints) is typically generated from the population, which is then also occasionally updated in the course of the GA run.
Parameters:
- blmin: dict
The closest allowed interatomic distances on the form: {(Z, Z*): dist, …}, where Z and Z* are atomic numbers.
- cellbounds: ase_ga.utilities.CellBounds instance
Describes limits on the cell shape, see
CellBounds.- stddev: float
Standard deviation used in the generation of the strain matrix elements.
- number_of_variable_cell_vectors: int (default 3)
The number of variable cell vectors (1, 2 or 3). To keep things simple, it is the ‘first’ vectors which will be treated as variable, i.e. the ‘a’ vector in the univariate case, the ‘a’ and ‘b’ vectors in the bivariate case, etc.
- use_tags: boolean
Whether to use the atomic tags to preserve molecular identity.
- rng: Random number generator
By default numpy.random.
- class ase_ga.standardmutations.PermuStrainMutation(permutationmutation, strainmutation, verbose=False)[source]#
Combination of PermutationMutation and StrainMutation.
For more information, see also:
Parameters:
- permutationmutation: OffspringCreator instance
A mutation that permutes atom types.
- strainmutation: OffspringCreator instance
A mutation that mutates by straining.
- class ase_ga.standardmutations.RotationalMutation(blmin, n_top=None, fraction=0.33, tags=None, min_angle=1.57, test_dist_to_slab=True, rng=np.random, verbose=False)[source]#
Mutates a candidate by applying random rotations to multi-atom moieties in the structure (atoms with the same tag are considered part of one such moiety).
Only performs whole-molecule rotations, no internal rotations.
For more information, see also:
Parameters:
- blmin: dict
The closest allowed interatomic distances on the form: {(Z, Z*): dist, …}, where Z and Z* are atomic numbers.
- n_top: int or None
The number of atoms to optimize (None = include all).
- fraction: float
Fraction of the moieties to be rotated.
- tags: None or list of integers
Specifies, respectively, whether all moieties or only those with matching tags are eligible for rotation.
- min_angle: float
Minimal angle (in radians) for each rotation; should lie in the interval [0, pi].
- test_dist_to_slab: boolean
Whether also the distances to the slab should be checked to satisfy the blmin.
- rng: Random number generator
By default numpy.random.
- class ase_ga.standardmutations.RattleRotationalMutation(rattlemutation, rotationalmutation, verbose=False)[source]#
Combination of RattleMutation and RotationalMutation.
Parameters:
- rattlemutation: OffspringCreator instance
A mutation that rattles atoms.
- rotationalmutation: OffspringCreator instance
A mutation that rotates moieties.
Operators that work on slabs. Allowed compositions are respected. Identical indexing of the slabs are assumed for the cut-splice operator.
- ase_ga.slab_operators.minority_element_segregate(atoms, layer_tag=1, rng=np.random)[source]#
Move the minority alloy element to the layer specified by the layer_tag, Atoms object should contain atoms with the corresponding tag.
- class ase_ga.slab_operators.SlabOperator(verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, element_pools=None, rng=np.random)[source]#
- get_symbols_to_use(syms)[source]#
Get the symbols to use for the offspring candidate. The returned list of symbols will respect self.allowed_compositions
- class ase_ga.slab_operators.CutSpliceSlabCrossover(allowed_compositions=None, element_pools=None, verbose=False, num_muts=1, tries=1000, min_ratio=0.25, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.RandomCompositionMutation(verbose=False, num_muts=1, element_pools=None, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
Change the current composition to another of the allowed compositions. The allowed compositions should be input in the same order as the element pools, for example: element_pools = [[‘Au’, ‘Cu’], [‘In’, ‘Bi’]] allowed_compositions = [(6, 2), (5, 3)] means that there can be 5 or 6 Au and Cu, and 2 or 3 In and Bi.
- class ase_ga.slab_operators.RandomElementMutation(element_pools, verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.NeighborhoodElementMutation(element_pools, verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.SymmetrySlabPermutation(verbose=False, num_muts=1, sym_goal=100, max_tries=50, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
Permutes the atoms in the slab until it has a higher symmetry number.
- class ase_ga.slab_operators.RandomSlabPermutation(verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.particle_crossovers.Crossover(rng=np.random)[source]#
Base class for all particle crossovers.
Originally intended for medium sized particles
Do not call this class directly.
- class ase_ga.particle_crossovers.CutSpliceCrossover(blmin, keep_composition=True, rng=np.random)[source]#
Crossover that cuts two particles through a plane in space and merges two halfes from different particles together.
Implementation of the method presented in: D. M. Deaven and K. M. Ho, Phys. Rev. Lett., 75, 2, 288-291 (1995)
It keeps the correct composition by randomly assigning elements in the new particle. If some of the atoms in the two particle halves are too close, the halves are moved away from each other perpendicular to the cutting plane.
Parameters:
- blmin: dictionary of minimum distance between atomic numbers.
e.g. {(28,29): 1.5}
- keep_composition: boolean that signifies if the composition should
be the same as in the parents.
- rng: Random number generator
By default numpy.random.
- class ase_ga.particle_mutations.Mutation(num_muts=1, rng=np.random)[source]#
Base class for all particle mutation type operators. Do not call this class directly.
- classmethod get_atomic_configuration(atoms, elements=None, eps=4e-2)[source]#
Returns the atomic configuration of the particle as a list of lists. Each list contain the indices of the atoms sitting at the same distance from the geometrical center of the particle. Highly symmetrical particles will often have many atoms in each shell.
For further elaboration see: J. Montejano-Carrizales and J. Moran-Lopez, Geometrical characteristics of compact nanoclusters, Nanostruct. Mater., 1, 5, 397-409 (1992)
Parameters:
- elements: Only take into account the elements specified in this
list. Default is to take all elements into account.
eps: The distance allowed to separate elements within each shell.
- class ase_ga.particle_mutations.RandomMutation(length=2., num_muts=1, rng=np.random)[source]#
Moves a random atom the supplied length in a random direction.
- class ase_ga.particle_mutations.RandomPermutation(elements=None, num_muts=1, rng=np.random)[source]#
Permutes two random atoms.
Parameters:
num_muts: the number of times to perform this operation.
- rng: Random number generator
By default numpy.random.
- class ase_ga.particle_mutations.COM2surfPermutation(elements=None, min_ratio=0.25, num_muts=1, rng=np.random)[source]#
The Center Of Mass to surface (COM2surf) permutation operator described in S. Lysgaard et al., Top. Catal., 2014, 57 (1-4), pp 33-39
Parameters:
- elements: which elements should be included in this permutation,
for example: include all metals and exclude all adsorbates
- min_ratio: minimum ratio of each element in the core or surface region.
If elements=[a, b] then ratio of a is Na / (Na + Nb) (N: Number of). If less than minimum ratio is present in the core, the region defining the core will be extended until the minimum ratio is met, and vice versa for the surface region. It has the potential reach the recursive limit if an element has a smaller total ratio in the complete particle. In that case remember to decrease this min_ratio.
num_muts: the number of times to perform this operation.
- rng: Random number generator
By default numpy.random.
- classmethod mutate(atoms, elements, min_ratio, rng=np.random)[source]#
Performs the COM2surf permutation.
- class ase_ga.particle_mutations.Poor2richPermutation(elements=[], num_muts=1, rng=np.random)[source]#
The poor to rich (Poor2rich) permutation operator described in S. Lysgaard et al., Top. Catal., 2014, 57 (1-4), pp 33-39
Permutes two atoms from regions short of the same elements, to regions rich in the same elements. (Inverse of Rich2poorPermutation)
Parameters:
elements: Which elements to take into account in this permutation
- rng: Random number generator
By default numpy.random.
- class ase_ga.particle_mutations.Rich2poorPermutation(elements=None, num_muts=1, rng=np.random)[source]#
The rich to poor (Rich2poor) permutation operator described in S. Lysgaard et al., Top. Catal., 2014, 57 (1-4), pp 33-39
Permutes two atoms from regions rich in the same elements, to regions short of the same elements. (Inverse of Poor2richPermutation)
Parameters:
elements: Which elements to take into account in this permutation
- rng: Random number generator
By default numpy.random.
- class ase_ga.particle_mutations.SymmetricSubstitute(elements=None, num_muts=1, rng=np.random)[source]#
Permute all atoms within a subshell of the symmetric particle. The atoms within a subshell all have the same distance to the center, these are all equivalent under the particle point group symmetry.
- class ase_ga.particle_mutations.RandomSubstitute(elements=None, num_muts=1, rng=np.random)[source]#
Substitutes one atom with another atom type. The possible atom types are supplied in the parameter elements
Operators that work on slabs. Allowed compositions are respected. Identical indexing of the slabs are assumed for the cut-splice operator.
- ase_ga.slab_operators.minority_element_segregate(atoms, layer_tag=1, rng=np.random)[source]#
Move the minority alloy element to the layer specified by the layer_tag, Atoms object should contain atoms with the corresponding tag.
- class ase_ga.slab_operators.SlabOperator(verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, element_pools=None, rng=np.random)[source]#
- get_symbols_to_use(syms)[source]#
Get the symbols to use for the offspring candidate. The returned list of symbols will respect self.allowed_compositions
- class ase_ga.slab_operators.CutSpliceSlabCrossover(allowed_compositions=None, element_pools=None, verbose=False, num_muts=1, tries=1000, min_ratio=0.25, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.RandomCompositionMutation(verbose=False, num_muts=1, element_pools=None, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
Change the current composition to another of the allowed compositions. The allowed compositions should be input in the same order as the element pools, for example: element_pools = [[‘Au’, ‘Cu’], [‘In’, ‘Bi’]] allowed_compositions = [(6, 2), (5, 3)] means that there can be 5 or 6 Au and Cu, and 2 or 3 In and Bi.
- class ase_ga.slab_operators.RandomElementMutation(element_pools, verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.NeighborhoodElementMutation(element_pools, verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
- class ase_ga.slab_operators.SymmetrySlabPermutation(verbose=False, num_muts=1, sym_goal=100, max_tries=50, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
Permutes the atoms in the slab until it has a higher symmetry number.
- class ase_ga.slab_operators.RandomSlabPermutation(verbose=False, num_muts=1, allowed_compositions=None, distribution_correction_function=None, rng=np.random)[source]#
Soft-mutation operator and associated tools
- class ase_ga.soft_mutation.TagFilter(atoms)[source]#
Filter which constrains same-tag atoms to behave like internally rigid moieties.
- class ase_ga.soft_mutation.PairwiseHarmonicPotential(atoms, rcut=10.)[source]#
Parent class for interatomic potentials of the type E(r_ij) = 0.5 * k_ij * (r_ij - r0_ij) ** 2
- ase_ga.soft_mutation.get_number_of_valence_electrons(Z)[source]#
Return the number of valence electrons for the element with atomic number Z, simply based on its periodic table group.
- class ase_ga.soft_mutation.BondElectroNegativityModel(atoms, rcut=10.)[source]#
Pairwise harmonic potential where the force constants are determined using the “bond electronegativity” model, see:
- class ase_ga.soft_mutation.SoftMutation(blmin, bounds=[0.5, 2.0], calculator=BondElectroNegativityModel, rcut=10., used_modes_file='used_modes.json', use_tags=False, verbose=False)[source]#
Mutates the structure by displacing it along the lowest (nonzero) frequency modes found by vibrational analysis, as in:
Lyakhov, Oganov, Valle, Comp. Phys. Comm. 181 (2010) 1623-1632
As in the reference above, the next-lowest mode is used if the structure has already been softmutated along the current-lowest mode. This mutation hence acts in a deterministic way, in contrast to most other genetic operators.
If you find this implementation useful in your work, please consider citing:
Van den Bossche, Gronbeck, Hammer, J. Chem. Theory Comput. 14 (2018)
in addition to the paper mentioned above.
Parameters:
- blmin: dict
The closest allowed interatomic distances on the form: {(Z, Z*): dist, …}, where Z and Z* are atomic numbers.
- bounds: list
Lower and upper limits (in Angstrom) for the largest atomic displacement in the structure. For a given mode, the algorithm starts at zero amplitude and increases it until either blmin is violated or the largest displacement exceeds the provided upper bound). If the largest displacement in the resulting structure is lower than the provided lower bound, the mutant is considered too similar to the parent and None is returned.
- calculator: ASE calculator object
The calculator to be used in the vibrational analysis. The default is to use a calculator based on pairwise harmonic potentials with force constants from the “bond electronegativity” model described in the reference above. Any calculator with a working
get_forces()method will work.- rcut: float
Cutoff radius in Angstrom for the pairwise harmonic potentials.
- used_modes_file: str or None
Name of json dump file where previously used modes will be stored (and read). If None, no such file will be used. Default is to use the filename ‘used_modes.json’.
- use_tags: boolean
Whether to use the atomic tags to preserve molecular identity.