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:
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.