pyextal.metric¶
Metric Tensor Calculations.
This module provides functions for performing crystallographic calculations using a Gram matrix (metric tensor). These functions are essential for working with crystal lattices where the basis vectors are not necessarily orthogonal.
Functions¶
|
Calculates the inner product of two vectors using a Gram matrix. |
|
Calculates the volume of the unit cell from its Gram matrix. |
|
Calculates the angle between two vectors in a space defined by a Gram matrix. |
|
Calculates the magnitude (norm) of a vector using a Gram matrix. |
Module Contents¶
- pyextal.metric.sumx(gram: numpy.ndarray, v1: numpy.ndarray, v2: numpy.ndarray) float ¶
Calculates the inner product of two vectors using a Gram matrix.
This function computes v2^T * G * v1, where G is the Gram matrix.
- Parameters:
gram (np.ndarray) – The Gram matrix (metric tensor).
v1 (np.ndarray) – The first vector.
v2 (np.ndarray) – The second vector.
- Returns:
The inner product of the two vectors.
- Return type:
float
- pyextal.metric.volume(gram: numpy.ndarray) float ¶
Calculates the volume of the unit cell from its Gram matrix.
The volume is the square root of the determinant of the Gram matrix.
- Parameters:
gram (np.ndarray) – The Gram matrix of the unit cell.
- Returns:
The volume of the unit cell.
- Return type:
float
- pyextal.metric.angle(gram: numpy.ndarray, v1: numpy.ndarray, v2: numpy.ndarray) float ¶
Calculates the angle between two vectors in a space defined by a Gram matrix.
- Parameters:
gram (np.ndarray) – The Gram matrix.
v1 (np.ndarray) – The first vector.
v2 (np.ndarray) – The second vector.
- Returns:
The angle between the vectors in radians.
- Return type:
float
- pyextal.metric.scale(gram: numpy.ndarray, v: numpy.ndarray) float ¶
Calculates the magnitude (norm) of a vector using a Gram matrix.
- Parameters:
gram (np.ndarray) – The Gram matrix.
v (np.ndarray) – The vector whose magnitude is to be calculated.
- Returns:
The magnitude of the vector.
- Return type:
float