Jax implementation#
Here are the JAX function for the simualtion and fitting of EPR cw data.
All functions follow a similar approach to that of its counterparts for the Classic method described in the other sections, but adapted to make use of the JAX advantages, without requiring a large amount of RAM.
Hamiltonian’s functions#
All interactions present in the EPR hamiltonian are described with jax.numpy matricial functions. Here are their definitions and the auxiliary functions for their construction.
Interaction’s functions#
Name |
Description |
|---|---|
Function for the Zeeman interaction. |
|
Function for the nuclear Zeeman interaction. |
|
Function for the hiperfine interaction. |
|
Function for the nuclear quadrupolar interaction. |
|
Function for the electron-electron interaction. |
|
Function for the spin orbit interaction. |
|
Function for the expanded Stevens operators. |
Auxiliary functions#
Name |
Description |
|---|---|
Function for the Kronecker delta. |
|
Calculates the Pauli matrices for the spin system. |
|
Rotates the hamiltonian parameters to the right reference frame using the Euler angles. |
|
Creates the rotation matrix for the Lab to sample frame transformation. |
|
Creates the rotation matrix using the Euler angles. |
|
Makes sure hamiltonian parameters have the right dimensions. |
|
Determinates the quantum numbers for the spin, nuclear spin and angular momentum. |
Powder samples#
Like its classic counterpart, the process is based in the modificated SOPHE method (using the function epraya.Delaunay), however, the calculation is divided in blocks to keep the processing speed.
Note: By the nature of the JAX framework, the reassigment of values to variables and conditionals evaluations must be performed using JAX functions, which requires modifying the program logic, but the results are equivalent to those of the classic one.
Intensity and resonant fields functions#
Name |
Description |
|---|---|
Wrap function for the simulation of the EPR spectrum for powder samples. |
|
Function for the simulation of the EPR spectrum for powder samples using the JAX functions. |
|
Wrap function for the simulation of the EPR spectrum for powder samples of two systems. |
|
Determinates the spectrum for a two paramagnetic centers system. |
|
Wrap function to use JPadaptarray and JNresina with the JAX.vmap implementation. |
|
Determinates the resonant fields and intensities of the spectrum using the expression for the first order perturbation limit. |
|
Calculates the Boltzmann distribution for the intensity, using states di and dj and their related energies. |
|
Creates a sketch spectrum using a barycentral mesh of triangles to calculate the contribution of the resonant fields and their intensities in the final spectrum. |
|
Creates the baricentral mesh of triangles for the JCaltriangle function. |
Line profile functions#
Name |
Description |
|---|---|
Determinates the lorentzian profile of the spectrum. |
|
Determinates the gaussian profile of the spectrum. |
|
Determinates the voigtian profile of the spectrum. |
Eigen values and vectors functions#
Name |
Description |
|---|---|
Constructs the Zeeman hamiltonian, adds it to the complete one and finds the energy values and eigenvectors. |
|
Solves the assigment problem with the J-V method implemented in Scipy for the eigenvectors and energy values. |
|
Wrap function to call the Scipy J-V method outside of JAX using ShapeDtypeStruct and pure_callback. |
|
Organize the eigenvectors and energies to relate them with the quantum numbers of the system. |
|
Wrap function for the eignevalues determination using JAX. |
Monocristal samples#
Like its classic counterpart, the process includes the functions for monocristal samples simulation (one fixed orientation), with the implementation of the Stoll Easyspin method for the resonant fields determination. Also includes the energy diagrams generator function.
Intensity and resonant fields functions#
Name |
Description |
|---|---|
Wrap function for the simulation of the EPR spectrum for monocrystal samples. |
|
Function for the calculation of the EPR cw spectrum of monocristal systems. |
|
Wrap function for the simulation of the EPR spectrum for monocristal samples of two systems. |
|
Determinates the spectrum for a two paramagnetic centers monocristal system.. |