Skip to content

Commit

Permalink
Add zero field splitting Hamiltonian
Browse files Browse the repository at this point in the history
  • Loading branch information
vatai committed Nov 23, 2023
1 parent 1aef0ed commit dd4a100
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 17 deletions.
31 changes: 28 additions & 3 deletions examples/sctep.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
#! /usr/bin/env python

from radicalpy.data import Molecule
from radicalpy.data import Isotope, Molecule, Nucleus
from radicalpy.experiments import steady_state_mary
from radicalpy.simulation import Basis, LiouvilleSimulation


def main():
m = Molecule(nuclei=[])
print(m)
gamma = Isotope("E").gamma_mT
D = -6.2 * gamma
E = 35 * gamma
triplet = Nucleus(
magnetogyric_ratio=gamma,
multiplicity=3,
hfc=0.0,
name="Triplet",
)
m = Molecule(radical=triplet)
sim = LiouvilleSimulation(molecules=[m, m], basis=Basis.ZEEMAN)
# print(sim)
steady_state_mary(
sim,
obs_state=State.TP_SINGLET,
B=Bs,
D=D,
E=E,
J=0,
kinetics=[
rp.kinetics.Haberkorn(krec, State.TP_SINGLET),
rp.kinetics.HaberkornFree(kesc),
],
)
print(H)


if __name__ == "__main__":
Expand Down
31 changes: 17 additions & 14 deletions radicalpy/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,22 +571,25 @@ def dipolar_hamiltonian_3d(self, dipolar_tensor: np.ndarray) -> np.ndarray:
)
)

def zero_field_splitting_hamiltonian(self, E, D) -> np.ndarray:
def zero_field_splitting_hamiltonian(self, D, E) -> np.ndarray:
"""Construct the Zero Field Splitting (ZFS) Hamiltoninan."""
for idx in range(self.particles):
spinops = []
coeffs = [E - D / 3, -E - D / 3, 2 * D / 3]
sum(
coeff * np.linalg.matrix_power(self.spin_operator(idx, ax), 2)
for idx, (coeff, ax) in itertools.product(
self.particles, zip(coeffs, "xyz")
)
)
coeffs = [E - D / 3, -E - D / 3, 2 * D / 3]
result = complex(0.0)
other = complex(0.0)
for idx, p in enumerate(self.particles):
tmp = complex(0.0)
for coeff, ax in zip(coeffs, "xyz"):
sqr = self.spin_operator(idx, ax) @ self.spin_operator(idx, ax)
result += coeff * sqr
tmp += coeff * sqr
Sx = self.spin_operator(idx, "x") @ self.spin_operator(idx, "x")
# Sx, Sy, Sz = spinops(pos, 2, spin=3)
# Ssquared = Sx @ Sx + Sy @ Sy + Sz @ Sz
# return D * (Sz @ Sz - (1 / 3) * Ssquared) + E * ((Sx @ Sx) - (Sy @ Sy))
return 0
Sy = self.spin_operator(idx, "y") @ self.spin_operator(idx, "y")
Sz = self.spin_operator(idx, "z") @ self.spin_operator(idx, "z")
Ssquared = Sx @ Sx + Sy @ Sy + Sz @ Sz
other = D * (Sz @ Sz - (1 / 3) * Ssquared) + E * ((Sx @ Sx) - (Sy @ Sy))
delta = np.linalg.norm(other - sqr)
print(f"{delta=}")
return result

def total_hamiltonian(
self,
Expand Down

0 comments on commit dd4a100

Please sign in to comment.