structopt.common.individual.mutations

class structopt.common.individual.mutations.Mutations(parameters)

Bases: object

static move_atoms(individual, max_natoms=0.2)

Randomly moves atoms within the individual (in place).

Parameters:
  • individual (Individual) – an individual
  • max_natoms (float or int) – if float, the maximum number of atoms that will be moved is max_natoms*len(individual) if int, the maximum number of atoms that will be moved is max_natoms default: 0.20
mutate(individual)
static permutation(individual)

Swaps the chemical symbol between two elements

Parameters:individual (Individual) – An individual or atoms object.
post_processing(individual)
static rattle(individual, stdev=0.5, x_avg_bond=True)

Randomly displace all atoms in a random direction with a magnitude drawn from a gaussian distribution.

Parameters:
  • individual (Individual) – An individual
  • stdev (float) – The standard deviation of the gaussian distribution to rattle all the atoms. If x_avg_bond is set to True, given as the fraction of the average bond length of the material.
  • x_avg_bond (bool) – If True, the gaussian distributions standard deviation is stdev * avg_bond_length. Note, this only applies to fcc, hcp, or bcc materials.
static rotate_all(atoms, vector=None, angle=None, center=None)

Rotate all atoms around a single point. Most suitable for cluster calculations.

Parameters:
  • individual (Individual) – An individual.
  • vector (string or list) – The list of axes in which to rotate the atoms around. If None, is a randomly chosen direction. If ‘random’ in list, a random vector can be chosen.
  • angle (string or list) – A list of angles that will be chosen to rotate. If None, is randomly generated. Angle must be given in radians. If ‘random’ in list, a random angle is included.
  • center (string or xyz iterable) – The center in which to rotate the atoms around. If None, defaults to center of mass. Acceptable strings are COM = center of mass COP = center of positions COU = center of cell
static rotate_atoms(individual, max_natoms=0.2)

Randomly rotates a number of random atoms within the individual (in place).

Parameters:
  • individual (Individual) – an individual
  • max_natoms (float or int) – if float, the maximum number of atoms that will be rotated is max_natoms*len(individual) if int, the maximum number of atoms that will be rotated is max_natoms default: 0.20
static rotate_cluster(individual, max_natoms=0.2)

Randomly rotates a random cluster of atoms within the individual (in place).

Parameters:
  • individual (Individual) – an individual
  • max_natoms (float or int) – if float, the maximum number of atoms that will be rotated is max_natoms*len(individual) if int, the maximum number of atoms that will be rotated is max_natoms default: 0.20
select_mutation()
static swap_positions(individual, max_natoms=0.2)

Randomly swaps the positions atoms within the individual (in place).

Parameters:
  • individual (Individual) – an individual
  • max_natoms (float or int) – if float, the maximum number of atoms whose positions will be swapped is max_natoms*len(individual) if int, the maximum number of atoms whose positions will be swapped is max_natoms if the number of atoms to be swapped is (or evaluates to) an odd integer, it is rounded down to an even integer max_natoms corresponds to the maximum number of atoms whose positions will change default: 0.20
static swap_species(individual, max_natoms=0.2)

Randomly swaps the species of atoms within the individual (in place).

Parameters:
  • individual (Individual) – an individual
  • max_natoms (float or int) – if float, the maximum number of atoms that will be swapped is max_natoms*len(individual) if int, the maximum number of atoms that will be swapped is max_natoms if the number of atoms to be swapped is (or evaluates to) an odd integer, it is rounded down to an even integer max_natoms corresponds to the maximum number of atoms whose species will change default: 0.20