pyxtal_ff.descriptors.SO4¶
-
class
pyxtal_ff.descriptors.SO4.SO4_Bispectrum(lmax=3, rcut=3.5, derivative=True, stress=False, normalize_U=False, cutoff_function='cosine')[source]¶ Bases:
objectPyxtal implementation of SO4 bispectrum component calculator. The difference between this implementation and the SNAP implementation lies exclusively with the choice of unit quaternion (removing singularities for rotations of 0 and 2pi) and the method of calculating Wigner-U functions
here we use a polynomial form of the Wigner-D matrices to calculate the U-functions and thus the gradients can be calculated simultaneously through differentiating the U-functions using horner form
-
build_neighbor_list(atom_ids=None)[source]¶ Builds a neighborlist for the calculation of bispectrum components for a given ASE atoms object given in the calculate method.
-
calculate(atoms, atom_ids=None)[source]¶ Parameters: atoms – ASE atoms object for the corresponding structure returns: a dictionary with the bispectrum components, their gradients, and the elemental specie of each atom in the atoms object
-
cutoff_function¶
-
derivative¶
-
initialize_arrays()[source]¶ Initialize the arrays to store the bispectrum components and their derivatives
-
lmax¶
-
normalize_U¶
-
rcut¶
-
stress¶
-
-
pyxtal_ff.descriptors.SO4.U[source]¶ Computes the hyperspherical harmonic function value for given Cayley-Klein parameters and angular momentum numbers. The hyperspherical harmonics are the elements of the Wigner-D matrices.
This function is an interface to the Wigner-D matrix function in angular_momentum.py. The indexing and generation of the Cayley-Klein parameters is handled in the compute_uarray functions, which are handled by the SO4 bispectrum class.
Parameters: - l (integer) –
- integer parameter, corresponds to 2 times the (positive) –
- angular momentum quantum number. (orbital) –
- mp (integer) –
- parameter, corresponds to the magnetic quantum (integer) –
- by the relation m' = mp - l/2 (number) –
- m (integer) –
- parameter, corresponds to the magnetic quantum –
- by the relation m = m - l/2 (number) –
- a (complex) –
- parameter of unit quaternion. Corresponds (Cayley-Klein) –
- the diagonal elements in the corresponding element of (to) –
- in the 2x2 matrix representation. (SU(2)) –
- b (complex) –
- parameter of unit quaternion. Corresponds –
- the off-diagonal elements in the corresponding element of (to) –
- in the 2x2 matrix representation. –
Returns: - complex, element of the Wigner-D matrix, see
- the corresponding function in angular_momentum.py
-
pyxtal_ff.descriptors.SO4.U_wD[source]¶ Computes the hyperspherical harmonic function value for given Cayley-Klein parameters and angular momentum numbers. The hyperspherical harmonics are the elements of the Wigner-D matrices.
This function is an interface to the Wigner-D matrix function in angular_momentum.py. The indexing and generation of the Cayley-Klein parameters is handled in the compute_uarray functions, which are handled by the SO4 bispectrum class.
Parameters: - l (integer) –
- integer parameter, corresponds to 2 times the (positive) –
- angular momentum quantum number. (orbital) –
- mp (integer) –
- parameter, corresponds to the magnetic quantum (integer) –
- by the relation m' = mp - l/2 (number) –
- m (integer) –
- parameter, corresponds to the magnetic quantum –
- by the relation m = m - l/2 (number) –
- Ra (complex) –
- parameter of unit quaternion. Corresponds (Cayley-Klein) –
- the diagonal elements in the corresponding element of (to) –
- in the 2x2 matrix representation. (SU(2)) –
- Rb (complex) –
- parameter of unit quaternion. Corresponds –
- the off-diagonal elements in the corresponding element of (to) –
- in the 2x2 matrix representation. –
Returns: - complex, element of the Wigner-D matrix, see
- the corresponding function in angular_momentum.py
-
pyxtal_ff.descriptors.SO4.add_uarraytot[source]¶ add the hyperspherical harmonic array for one neighbor to the expansion coefficient array
-
pyxtal_ff.descriptors.SO4.addself_uarraytot[source]¶ Add the central atom contribution to the hyperspherical expansion coefficient array.
This initializes the expansion coefficient array with a Kroenocker delta for ma and mb.
Parameters: - twol (integer) – Corresponds to the order of hyperspherical expansion in this software, the degree of expansion is defined and handled within the SO4 bispectrum class.
- idxu_block (1-D integer array) – Each element corresponds to the first element of the expansion coefficient array ->(l,0,0) for each l. This is handled in the SO4_Bispectrum class.
- ulisttot (1-D complex array) – Array for storing hyperspherical expansion coefficients. The sizing and filling of this array is handled in the SO4_Bispectrum class.
Returns: Return type: None
-
pyxtal_ff.descriptors.SO4.compute_bi[source]¶ compute the bispectrum components from the Kronoecker product of the hermitian adjoint of the expansion coefficient array with the Z list (see compute Z_i for description)
-
pyxtal_ff.descriptors.SO4.compute_dsfac[source]¶ Calculates the derivative of the cosine cutoff for a given radii
Parameters: - r (float) – see compute_sfac
- rcut (float) – see compute_sfac
Returns: Return type: dcosine_cutoff/dr float -0.5*pi/rcut*sin(pi*r/rcut)
-
pyxtal_ff.descriptors.SO4.compute_sfac[source]¶ Calculates the cosine cutoff function value given in On Representing Chemical Environments, Batrok, et al.
The cosine cutoff function ensures that the hyperspherical expansion for the calculation of bispectrum coefficients goes smoothly to zero for atomic neighbors tending to the cutoff radius.
Parameters: - r (float) – The magnitude of the separation vector from an atom in the unit cell to a particular neighbor
- rcut (float) – The cutoff radius specified in the SO4_Bispectrum class
Returns: cosine_cutoff
Return type: float 0.5 * (cos(pi*r/rcut) + 1.0)
-
pyxtal_ff.descriptors.SO4.compute_uarray_polynomial[source]¶ Compute the Wigner-D matrix of order twol given an axis (x,y,z) and rotation angle 2*psi.
This function constructs a unit quaternion representating a rotation of 2*psi through an axis defined by x,y,z; then populates an array of Wigner-D matrices of order twol for this rotation. The Wigner-D matrices are calculated using a polynomial form. See angular_momentum.Wigner_D for details.
Parameters: - x (float) –
- x coordinate corresponding to the axis of rotation. (the) –
- y (float) –
- y coordinate corresponding to the axis of rotation. (the) –
- z (float) –
- z coordinate corresponding to the axis of rotation (the) –
- psi (float) –
- half of the rotation angle (one) –
- r (float) –
- of the vector (x,y,z) (magnitude) –
- twol (integer) –
- of hyperspherical expansion (order) –
- ulist (1-D complex array) –
- to populate with D-matrix elements, mathematically (array) –
- is a 3-D matrix, although we broadcast this to a 1-D (this) –
- matrix –
- idxu_block (1-D int array) –
- to index ulist (used) –
Returns: Return type: None
-
pyxtal_ff.descriptors.SO4.compute_uarray_polynomial_wD[source]¶ Compute the Wigner-D matrix of order twol given an axis (x,y,z) and rotation angle 2*psi.
This function constructs a unit quaternion representating a rotation of 2*psi through an axis defined by x,y,z; then populates an array of Wigner-D matrices of order twol for this rotation. The Wigner-D matrices are calculated using a polynomial form. See angular_momentum.Wigner_D for details.
Parameters: - x (float) –
- x coordinate corresponding to the axis of rotation. (the) –
- y (float) –
- y coordinate corresponding to the axis of rotation. (the) –
- z (float) –
- z coordinate corresponding to the axis of rotation (the) –
- psi (float) –
- half of the rotation angle (one) –
- r (float) –
- of the vector (x,y,z) (magnitude) –
- twol (integer) –
- of hyperspherical expansion (order) –
- ulist (1-D complex array) –
- to populate with D-matrix elements, mathematically (array) –
- is a 3-D matrix, although we broadcast this to a 1-D (this) –
- matrix –
- idxu_block (1-D int array) –
- to index ulist (used) –
Returns: Return type: None
-
pyxtal_ff.descriptors.SO4.compute_uarray_recursive[source]¶ Compute the Wigner-D matrix of order twol given an axis (x,y,z) and rotation angle 2*psi. This function constructs a unit quaternion representating a rotation of 2*psi through an axis defined by x,y,z; then populates an array of Wigner-D matrices of order twol for this rotation. The Wigner-D matrices are calculated using the recursion relations in LAMMPS. :param x: :type x: float :param the x coordinate corresponding to the axis of rotation.: :param y: :type y: float :param the y coordinate corresponding to the axis of rotation.: :param z: :type z: float :param the z coordinate corresponding to the axis of rotation: :param psi: :type psi: float :param one half of the rotation angle: :param r: :type r: float :param magnitude of the vector (x,y,z): :param twol: :type twol: integer :param order of hyperspherical expansion: :param ulist: :type ulist: 1-D complex array :param array to populate with D-matrix elements, mathematically: :param this is a 3-D matrix, although we broadcast this to a 1-D: :param matrix: :param idxu_block: :type idxu_block: 1-D int array :param used to index ulist: :param rootpqarray: :type rootpqarray: 2-D float array :param used for recursion relation:
Returns: Return type: None
-
pyxtal_ff.descriptors.SO4.compute_zi[source]¶ Precompute the Kronoecker product of two rotated expansion coefficient tensors using Clebsch-Gordan expansion
-
pyxtal_ff.descriptors.SO4.dudr[source]¶ Compute the total derivative of the hyperspherical expansion coefficients.
-
pyxtal_ff.descriptors.SO4.get_bispectrum_components[source]¶ Calculate the bispectrum components, and their derivatives (if specified) for a given neighbor list. This is the main work function.
-
pyxtal_ff.descriptors.SO4.init_clebsch_gordan[source]¶ Populate an array ofpe Clebsch-Gordan coefficients needed for a bispectrum coefficient calculation
Clebsch-Gordan coefficients arise in the coupling of angular momenta. The method to calculate here is given in “Quantum Theory of Angular Momentum” D.A. Varshalovich. 8.2.1 (3)
Parameters: - twol (integer) – Corresponds to the order of hyperspherical expansion in this software, the degree of expansion is defined and handled within the SO4_Bispectrum class.
- cglist (1-D array for storing the coefficients. The sizing of) – this array is handled in the SO4_Bispectrum class.
Returns: Return type: None