amd.utils module¶
Helpful utility functions, e.g. unit cell diameter, converting cell parameters to Cartesian form, and an ETA class.
- amd.utils.diameter(cell)¶
Diameter of a unit cell (as a square matrix in Cartesian form) in 3 or fewer dimensions.
- amd.utils.cellpar_to_cell(a, b, c, alpha, beta, gamma)¶
Simplified version of function from
ase.geometry
of the same name. 3D unit cell parameters a,b,c,α,β,γ –> cell as 3x3 NumPy array.
- amd.utils.cellpar_to_cell_2D(a, b, alpha)¶
2D unit cell parameters a,b,α –> cell as 2x2 ndarray.
- amd.utils.neighbours_from_distance_matrix(n: int, dm: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray] ¶
Given a distance matrix, find the n nearest neighbours of each item.
- Parameters
n (int) – Number of nearest neighbours to find for each item.
dm (numpy.ndarray) – 2D distance matrix or 1D condensed distance matrix.
- Returns
nn_dm, inds –
nn_dm[i][j]
is the distance from itemi
to itsj+1
st nearest neighbour, andinds[i][j]
is the index of this neighbour (j+1
since index 0 is the first nearest neighbour).- Return type
Tuple[numpy.ndarray, numpy.ndarray]
- amd.utils.lattice_cubic(scale=1, dims=3)¶
Return a pair
(motif, cell)
representing a hexagonal lattice, passable toamd.AMD()
oramd.PDD()
.
- amd.utils.lattice_hexagonal(scale=1)¶
Dimension 3 only. Return a pair
(motif, cell)
representing a cubic lattice, passable toamd.AMD()
oramd.PDD()
.
- amd.utils.random_cell(length_bounds=(1, 2), angle_bounds=(60, 120), dims=3)¶
Dimensions 2 and 3 only. Random unit cell with uniformally chosen length and angle parameters between bounds.