Mutation.py¶
This describe a cluster, where the system information is stored in the Genetic Algorithm
-
class
Organisms.GA.Mutation.
Mutation
(mutation_types, r_ij, vacuum_to_add_length)¶ This class contains all the information and proceedures required to perform a Mutation.
- Parameters
mutation_types ([(str, float),..]) – Contains the information about the mutations that the user would like to perform. See Manual for more information about this.
r_ij (float) – The maximum distance that should be between atoms to be considered bonded. This value should be as large a possible, to reflected the longest bond possible between atoms in the cluster.
vacuum_to_add_length (float) – The amount of vacuum to place around the cluster
-
change_mutation_chances
()¶ This method will change the format of self.mutation_types into a format that can be used by this Mutation class.
- The format of self.mutation_types changes as follows with this example.
[] => []
-
check
(r_ij)¶ This method will check that the inputs for the mutation_types has been done correctly, without any violating issues.
- Parameters
r_ij (float) – The maximum distance that should be between atoms to be considered bonded. This value should be as large a possible, to reflected the longest bond possible between atoms in the cluster.
-
get_mutation_type
()¶ This definition will pick the type of mutation.
- Returns
mutation_type
- Rtypes
str.
-
mutation
(mutation_method, cluster_to_mutate, cell_length=None, vacuum_length=None)¶ This method will perform the mutation and return the mutant.
- Inputs:
mutation_method (str.): The type of mutation to use for the mutation cluster_to_mutate (GA>Cluster): This is the cluster that we would like to perform a mutation upon. cell_length (float): This is the cell length of the unit cell. vacuum_length (float): The amount of vacuum to add to the unit cell.
- Returns
mutant
- Rtypes
Atom
-
pickClusterFromThePopulation
(population)¶ This definition will pick the cluster from the population to mutate.
- Inputs:
population (GA.Population): The population to choose the cluster to mutate from.
- Returns
cluster_to_mutate - The list of parents for mating.
- Rtypes
Cluster
-
run
(run_input, cell_length=None, vacuum_length=None)¶ This definition will run the Mutation Proceedure.
- Inputs:
run_input (GA.Population/GA.Cluster/ase.Atoms): This is the input data about the cluster to mutate, or the population to take a cluster to mutate. cell_length (float): This is the cell length of the unit cell. vacuum_length (float): The amount of vacuum to add to the unit cell.
- Returns
mutant (GA.Cluster) - The mutated cluster mutation_method (str.) - The type of mutation that was picked to use for this mutation.
-
Organisms.GA.Mutation.
isfloat
(element)¶ Is the input a float.
- Parameters
element (Any) – some input
:returns True if the element can be considered a float, False if not. :rtype ebool.