Solver

Tools for solving the NV center hamiltonian.

Zeeman Hamiltonian

\frac{H}{\hbar} = D_{gs}\left(S_z^2 - \frac{1}{3}S(S+1)\right) + E(S_x^2 - S_y^2) + \gamma_{\text{NV}}\vec{B} \cdot \vec{S}

from nvtools import unit
from nvtools.solver import Solver

solver = Solver()

# calculate absolute field value and angle to NV axis from two resonances
b_abs, theta = self.solver.field_from_resonances(2865 * unit.MHz, 2875 * unit.MHz)

# calculate B-Field vector from eight resonance frequencies
b_field = self.solver.field_vector_from_resonances([<list of eight resonance frequencies>])

Hyperfine Hamiltonian

\frac{H}{\hbar} = D_{gs}S_z^2 + E(S_x^2 - S_y^2) + \gamma_{\text{NV}}\vec{B} \cdot \vec{S} + \vec{S}\cdot\hat{A}\cdot\vec{I} + P I_z^2

from nvtools import unit
from nvtools.solver import Solver

# create a solver for a given nitrogen isotope
solver = Solver("14N")  # or Solver("15N")

# get absolute field value and angle to NV axis from two resonances
b_abs, theta = self.solver.field_from_resonances(2865 * unit.MHz, 2875 * unit.MHz)