Other utilities¶
-
acat.utilities.
neighbor_shell_list
(atoms, dx=0.3, neighbor_number=1, different_species=False, mic=False, radius=None, span=False)[source]¶ Make dict of neighboring shell atoms for both periodic and non-periodic systems. Possible to return neighbors from defined neighbor shell e.g. 1st, 2nd, 3rd by changing the neighbor number.
- Parameters
atoms (ase.Atoms object) – Accept any ase.Atoms object. No need to be built-in.
dx (float, default 0.3) – Buffer to calculate nearest neighbor pairs.
neighbor_number (int, default 1) – Neighbor shell number.
different_species (boolean, default False) – Whether each neighbor pair are different species.
mic (boolean, default False) – Whether to apply minimum image convention. Remember to set mic=True for periodic systems.
radius (float, default None) – The radius of each shell. Works exactly as a conventional neighbor list when specified. If not specified, use covalent radii instead.
span (boolean, default False) – Whether to include all neighbors spanned within the shell.
-
acat.utilities.
get_connectivity_matrix
(neighborlist)[source]¶ Returns a connectivity matrix from a neighborlist object.
- Parameters
neighborlist (dict) – A neighborlist (dictionary) that contains keys of each atom index and values of their neighbor atom indices.
-
acat.utilities.
get_mic
(p1, p2, cell, pbc=[1, 1, 0], max_cell_multiple=100000.0, return_squared_distance=False)[source]¶ A highly efficient function for getting all vectors from p1 to p2. Also able to calculate the squared distance using the minimum image convention (mic). This function is useful when you want to constantly calculate mic between two given positions. Please use ase.geometry.find_mic if you want to calculate an array of vectors all at a time (useful for e.g. neighborlist).
- Parameters
p1 (numpy.array) – The 3D Cartesian coordinate of the position 1.
p2 (numpy.array) – The 3D Cartesian coordinate of the position 2.
cell (numpy.array) – The 3D parallel epipedal unit cell.
pbc (numpy.array or list, default [1, 1, 0]) – Whether cell is periodic in each direction.
max_cell_multiple (int, default 1e5) – A large number to account for the maximum repetitions of each of the lattice vectors. The minimum number of repetitions is hence calculated by the algorithm using the intersection of a sphere and the unit cell.
return_squared_distance (bool, default False) – Whether to return the squared mic distance instead of the mic vector.
-
acat.utilities.
get_close_atoms
(atoms, cutoff=0.5, mic=False, delete=False)[source]¶ Get a list of close atoms and delete one set of them if requested. Identify all atoms that lie within the cutoff radius of each other.
- Parameters
atoms (ase.Atoms object) – Accept any ase.Atoms object. No need to be built-in.
cutoff (float, default 0.5) – The cutoff radius. Two atoms are too close if the distance between them is less than this cutoff
mic (bool, default False) – Whether to apply minimum image convention. Remember to set mic=True for periodic systems.
delete (bool, default False) – Whether to delete one set of the close atoms.
-
acat.utilities.
atoms_too_close
(atoms, cutoff=0.5, mic=False)[source]¶ Check if there are atoms that are too close to each other.
- Parameters
atoms (ase.Atoms object) – Accept any ase.Atoms object. No need to be built-in.
cutoff (float, default 0.5) – The cutoff radius. Two atoms are too close if the distance between them is less than this cutoff
mic (bool, default False) – Whether to apply minimum image convention. Remember to set mic=True for periodic systems.
-
acat.utilities.
atoms_too_close_after_addition
(atoms, n_added, cutoff=1.5, mic=False)[source]¶ Check if there are atoms that are too close to each other after adding some new atoms.
- Parameters
atoms (ase.Atoms object) – Accept any ase.Atoms object. No need to be built-in.
n_added (int) – Number of newly added atoms.
cutoff (float, default 1.5) – The cutoff radius. Two atoms are too close if the distance between them is less than this cutoff
mic (bool, default False) – Whether to apply minimum image convention. Remember to set mic=True for periodic systems.
-
acat.utilities.
get_angle_between
(v1, v2)[source]¶ Returns the angle in radians between vectors ‘v1’ and ‘v2’.
- Parameters
v1 (numpy.array) – Vector 1.
v2 (numpy.array) – Vector 2.
-
acat.utilities.
get_rejection_between
(v1, v2)[source]¶ Calculate the vector rejection of vector ‘v1’ perpendicular to vector ‘v2’.
- Parameters
v1 (numpy.array) – Vector 1.
v2 (numpy.array) – Vector 2.
-
acat.utilities.
get_rotation_matrix
(v1, v2)[source]¶ Return the rotation matrix R that rotates unit vector v1 onto unit vector v2.
- Parameters
v1 (numpy.array) – Vector 1.
v2 (numpy.array) – Vector 2.
-
acat.utilities.
get_rodrigues_rotation_matrix
(axis, angle)[source]¶ Return the Rodrigues rotation matrix associated with counter-clockwise rotation about the given axis by an angle.
- Parameters
axis (numpy.array) – The axis (vector) to rotate around with.
angle (numpy.array) – The angle (in radians) to rotate around.
-
acat.utilities.
get_total_masses
(symbol)[source]¶ Get the total molar mass given the chemical symbol of a molecule.
- Parameters
symbol (str) – Chemical symbol of the molecule.
-
acat.utilities.
string_fragmentation
(adsorbate)[source]¶ A function for generating a fragment list (list of strings) from a given adsorbate (string).
- Parameters
adsorbate (str) – The string of the adsorbate molecule.