Cluster.py
This describe a cluster, where the system information is stored in the Genetic Algorithm
Cluster.py, 12/04/2017, Geoffrey R Weal
This class is specifically designed to hold cluster objects for the Genetic Algorithm program. This object will hold a reference to the Atoms class from ASE for the cluster, the energy of the cluster and the dir tag for the cluster
- class Organisms.GA.Cluster.Cluster(symbols=None, positions=None, numbers=None, tags=None, momenta=None, masses=None, magmoms=None, charges=None, scaled_positions=None, cell=None, pbc=None, celldisp=None, constraint=None, calculator=None, info=None, surface=None)
This class is designed to clude all the information that the genetic algorithm needs to know from the chemical system.
- Parameters:
symbols (str (formula) or list of str., or ASE.Atoms) – This can be a list of all the chemical symbols of atoms in the clusters, OR, the ASE.Atoms object that this object will be base on. For writing this as a list of element symbols, see See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
positions (list of xyz-positions) – A list of all the (x,y,z) values for the cluster. See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
numbers (list of int) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
tags (list of int) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
momenta (list of xyz-momenta) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
masses (list of float) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
magmoms (list of float or list of xyz-values) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
charges (list of float) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
scaled_positions (list of scaled-positions) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
cell (3x3 matrix or length 3 or 6 vector) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
pbc (one or three bool) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
celldisp (Vector) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
constraint (constraint object(s)) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
calculator (calculator object) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
info (dict of key-value pairs) – See https://wiki.fysik.dtu.dk/ase/ase/atoms.html?highlight=atoms#ase.Atoms for more information. Default: None
surface (ASE.Atoms/str.) – This is the surface that the cluster is modelled on. This is given either as a string or the ASE.Atoms object. Default: None
- centre_cluster_at_centre_of_cell(vacuumAdd)
This method will center the cluster in the middle of the cell. This method has been employed to make it easier to look at clusters that are made during the Organisms program.
- Parameters:
vacuumAdd (float) – The amount of value to add around the cluster.
- custom_verify_cluster(name, gen_made, cluster_energy, ever_in_population, excluded_because_violates_predation_operator, initial_population)
This method allows you to custom verify the cluster. To be used when resuming the genetic algorithm.
- Parameters:
name (int/str.) – The name that the cluster is referenced in this genetic algorithm program. This should be a integer that is based on when the cluster was made.
gen_made (int) – This is the generation when the cluster was created
ever_in_population (bool.) – Was this cluster ever in the population.
excluded_because_violates_predation_operator (bool.) – Was the cluster removed from the offspring pool because it violated the predation operator
initial_population (bool.) – Was the cluster apart of the initial population, either at rhe beginning of the population or after an epoch.
- deepcopy()
Will create a copy of the Cluster. This copy does not include a copy of the calculator as this has the potential to cause issues.
- deepcopy_skeleton()
This will create a copy of the cluster that does not contain any atoms, but will contain all the other settings for this cluster.
- get_elemental_makeup()
This gives a list which indicates the types of elements, and the number of those elements, in the cluster
- Returns:
A list which indicates the types of elements, and the number of those elements, in the cluster
- Return type:
{str: int, …} (old output was [[str.,int],…])
- get_total_cluster_energy(rounding_criteria=None)
Obtain the energy of the cluster to a predefined decimal place.
- Parameters:
rounding_criteria (int) – The number of decimal places that the cluster’s energy is rounded to.
returns energy: This is the energy of the cluster rtype energy: float
- remove_calculator()
This method will remove the calculator for this Cluster
- sortZ()
Sort the cluster from most positive to most negative value of z.
This sorting by z axis is required to allow the algorithm to easily split itself into two sides of a dividing plane.
- verify_cluster(name, gen_made, vacuum_length, rounding_criteria)
This method will verify that the cluster contains all the other information that it needs to run during the genetic algorithm, providing the name, generation made, and the energy of the cluster, as well as centering in a unit cell. This method is performed after the cluster has been locally optimised.
- Parameters:
name (int/str.) – The name that the cluster is referenced in this genetic algorithm program. This should be a integer that is based on when the cluster was made.
gen_made (int) – This is the generation when the cluster was created
vacuum_length (float) – This is the amount of vacuum to give the cluster.
rounding_criteria (int) – The number of decimal places that the cluster’s energy is rounded to.
- view()
Allow the user to visually look at the cluster using the ASE gui. This is a debugging method.
- Organisms.GA.Cluster.import_surface(surface)
This method is designed to import the surface into the genetic algorithm.
- Parameters:
surface (str/ASE.Atoms.) – This is the surface that the cluster is optimised upon.