Skip to content
# sympt imports
from sympt import *
# import sympy
import sympy as sp

Setup

# ---------------- Defining the symbols ------------------
# Order 0
omega = RDSymbol('omega', positive=True, real=True)
omega_z = RDSymbol('omega_z', positive=True, real=True)
omega_d = RDSymbol('omega_d', positive=True, real=True)

# Order 1
bsl = RDSymbol('\\tilde{b}_{SL}', order=1, positive=True, real=True)
E0 = RDSymbol('\\tilde{E}_{0}', order=1, positive=True, real=True)

# ----------------- Defining the basis -------------------
# Spin basis: Finite 2x2 Hilbert space
Spin = RDBasis('sigma', dim=2)
s0, sx, sy, sz = Spin.basis

# Boson basis: Infinite bosonic Hilbert space
a = BosonOp('a')
ad = Dagger(a)


# -------------- Defining the Hamiltonian ----------------
# Unperturbed Hamiltonian H0
H0 = hbar * omega * ad*a - hbar/2 * omega_z * sz

# Perturbation Hamiltonians
V = -sp.Rational(1,2) * hbar * bsl * (ad + a) * sx
Hd = -E0 * sp.cos(omega_d * t) * (ad + a)

display_dict({
    sp.Symbol('H_0'): H0,
    sp.Symbol('V'):   V,
    sp.Symbol('H_d'): Hd
})

\(\displaystyle H_{0} : \hbar \omega {a^\dagger} a - \frac{\hbar \omega_{z} \sigma_{3}}{2}\)

\(\displaystyle V : - \frac{\tilde{b}_{SL} \hbar \left({a^\dagger} + a\right) \sigma_{1}}{2}\)

\(\displaystyle H_{d} : - \tilde{E}_{0} \cos{\left(\omega_{d} t \right)} \left({a^\dagger} + a\right)\)

Time Independent SWT

# Deffining Effective Hamiltonian Object
Eff_frame = EffectiveFrame(H0, V, subspaces=[Spin])
The EffectiveFrame object has been initialized successfully.
# Calculate the effective model using the Schrieffer-Wolff transformation up to the second order
Eff_frame.solve(max_order=2, method="SW", mask=None)
# Obtaining the result in the operator form
H_eff_SWT = Eff_frame.get_H(return_form='operator')
H_eff_SWT
Computing the effective Hamiltonian: 100%|██████████| 2/2 [00:00<00:00, 10.43it/s]
The Hamiltonian has been solved successfully. Please use the get_H method to get the result in the desired form.
Converting to operator form: 100%|██████████| 2/2 [00:00<00:00, 37.09it/s]
\[\displaystyle - \frac{\tilde{b}_{SL}^{2} \hbar \omega}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} {a^\dagger}^{2}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} a^{2}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} {a^\dagger} a}{2 \omega^{2} - 2 \omega_{z}^{2}} + \hbar \omega {a^\dagger} a - \frac{\hbar \omega_{z} \sigma_{3}}{2}\]
# display second order corrections in dictionary form
Eff_frame.corrections[2]

\(\displaystyle - \frac{\tilde{b}_{SL}^{2} \hbar \omega}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} {a^\dagger}^{2}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} a^{2}}{4 \omega^{2} - 4 \omega_{z}^{2}} + \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z} \sigma_{3} {a^\dagger} a}{2 \omega^{2} - 2 \omega_{z}^{2}}\)

# Rotating drive hamiltonian into new frame
H_drive = Eff_frame.rotate(Hd, max_order=2, return_form='operator')
H_drive.cancel()
Rotating the expression: 100%|██████████| 2/2 [00:00<00:00, 297.06it/s]
Converting to operator form: 100%|██████████| 3/3 [00:00<00:00, 175.88it/s]

\(\displaystyle - \tilde{E}_{0} \cos{\left(\omega_{d} t \right)} \left(\frac{\tilde{b}_{SL} \omega \sigma_{1}}{\omega^{2} - \omega_{z}^{2}} + {a^\dagger} + a\right)\)

Time Dependent SWT

# Deffining Effective Hamiltonian Object
Eff_frame = EffectiveFrame(H0, V + Hd, subspaces=[Spin])
The EffectiveFrame object has been initialized successfully.
# Calculate the effective model using the Schrieffer-Wolff transformation up to the second order
Eff_frame.solve(max_order=2, method='SW')
# Obtaining the result in the operator form
H_eff_SWT = Eff_frame.get_H(return_form='operator')
Computing the effective Hamiltonian: 100%|██████████| 2/2 [00:00<00:00,  8.27it/s]
The Hamiltonian has been solved successfully. Please use the get_H method to get the result in the desired form.
Converting to operator form: 100%|██████████| 2/2 [00:00<00:00,  5.81it/s]
# Get second order corrections
H2_eff = Eff_frame.corrections[2]
display_dict({k:sp.expand_complex(v.cancel().factor()).trigsimp() for k,v in group_by_operators(H2_eff).items()})

\(\displaystyle 1 : - \frac{\omega \left(4 \tilde{E}_{0}^{2} \omega^{2} \cos^{2}{\left(\omega_{d} t \right)} - 4 \tilde{E}_{0}^{2} \omega_{z}^{2} \cos^{2}{\left(\omega_{d} t \right)} + \tilde{b}_{SL}^{2} \hbar^{2} \omega^{2} - \tilde{b}_{SL}^{2} \hbar^{2} \omega_{d}^{2}\right)}{4 \hbar \left(\omega - \omega_{d}\right) \left(\omega + \omega_{d}\right) \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)

\(\displaystyle \sigma_{1} : - \frac{\tilde{E}_{0} \tilde{b}_{SL} \omega \left(2 \omega^{2} - \omega_{d}^{2} - \omega_{z}^{2}\right) \cos{\left(\omega_{d} t \right)}}{2 \left(\omega - \omega_{d}\right) \left(\omega + \omega_{d}\right) \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)

\(\displaystyle \sigma_{3} : \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z}}{4 \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)

\(\displaystyle \sigma_{3} {a^\dagger}^{2} : \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z}}{4 \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)

\(\displaystyle \sigma_{3} a^{2} : \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z}}{4 \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)

\(\displaystyle \sigma_{3} {a^\dagger} a : \frac{\tilde{b}_{SL}^{2} \hbar \omega_{z}}{2 \left(\omega - \omega_{z}\right) \left(\omega + \omega_{z}\right)}\)


License

SymPT is licensed under the MIT License. See the LICENSE file for details.


Citation

If you use SymPT in your research, please cite the following paper:

BibTeX Entry:

@misc{diotallevi2024symptcomprehensivetoolautomating,
      title={SymPT: a comprehensive tool for automating effective Hamiltonian derivations}, 
      author={Giovanni Francesco Diotallevi and Leander Reascos and Mónica Benito},
      year={2024},
      eprint={2412.10240},
      archivePrefix={arXiv},
      primaryClass={quant-ph},
      url={https://arxiv.org/abs/2412.10240}, 
}

APA Citation:

Diotallevi, G. F., Reascos, L., & Benito, M. (2024). SymPT: a comprehensive tool for automating effective Hamiltonian derivations. arXiv preprint arXiv:2412.10240.

IEEE Citation:

G. F. Diotallevi, L. Reascos, and M. Benito, "SymPT: a comprehensive tool for automating effective Hamiltonian derivations," arXiv preprint arXiv:2412.10240, 2024.


References