PyOR Quantum

Author: Vineeth Thalakottoor

Introduction to Partial Trace

[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 time
%matplotlib ipympl

# 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
from PyOR_HardPulse import HardPulse
from PyOR_Basis import Basis
from PyOR_Evolution import Evolutions
from PyOR_Plotting import Plotting
import PyOR_SignalProcessing as Spro
from PyOR_QuantumLibrary import QuantumLibrary
[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 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 = []

Genrate individual Density Matrix

[4]:
QS.Arho.matrix
[4]:
$\displaystyle \left[\begin{matrix}0.500016005441018 & 0\\0 & 0.499983994558982\end{matrix}\right]$
[5]:
QS.Brho.matrix
[5]:
$\displaystyle \left[\begin{matrix}0.500016005442617 & 0\\0 & 0.499983994557383\end{matrix}\right]$
[6]:
rho = QS.Arho.TensorProduct(QS.Brho)
[7]:
rho.matrix
[7]:
$\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]$

Partial Trace

[8]:
QLib = QuantumLibrary(QS)
[9]:
rho_A = QLib.PartialTrace(rho, [0])
rho_B = QLib.PartialTrace(rho, [1], [2,2])
[10]:
rho_A.matrix
[10]:
$\displaystyle \left[\begin{matrix}0.500016005441018 & 0\\0 & 0.499983994558982\end{matrix}\right]$
[11]:
rho_B.matrix
[11]:
$\displaystyle \left[\begin{matrix}0.500016005442617 & 0\\0 & 0.499983994557383\end{matrix}\right]$