Source code for wavefunction_analysis.property.epr

from wavefunction_analysis import sys, np
from wavefunction_analysis.utils import print_matrix, convert_units

import pyscf

"""
calculate electron paramagnetic resonance (EPR)
from the spin hamiltonian states
"""

[docs] def hamil_zeeman(gensor, magnetic_field, sigma=None): alpha = 0.057884270182028845 # meV / Tesla # alpha = convert_units(alpha, 'mev', 'eh') if sigma is None: sigma = get_spins('xyz') h = alpha* np.einsum('...xij,...xy,y->...ij', sigma, gensor, magnetic_field) return h
[docs] def hamil_nuclear_gyromagnetic(nuc_gyro, magnetic_field, nuc_spin): gamma = 1. h = gamma* np.einsum('n,nx,x->x', nuc_gyro, np.reshape(nuc_spin, (-1, 3)), magnetic_field) return h
[docs] def hamil_hyperfine_coupling(hyperfine, nuc_spin, sigma=None): if sigma is None: sigma = get_spins('xyz') h = np.einsum('...xij,...nxy,ny->...ij', sigma, hyperfine, nuc_spin) return h
[docs] def hamil_spin_spin_coupling(ssc): h = 0. return h
[docs] def hamil_spin(gtensor, magnetic_field, nuc_gyro=None, hyperfine=None, ssc=None, sigma=None): h = hamil_zeeman(gtensor, magnetic_field, sigma) if nuc_gyro is not None: h += hamil_nuclear_gyromagnetic(nuc_gyro, magnetic_field, nuc_spin) if hyperfine is not None: h += hamil_hyperfine_coupling(hyperfine, nuc_spin, sigma) if ssc is not None: h += hamil_spin_spin_coupling(ssc) return h
[docs] def cal_epr(states, magnetic_transition): # EPR spectral intensity return
if __name__ == '__main__': sx = np.zeros((2,2), dtype=np.complex128) sx[0,1] = sx[1,0] = .5 sy = np.zeros((2,2), dtype=np.complex128) sy[0,1] = -.5*1j sy[1,0] = .5*1j sz = np.zeros((2,2), dtype=np.complex128) sz[0,0] = .5 sz[1,1] = -.5 sigma = [sx, sy, sz] gtensor = np.array([ [1.9811826e+00, 3.9050000e-03, 2.2053000e-03], [3.9101000e-03, 1.9891284e+00, -8.8510000e-04], [2.2075000e-03, -8.8690000e-04, 1.9901914e+00], ]) hyperfine = np.array([ [-332.7213, 96.7817, 55.2765], [ 96.7811, -135.1266, -22.5724], [ 55.2775, -22.5724, -108.5793], ]) b_field = 200 # Tesla b_field = np.array([0., 0., b_field]) h = hamil_spin(gtensor, b_field, None, None, hyperfine, sigma=sigma) print_matrix('h:', h)