SimulationUtilities Package¶
SimulationUtilities.Communication_Codes Module¶
-
SimulationUtilities.Communication_Codes.
comm_code
(label)[source]¶ This function takes a string describing the type of communication being made and converts it to a machine friendly value.
Parameters: label (str) – The human-readable form of the communication code. Returns: The machine-readable form of the communication code. Return type: int
SimulationUtilities.Configuration_Processing Module¶
-
SimulationUtilities.Configuration_Processing.
convert_atoms_to_vector
(atoms)[source]¶ Converts an Atomistic Simulation Environment atoms object into a vector which can be used with the curve shortening algorithm.
Parameters: atoms (ase.atoms) – The ASE atoms object whose position is to be converted to a vector. Returns: A vector of atomistic positions. Return type: numpy.array
-
SimulationUtilities.Configuration_Processing.
convert_vector_to_atoms
(vector, dimension=3)[source]¶ The inverse of convert_atoms_to_vector.
Parameters: - vector (numpy.array) – The vector containing the position of the atoms to be converted.
- dimension (optional int) – The dimension of the space in which the simulation is taking place. The default value is 3.
Returns: An ASE atoms object friendly NumPy array containing the atomistic positions.
Return type: numpy.array
-
SimulationUtilities.Configuration_Processing.
read_configuration_file
(configuration_file)[source]¶ Import the configuration file and store the parsed values in a dictionary.
Parameters: configuration_file (str) – The address of the configuration file as required by the Python open command. Returns: A dictionary containing the parsed values from the configuration file. Return type: dict
SimulationUtilities.Curve Module¶
-
class
SimulationUtilities.Curve.
Curve
(start_point, end_point, number_of_nodes, total_number_of_nodes)[source]¶ The purpose of this object is to provide a Curve object that has similar behaviour to that described in [Sutton2013].
-
start_point
¶ numpy.array
A NumPy array describing the first point in the curve.
-
end_point
¶ numpy.array
A NumPy array describing the last point in the curve.
-
number_of_nodes
¶ int
The total number of nodes that the curve is to consist of, including the start and end points.
-
total_number_of_nodes
¶ int
The total number of nodes in the curve, including local_nodes - only used to compute the correct scaling of the tangent vector.
-
tangent
¶ numpy.array
The tangent of the straight line segment joining the start_point to the end_point, rescaled according to [Sutton2013].
-
points
¶ numpy.array
An NumPy array containing all the points of the curve.
-
default_initial_state
¶ numpy.array
A NumPy array consisting of flags that indicate which nodes are movable initially.
-
movement
¶ float
A variable which records the total movement of the curve as calculated in [Sutton2013].
-
nodes_moved
¶ numpy.array
A binary NumPy array indicating whether a node has been moved. Used to determine when all the nodes in the curve have been moved.
-
node_movable
¶ numpy.array
A binary NumPy array indicating whether a node is movable.
-
number_of_distinct_nodes_moved
¶ int
A counter recording the total number of nodes that have moved.
-
configuration
¶ dict
A dictionary containing the information from the configuration file.
-
all_nodes_moved
()[source]¶ This method determines whether every node in the global curve has been tested for length reduction.
Returns: True if all of the nodes have been tested, False otherwise. Return type: bool
-
get_points
()[source]¶ Accessor method for the points attribute.
Returns: An array containing all of the points of the curve. Return type: numpy.array
-
next_movable_node
()[source]¶ Determine next movable node, given existing information about previously distributed nodes.
Returns: The node number of the next movable node. If no such node exists then it returns None. Return type: int
-
set_node_movable
()[source]¶ Resets all of the flags in the curve to indicate that the nodes in default_initial_state are movable.
Parameters: - node_number (int) – The node number of the node whose position is to be updated.
- new_position (numpy.array) – The new position of the node.
-
set_node_position
(node_number, new_position)[source]¶ Update the position of the node at node_number to new_position. This processes the logic for releasing neighbouring nodes for further computation.
Parameters: - node_number (int) – The node number of the node whose position is to be updated.
- new_position (numpy.array) – The new position of the node.
-
SimulationUtilities.Extract_States_PDB Module¶
-
SimulationUtilities.Extract_States_PDB.
extract_states_pdb
(pdb_filename, x0_location, xN_location, x0_index, xN_index)[source]¶ This function is an ASE wrapper that produces a start and end configuration from a PDB file containing multiple conformation.
Parameters: - pdb_filename (str) – The location of the PDB file.
- x0_location (str) – The location of where to write the x0.xyz file, that is the starting configuration.
- xN_location (str) – The location of where to write the xN.xyz file, the final configuration.
- x0_index (int) – The index in the PDB file of the starting configuration.
- xN_index (int) – The index in the PDB file of the final configuration.
SimulationUtilities.Visualize Module¶
-
SimulationUtilities.Visualize.
write_xyz_animation
(curve_pickle, filename)[source]¶ This function takes a curve object that has been pickled and writes out an XYZ animation file to use with JMol.
Parameters: - curve_pickle (str) – The location of a pickled curve object.
- filename (str) – The location of where to write the XYZ animation.