wulfric.geometry.get_volume#
- wulfric.geometry.get_volume(*args)[source]#
Computes volume.
Three types of arguments are expected:
- One argument.
Matrix
cell. Volume is computed as:\[V = \boldsymbol{v_1} \cdot (\boldsymbol{v_2} \times \boldsymbol{v_3})\]
- Three arguments.
Vectors
v1,v2,v3. Volume is computed as:\[V = \boldsymbol{v_1} \cdot (\boldsymbol{v_2} \times \boldsymbol{v_3})\]
- Six arguments.
Parameters
a,b,c,alpha,beta,gamma. Volume is computed as:\[V = abc\sqrt{1+2\cos(\alpha)\cos(\beta)\cos(\gamma)-\cos^2(\alpha)-\cos^2(\beta)-\cos^2(\gamma)}\]
- Parameters:
- v1(3,) array-like
First vector.
- v2(3,) array-like
Second vector.
- v3(3,) array-like
Third vector.
- cell(3, 3) array-like
Matrix of a cell, rows are interpreted as vectors.
- afloat, default 1
Length of the \(v_1\) vector.
- bfloat, default 1
Length of the \(v_2\) vector.
- cfloat, default 1
Length of the \(v_3\) vector.
- alphafloat, default 90
Angle between vectors \(v_2\) and \(v_3\). In degrees.
- betafloat, default 90
Angle between vectors \(v_1\) and \(v_3\). In degrees.
- gammafloat, default 90
Angle between vectors \(v_1\) and \(v_2\). In degrees.
- Returns:
- volumefloat
Volume of corresponding region in space.
Examples
>>> import wulfric >>> wulfric.geometry.get_volume([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) 1.0 >>> wulfric.geometry.get_volume([1, 0, 0], [0, 1, 0], [0, 0, 1]) 1.0 >>> wulfric.geometry.get_volume(1, 1, 1, 90, 90, 90) 1.0