Coordinates
Module containing the different coordinates classes that are used to store and modify positions in space. These can be separated into StandardCoordinates, which is used for ML models, AtomicCoordinates which is used for clusters of atoms, and MolecularCoordinates that stores molecular configurations.
- class topsearch.data.coordinates.AtomicCoordinates(atom_labels: list, position: NDArray[Any, Any], bond_cutoff: float = 1.5)
Description
Class to store the coordinates of an atomic system in Euclidean space. Methods to check configurations, modify atomic positions and write configurations to file
- bounds
The allowed ranges of the coordinates in each dimension
- Type:
list of tuples [(b1_min, b1_max), (b2_min, b2_max)…]
- ndim
The dimensionality of the coordinates, 3*n_atoms
- Type:
int
- position
Array of size ndim containing the current position (x1, y1, z1), …, (x_n, y_n, z_n)
- Type:
numpy array
- atom_labels
The species in the system, matching the order of position
- Type:
list
- check_atom_clashes() bool
Determine if there are atom clashes within the configuration
- get_atom(atom_ind: int) NDArray[Any, Any]
Get the Cartesian position of the atom given index atom_ind
- get_connected_atoms() list
Get the connected atom labels of each atom in cluster
- remove_atom_clashes()
Routine to remove clashes between atoms that result in very large gradient values
- same_bonds() bool
Check if we still have a connected network of atoms
- write_extended_xyz(energy: float, grad: NDArray[Any, Any], label: str = '') None
Dump an extended xyz file for visualisation
- write_xyz(label: str = '') None
Dump an xyz file for visualisation
- class topsearch.data.coordinates.MolecularCoordinates(atom_labels: list, position: NDArray[Any, Any])
Description
Class to store the coordinates of a molecular system, and methods to modify molecular conformations and write out configurations. Inherits from AtomicCoordinates, but contains additional functionality to generate internal coordinate representation and check bonding structure.
- bounds
The allowed ranges of the coordinates in each dimension
- Type:
list of tuples [(b1_min, b1_max), (b2_min, b2_max)…]
- ndim
The dimensionality of the coordinates, 3*n_atoms
- Type:
int
- position
Array of size ndim containing the current position
- Type:
numpy array
- atom_labels
The species in the system, matching the order of position
- Type:
list
- change_bond_angles(angles: list, step: list, bond_network: Graph) None
Given a list of bond angles, update them by all by step
- change_bond_length(bond: list, length: float, moved_atoms: list) None
Modify the selected bond length by distance length along the current bond vector
- change_bond_lengths(bonds: list, step: list, bond_network: Graph) None
Given a list of bonds change their bond lengths by step
- change_dihedral_angles(bond_dihedrals: list, step: list, bond_network: Graph) None
Update a list of dihedrals by angles specified in step
- get_bond_angle_info() tuple
Given the current Cartesian coordinates of the atoms in self.position compute all dihedrals, angles and bond lengths needed to define the molecular configuration
- get_bonds() Graph
Find the current bonding framework for self.position
- get_connected_atoms() list
Get the connected atom labels of each atom in molecule
- get_movable_atoms(bond: list, bond_type: str, bond_network: Graph) list
For a given dihedral return the atoms that should be rotated
- get_planar_rings() list
Find the atoms that belong to a planar ring in the molecule
- get_repeat_dihedrals(dihedrals: list) list
Only retain one dihedral when multiple share the same central bond. Returns a list of repeats to remove
- get_rotatable_dihedrals() list
Find all the dihedral angles we can rotate about, along with the atoms that should be rotated for each
- get_rotation_matrix(angle: float) NDArray[Any, Any]
Generate rotation matrix for rotation about x axis
- get_specific_bond_angle_info(bonds: list, angles: list, dihedrals: list, permutation: NDArray[Any, Any]) tuple
Find the bond lengths, bond angles and bond dihedrals for those specified in the input lists, accounting for the permutation of atoms according to permutation
- remove_atom_clashes(force_field: type) None
Check for clashes between atoms. Any atom pairs closer than 0.8*natural_cutoffs can cause a failure for electronic structure calculations so locally minimise to remove clashes with stable empirical force field
- remove_repeat_angles(angles: list) list
To change between conformations we can remove one angle centered on each atom as it is specified by the rest
- rotate_angle(angle_atoms: list, angle: float, moved_atoms: list) None
Rotate one of the bonds in order to change the angle between the two bonds defined by atom0-atom1 and atom1-atom2
- rotate_dihedral(bond: list, angle: float, moved_atoms: list) None
Perform rotation about central bond to change dihedral angle defined between four consecutive atoms
- same_bonds() bool
Compares the bonding framework of the current coordinates with the initial coordinates (self.reference_bonds)
- class topsearch.data.coordinates.StandardCoordinates(ndim: int, bounds: list = None)
Description
Class to store a position in space, and the methods to analyse if at bounds
- bounds
The allowed ranges of the coordinates in each dimension
- Type:
list of tuples [(b1_min, b1_max), (b2_min, b2_max)…]
- ndim
The dimensionality of the coordinates
- Type:
int
- position
Array of size ndim containing the current position
- Type:
numpy array
- active_bounds() tuple[NDArray[Any, Any], NDArray[Any, Any]]
Checks whether the position is at the upper or lower bounds
- all_bounds() bool
Check if the position is at the bounds in all dimensions
- at_bounds() bool
Check if the position is at the bounds in any dimension
- check_bounds() NDArray[Any, Any]
Check if position is at the bounds. Returns boolean array denoting which dimensions are at the bounds
- generate_random_point() NDArray[Any, Any]
Return an random point within the bound ranges
- move_to_bounds()
Move the coordinates to within the bounds if currently outside