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

epraya.JHze

Function for the Zeeman interaction.

epraya.JNhze

Function for the nuclear Zeeman interaction.

epraya.JHfi

Function for the hiperfine interaction.

epraya.JQii

Function for the nuclear quadrupolar interaction.

epraya.JIee

Function for the electron-electron interaction.

epraya.JLorbit

Function for the spin orbit interaction.

epraya.JStevensO

Function for the expanded Stevens operators.

Auxiliary functions#

Name

Description

epraya.JKronecker

Function for the Kronecker delta.

epraya.JPauli

Calculates the Pauli matrices for the spin system.

epraya.Jchaframe

Rotates the hamiltonian parameters to the right reference frame using the Euler angles.

epraya.JRotationmat

Creates the rotation matrix for the Lab to sample frame transformation.

epraya.JRotmatrix

Creates the rotation matrix using the Euler angles.

epraya.JConvtarray

Makes sure hamiltonian parameters have the right dimensions.

epraya.JMsmi

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

epraya.JPowder

Wrap function for the simulation of the EPR spectrum for powder samples.

epraya.JCalpowder

Function for the simulation of the EPR spectrum for powder samples using the JAX functions.

epraya.JMulpol

Wrap function for the simulation of the EPR spectrum for powder samples of two systems.

epraya.Jcalmulta

Determinates the spectrum for a two paramagnetic centers system.

epraya.oneori

Wrap function to use JPadaptarray and JNresina with the JAX.vmap implementation.

epraya.JNresina

Determinates the resonant fields and intensities of the spectrum using the expression for the first order perturbation limit.

epraya.JBoltfactor

Calculates the Boltzmann distribution for the intensity, using states di and dj and their related energies.

epraya.JCaltriangle

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.

epraya.Meshtriangle

Creates the baricentral mesh of triangles for the JCaltriangle function.

Line profile functions#

Name

Description

epraya.JLorentzp

Determinates the lorentzian profile of the spectrum.

epraya.JGaussp

Determinates the gaussian profile of the spectrum.

epraya.JVoigtp

Determinates the voigtian profile of the spectrum.

Eigen values and vectors functions#

Name

Description

epraya.JPadaptarray

Constructs the Zeeman hamiltonian, adds it to the complete one and finds the energy values and eigenvectors.

epraya.Hungarian

Solves the assigment problem with the J-V method implemented in Scipy for the eigenvectors and energy values.

epraya.Jungarian

Wrap function to call the Scipy J-V method outside of JAX using ShapeDtypeStruct and pure_callback.

epraya.JPretrack

Organize the eigenvectors and energies to relate them with the quantum numbers of the system.

epraya.containeigh

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

epraya.Jresonant

Wrap function for the simulation of the EPR spectrum for monocrystal samples.

epraya.Calresonant

Function for the calculation of the EPR cw spectrum of monocristal systems.

epraya.JMusic

Wrap function for the simulation of the EPR spectrum for monocristal samples of two systems.

epraya.Jcalmusic

Determinates the spectrum for a two paramagnetic centers monocristal system..