wulfric.cell.from_params#
- wulfric.cell.from_params(a=1.0, b=1.0, c=1.0, alpha=90.0, beta=90.0, gamma=90.0)[source]#
Constructs the cell from lattice parameters.
The spatial orientation of the cell is decided as
Lattice vector \(\boldsymbol{a_1}\) has the length
aand oriented along \({\cal x}\) axis.Lattice vector \(\boldsymbol{a_2}\) has the length
b, is placed in \({\cal xy}\) plane and form an anglegammawith vector \(\boldsymbol{a_1}\), positive in a mathematical sense.Lattice vector \(\boldsymbol{a_3}\) has the length
cand form an anglealphawith the vector \(\boldsymbol{a_2}\) and an anglebetawith the vector \(\boldsymbol{a_1}\).
- Parameters:
- afloat, default 1.0
Length of the \(\boldsymbol{a_1}\) vector.
- bfloat, default 1.0
Length of the \(\boldsymbol{a_2}\) vector.
- cfloat, default 1.0
Length of the \(\boldsymbol{a_3}\) vector.
- alphafloat, default 90.0
Angle between vectors \(\boldsymbol{a_2}\) and \(\boldsymbol{a_3}\) given in degrees.
- betafloat, default 90.0
Angle between vectors \(\boldsymbol{a_1}\) and \(\boldsymbol{a_3}\) given in degrees.
- gammafloat, default 90.0
Angle between vectors \(\boldsymbol{a_1}\) and \(\boldsymbol{a_2}\) given in degrees.
- Returns:
- cell(3, 3) numpy.ndarray
Matrix of a direct cell, rows are interpreted as vectors.
cell = [ [a1_x, a1_y, a1_z], [a2_x, a2_y, a2_z], [a3_x, a3_y, a3_z], ]
- Raises:
- ValueError
If parameters could not form a parallelepiped.
See also
get_paramswulfric.geometry.parallelepiped_checkCheck if parameters can form a parallelepiped.
Examples
>>> import wulfric >>> import numpy as np >>> np.around(wulfric.cell.from_params(1, 2, 3, 90, 90, 60), 6) array([[1. , 0. , 0. ], [1. , 1.732051, 0. ], [0. , 0. , 3. ]])
>>> wulfric.cell.from_params(1, 2, 3, 60, 60, 130) Traceback (most recent call last): ... ValueError: Parameters could not form a parallelepiped: a = 1 b = 2 c = 3 alpha = 60 beta = 60 gamma = 130 Inequality gamma < alpha + beta is not satisfied with numerical tolerance: 0.0001