{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# PyOR Quantum\n", "## Author: Vineeth Thalakottoor\n", "## Introduction to CSA Hamiltonians" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Define the source path\n", "SourcePath = '/media/HD2/Vineeth/PostDoc_Simulations/Github/PyOR_V1/PyOR_Combined/Source_Doc'\n", "\n", "# Add source path\n", "import sys\n", "sys.path.append(SourcePath)\n", "\n", "import numpy as np\n", "# Import PyOR package\n", "from PyOR_QuantumSystem import QuantumSystem as QunS\n", "from PyOR_Hamiltonian import Hamiltonian\n", "from PyOR_QuantumLibrary import QuantumLibrary\n", "import PyOR_SphericalTensors as ST\n", "import PyOR_Rotation as Rot\n", "QLib = QuantumLibrary()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Define the spin system\n", "Spin_list = {\"A\" : \"H1\"}\n", "QS = QunS(Spin_list,PrintDefault=False)\n", "\n", "# initialize the system\n", "QS.Initialize()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Set parameters" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rotating frame frequencies: {'A': -628541601.39}\n", "Offset frequencies: {'A': 0.0}\n", "Initial spin temperatures: {'A': 300.0}\n", "Final spin temperatures: {'A': 300.0}\n", "Radiation damping gain: {'A': 0}\n", "Radiation damping phase: {'A': 0}\n", "\n", "Rprocess = Phenomenological\n", "RelaxParDipole_tau = 0.0\n", "DipolePairs = []\n", "RelaxParDipole_bIS = []\n" ] } ], "source": [ "# Master Equation\n", "QS.PropagationSpace = \"Hilbert\"\n", "QS.MasterEquation = \"Redfield\"\n", "\n", "# B0 Field in Tesla, Static Magnetic field (B0) along Z\n", "QS.B0 = QS.L100\n", "\n", "# Offset Frequency in rotating frame (Hz)\n", "QS.OFFSET[\"A\"] = 0.0\n", "\n", "\n", "# Define initial and final Spin Temperature\n", "QS.I_spintemp[\"A\"] = 300.0\n", "QS.F_spintemp[\"A\"] = 300.0\n", "\n", "# Relaxation Process\n", "QS.Rprocess = \"Phenomenological\"\n", "QS.R1 = 1\n", "QS.R2 = 2\n", "\n", "QS.Update()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Zeeman Hamiltonians" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Larmor Frequency in MHz: [-100.0355028]\n" ] } ], "source": [ "# generate Larmor Frequencies\n", "QS.print_Larmor = True\n", "Ham = Hamiltonian(QS)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-50017753.8359235 & 0\\\\0 & 50017753.8359235\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-50017753.8359235, 0],\n", "[ 0, 50017753.8359235]])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Lab Frame Hamiltonian\n", "Hz_lab = Ham.Zeeman()\n", "Hz_lab.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0\\\\0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, 0],\n", "[0, 0]])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Rotating Frame Hamiltonian\n", "Hz = Ham.Zeeman_RotFrame()\n", "Hz.Inverse2PI().matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA tensor PAF" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}15.0 & 0 & 0\\\\0 & 5.0 & 0\\\\0 & 0 & -5.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[15.0, 0, 0],\n", "[ 0, 5.0, 0],\n", "[ 0, 0, -5.0]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "delta_iso = 5.0 # Hz\n", "delta_aniso = -10.0 # Hz\n", "\n", "IT_PAF = Ham.InteractionTensor_PAF_CSA(Iso=delta_iso,Aniso=delta_aniso,Asymmetry=1.0)\n", "IT_PAF.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'Isotropic': 4.999999999999999,\n", " 'Anisotropy': -10.0,\n", " 'Asymmetry': 0.9999999999999999}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "PAF_Decom = Ham.InteractionTensor_PAF_Decomposition(IT_PAF)\n", "PAF_Decom" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA tensor LAB" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}41.05 & 3.507 & -58.146\\\\3.507 & 32.692 & -21.163\\\\-58.146 & -21.163 & 20.505\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 41.05, 3.507, -58.146],\n", "[ 3.507, 32.692, -21.163],\n", "[-58.146, -21.163, 20.505]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "phi,theta = 20.0,40.0\n", "\n", "IT_LAB = Ham.InteractionTensor_LAB(IT_PAF,phi,theta,0)\n", "IT_LAB.Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}31.4159265358979 & 0 & 0\\\\0 & 31.4159265358979 & 0\\\\0 & 0 & 31.4159265358979\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[31.4159265358979, 0, 0],\n", "[ 0, 31.4159265358979, 0],\n", "[ 0, 0, 31.4159265358979]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom = Ham.InteractionTensor_LAB_Decomposition(IT_LAB)\n", "LAB_Decom['Isotropic'].matrix" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}6.533 & 0.558 & -9.254\\\\0.558 & 5.203 & -3.368\\\\-9.254 & -3.368 & 3.264\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 6.533, 0.558, -9.254],\n", "[ 0.558, 5.203, -3.368],\n", "[-9.254, -3.368, 3.264]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom[\"Symmetric\"].Inverse2PI().Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0\\\\0 & 0 & 0\\\\0 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, 0, 0],\n", "[0, 0, 0],\n", "[0, 0, 0]])" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom[\"Antisymmetric\"].Inverse2PI().Round(3).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA Hamiltonian in Lab frame (Secular)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & 0\\\\0 & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.39, 0],\n", "[ 0, -1.39]])" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A = \"A\"\n", "B = \"\"\n", "\n", "Hcsa_LAB_Truncates = Ham.Interaction_Hamiltonian_LAB_CSA_Secular(A,IT_PAF,theta,phi)\n", "Hcsa_LAB_Truncates.Inverse2PI().Round(3).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA Hamiltonian in Lab frame (Cartesian, Euler rotation)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & -4.636 + 1.033 i\\\\-4.636 - 1.033 i & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 1.39, -4.636 + 1.033*I],\n", "[-4.636 - 1.033*I, -1.39]])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hcsa_LAB_Euler = Ham.Interaction_Hamiltonian_Catesian_Euler(A,IT_PAF,B,0,theta,phi)\n", "Hcsa_LAB_Euler.Inverse2PI().Round(3).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA Hamiltonian in Lab frame (Cartesian, Wigner rotation)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & -4.636 + 1.033 i\\\\-4.636 - 1.033 i & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 1.39, -4.636 + 1.033*I],\n", "[-4.636 - 1.033*I, -1.39]])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hcsa_LAB_Wig = Ham.Interaction_Hamiltonian_Catesian_Wigner(A,IT_PAF,B,0,theta,phi)\n", "Hcsa_LAB_Wig.Inverse2PI().Round(3).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### CSA Hamiltonian in Lab frame (Spherical Tensors, Wigner Rotation)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & -4.636 - 1.033 i\\\\-4.636 + 1.033 i & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 1.39, -4.636 - 1.033*I],\n", "[-4.636 + 1.033*I, -1.39]])" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hcsa_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-field\",\"all\", 0,theta,phi)\n", "Hcsa_LAB_ST.Inverse2PI().Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & 0\\\\0 & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.39, 0],\n", "[ 0, -1.39]])" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hcsa_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-field\",\"secular\", 0,theta,phi)\n", "Hcsa_LAB_ST.Inverse2PI().Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.39 & 0\\\\0 & -1.39\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.39, 0],\n", "[ 0, -1.39]])" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hcsa_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-field\",\"secular + pseudosecular\", 0,theta,phi)\n", "Hcsa_LAB_ST.Inverse2PI().Round(3).matrix" ] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.7" } }, "nbformat": 4, "nbformat_minor": 4 }