PyOR Quantum
Author: Vineeth Thalakottoor
Introduction to equlibrium density matrix
[1]:
# Define the source path
SourcePath = '/media/HD2/Vineeth/PostDoc_Simulations/Github/PyOR_V1/PyOR_Combined/Source_Doc'
# Add source path
import sys
sys.path.append(SourcePath)
# Import PyOR package
from PyOR_QuantumSystem import QuantumSystem as QunS
from PyOR_Hamiltonian import Hamiltonian
from PyOR_DensityMatrix import DensityMatrix
from PyOR_QuantumObject import QunObj
[2]:
# Define the spin system
Spin_list = {"A" : "H1", "B" : "H1"}
QS = QunS(Spin_list,PrintDefault=False)
# initialize the system
QS.Initialize()
Set parameters
[3]:
# Master Equation
QS.PropagationSpace = "Hilbert"
QS.MasterEquation = "Redfield"
# B0 Field in Tesla, Static Magnetic field (B0) along Z
QS.B0 = 9.4
# Offset Frequency in rotating frame (Hz)
QS.OFFSET["A"] = 10.0
QS.OFFSET["B"] = 50.0
# Define J coupling between Spins
QS.JcoupleValue("A","B",5.0)
# Define initial and final Spin Temperature
QS.I_spintemp["A"] = 300.0
QS.I_spintemp["B"] = 300.0
QS.F_spintemp["A"] = 300.0
QS.F_spintemp["B"] = 300.0
QS.Update()
Rotating frame frequencies: {'A': -2514706800.0, 'B': -2514706800.0}
Offset frequencies: {'A': 10.0, 'B': 50.0}
Initial spin temperatures: {'A': 300.0, 'B': 300.0}
Final spin temperatures: {'A': 300.0, 'B': 300.0}
Radiation damping gain: {'A': 0, 'B': 0}
Radiation damping phase: {'A': 0, 'B': 0}
Rprocess = No Relaxation
RelaxParDipole_tau = 0.0
DipolePairs = []
RelaxParDipole_bIS = []
Generate Hamiltonians
[4]:
# generate Larmor Frequencies
QS.print_Larmor = True
Ham = Hamiltonian(QS)
Larmor Frequency in MHz: [-400.22802765 -400.22806765]
[5]:
DM = DensityMatrix(QS,Ham)
Thermal_DensMatrix = True
if Thermal_DensMatrix:
# High Temperature
HT_approx = False
# Initial Density Matrix
rho_in = DM.EquilibriumDensityMatrix(QS.Ispintemp,HT_approx)
# Equlibrium Density Matrix
rhoeq = DM.EquilibriumDensityMatrix(QS.Fspintemp,HT_approx)
else:
rho_in = QunObj(QS.Az + QS.Bz)
rhoeq = QunObj(QS.Az + QS.Bz)
Trace of density matrix = 1.0
Trace of density matrix = 1.0
[6]:
# Initial Density Matrix
rho_in.matrix
[6]:
$\displaystyle \left[\begin{matrix}0.250016003847122 & 0 & 0 & 0\\0 & 0.25 & 0 & 0\\0 & 0 & 0.25 & 0\\0 & 0 & 0 & 0.249983996152878\end{matrix}\right]$
[7]:
# Final Density Matrix
rhoeq.matrix
[7]:
$\displaystyle \left[\begin{matrix}0.250016003847122 & 0 & 0 & 0\\0 & 0.25 & 0 & 0\\0 & 0 & 0.25 & 0\\0 & 0 & 0 & 0.249983996152878\end{matrix}\right]$
[8]:
DM = DensityMatrix(QS,Ham)
Thermal_DensMatrix = False
if Thermal_DensMatrix:
# High Temperature
HT_approx = False
# Initial Density Matrix
rho_in = DM.EqulibriumDensityMatrix(QS.Ispintemp,HT_approx)
# Equlibrium Density Matrix
rhoeq = DM.EqulibriumDensityMatrix(QS.Fspintemp,HT_approx)
else:
rho_in = QS.Az + QS.Bz
rhoeq = QS.Az + QS.Bz
[9]:
# Initial Density Matrix
rho_in.matrix
[9]:
$\displaystyle \left[\begin{matrix}1.0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & -1.0\end{matrix}\right]$
[10]:
# Final Density Matrix
rhoeq.matrix
[10]:
$\displaystyle \left[\begin{matrix}1.0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & -1.0\end{matrix}\right]$
Individual density matrix
[11]:
QS.Arho.matrix
[11]:
$\displaystyle \left[\begin{matrix}0.500016005441018 & 0\\0 & 0.499983994558982\end{matrix}\right]$
[12]:
QS.Brho.matrix
[12]:
$\displaystyle \left[\begin{matrix}0.500016005442617 & 0\\0 & 0.499983994557383\end{matrix}\right]$
[13]:
rho = QS.Arho.TensorProduct(QS.Brho)
rho.matrix
[13]:
$\displaystyle \left[\begin{matrix}0.250016005697992 & 0 & 0 & 0\\0 & 0.249999999743026 & 0 & 0\\0 & 0 & 0.249999999744626 & 0\\0 & 0 & 0 & 0.249983994814357\end{matrix}\right]$