wulfric.crystal.standardize#
- wulfric.crystal.standardize(cell, atoms, S_matrix=None, length_tolerance=1e-08, angle_tolerance=0.0001)[source]#
Standardize cell with respect to the Bravais lattice type as defined in [1] and update atom's relative coordinates.
- Parameters:
- cell(3, 3) array-like
Matrix of a primitive cell, rows are interpreted as vectors.
- atomsdict
Dictionary with atoms. Must have a
"positions"with value of (N,3) array-like.- S_matrix(3, 3) array-like, optional
Transformation matrix S. If not provided, then computed automatically from
cell. If provided, then it is user's responsibility to ensure that the matrix is the correct one for the givencell.- length_tolerancefloat, default \(10^{-8}\)
Tolerance for length variables (lengths of the lattice vectors). Default value is chosen in the contexts of condense matter physics, assuming that length is given in Angstroms. Please choose appropriate tolerance for your problem.
- angle_tolerancefloat, default \(10^{-4}\)
Tolerance for angle variables (angles of the lattice). Default value is chosen in the contexts of condense matter physics, assuming that angles are in degrees. Please choose appropriate tolerance for your problem.
- Returns:
- cell(3, 3) numpy.ndarray
Standardized cell. Rows are interpreted as vectors. Independent from the initial cell, safe to modify.
cell = [[a1_x, a1_y, a1_z], [a2_x, a2_y, a2_z], [a3_x, a3_y, a3_z]]
Notes
atomsare not returned, but rather updated.References
[1]Setyawan, W. and Curtarolo, S., 2010. High-throughput electronic band structure calculations: Challenges and tools. Computational materials science, 49(2), pp. 299-312.
Examples
>>> import numpy as np >>> import wulfric as wulf >>> cell = np.array([[2, 0, 0], [0, 1, 0], [0, 0, 3]]) >>> atoms = {"names" : ["Cr1", "Cr2"], "positions" : [[0.7, 0, 0], [0, 0.2, 0]]} >>> atoms["positions"][0] @ cell, atoms["positions"][1] @ cell (array([1.4, 0. , 0. ]), array([0. , 0.2, 0. ])) >>> cell = wulf.crystal.standardize(cell, atoms) >>> cell array([[ 0., -1., 0.], [-2., 0., 0.], [ 0., 0., -3.]]) >>> atoms {'names': ['Cr1', 'Cr2'], 'positions': [array([ 0. , -0.7, 0. ]), array([-0.2, 0. , 0. ])]} >>> # Note that absolute coordinates of atoms are not changed. >>> atoms["positions"][0] @ cell, atoms["positions"][1] @ cell (array([1.4, 0. , 0. ]), array([0. , 0.2, 0. ]))