{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# PyOR Quantum\n", "## Author: Vineeth Thalakottoor\n", "## Introduction to Hamiltonians (Zeeman, B1, J coupling and Dipolar coupling)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Define the source path\n", "SourcePath = '/media/HD2/Vineeth/PostDoc_Simulations/Github/PyOR_V1/PyOR_Combined/PyOR/Source_Doc'\n", "\n", "# Add source path\n", "import sys\n", "sys.path.append(SourcePath)\n", "\n", "# Import PyOR package\n", "from PyOR_QuantumSystem import QuantumSystem as QunS\n", "from PyOR_Hamiltonian import Hamiltonian" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Define the spin system\n", "Spin_list = {\"A\" : \"H1\", \"B\" : \"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": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rotating frame frequencies: {'A': -2514706800.0, 'B': -2514706800.0}\n", "Offset frequencies: {'A': 10.0, 'B': 50.0}\n", "Initial spin temperatures: {'A': 300.0, 'B': 300.0}\n", "Final spin temperatures: {'A': 300.0, 'B': 300.0}\n", "Radiation damping gain: {'A': 0, 'B': 0}\n", "Radiation damping phase: {'A': 0, 'B': 0}\n", "\n", "Rprocess = Phenomenological\n", "RelaxParDipole_tau = 0.0\n", "DipolePairs = [('A', 'B')]\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 = 9.4\n", "\n", "# Offset Frequency in rotating frame (Hz)\n", "QS.OFFSET[\"A\"] = 10.0\n", "QS.OFFSET[\"B\"] = 50.0\n", "\n", "# Define J coupling between Spins \n", "QS.JcoupleValue(\"A\",\"B\",5.0)\n", "\n", "# Define paris of spins coupled by dipolar interaction\n", "QS.DipoleAngle = [(45,45)]\n", "QS.Dipole_Pairs = [(\"A\",\"B\")]\n", "QS.Dipole_DipolarAlpabet = [\"All\"]\n", "QS.DipolebIS = [25.0e3]\n", "\n", "# Define initial and final Spin Temperature\n", "QS.I_spintemp[\"A\"] = 300.0\n", "QS.I_spintemp[\"B\"] = 300.0\n", "QS.F_spintemp[\"A\"] = 300.0\n", "QS.F_spintemp[\"B\"] = 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": [ "### Generate Hamiltonians" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Larmor Frequency in MHz: [-400.22802765 -400.22806765]\n" ] } ], "source": [ "# generate Larmor Frequencies\n", "QS.print_Larmor = True\n", "Ham = Hamiltonian(QS)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-400228040.565114 & 0 & 0 & 0\\\\0 & 20.3718327157626 & 0 & 0\\\\0 & 0 & -20.3718327157626 & 0\\\\0 & 0 & 0 & 400228040.565114\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-400228040.565114, 0, 0, 0],\n", "[ 0, 20.3718327157626, 0, 0],\n", "[ 0, 0, -20.3718327157626, 0],\n", "[ 0, 0, 0, 400228040.565114]])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Lab Frame Hamiltonian\n", "Hz_lab = Ham.Zeeman()\n", "Hz_lab.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-30.0000000759161 & 0 & 0 & 0\\\\0 & 20.0000008601147 & 0 & 0\\\\0 & 0 & -20.0000008601147 & 0\\\\0 & 0 & 0 & 30.0000000759161\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-30.0000000759161, 0, 0, 0],\n", "[ 0, 20.0000008601147, 0, 0],\n", "[ 0, 0, -20.0000008601147, 0],\n", "[ 0, 0, 0, 30.0000000759161]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Rotating Frame Hamiltonian\n", "Hz = Ham.Zeeman_RotFrame()\n", "Hz.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0.500000013913768 & 0.500000013913768 & 0\\\\0.500000013913768 & 0 & 0 & 0.500000013913768\\\\0.500000013913768 & 0 & 0 & 0.500000013913768\\\\0 & 0.500000013913768 & 0.500000013913768 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0.500000013913768, 0.500000013913768, 0],\n", "[0.500000013913768, 0, 0, 0.500000013913768],\n", "[0.500000013913768, 0, 0, 0.500000013913768],\n", "[ 0, 0.500000013913768, 0.500000013913768, 0]])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# B1 Hamiltonian\n", "Omega1 = 1.0\n", "Omega1Phase = 0.0\n", "HB1 = Ham.Zeeman_B1(Omega1,Omega1Phase)\n", "HB1.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.24999997786618 & 0 & 0 & 0\\\\0 & -1.24999997786618 & 2.49999995573235 & 0\\\\0 & 2.49999995573235 & -1.24999997786618 & 0\\\\0 & 0 & 0 & 1.24999997786618\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.24999997786618, 0, 0, 0],\n", "[ 0, -1.24999997786618, 2.49999995573235, 0],\n", "[ 0, 2.49999995573235, -1.24999997786618, 0],\n", "[ 0, 0, 0, 1.24999997786618]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# J coupling Hamiltonian\n", "Hj = Ham.Jcoupling()\n", "Hj.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1.24999997786618 & 0 & 0 & 0\\\\0 & -1.24999997786618 & 0 & 0\\\\0 & 0 & -1.24999997786618 & 0\\\\0 & 0 & 0 & 1.24999997786618\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[1.24999997786618, 0, 0, 0],\n", "[ 0, -1.24999997786618, 0, 0],\n", "[ 0, 0, -1.24999997786618, 0],\n", "[ 0, 0, 0, 1.24999997786618]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Weak J coupling Hamiltonian\n", "Hj_week = Ham.Jcoupling_Weak()\n", "Hj_week.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3124.99984722141 & -6629.1254198576 + 6629.1254198576 i & -6629.1254198576 + 6629.1254198576 i & 9374.99954166422 i\\\\-6629.1254198576 - 6629.1254198576 i & 3124.99984722141 & 3124.99984722141 & 6629.1254198576 - 6629.1254198576 i\\\\-6629.1254198576 - 6629.1254198576 i & 3124.99984722141 & 3124.99984722141 & 6629.1254198576 - 6629.1254198576 i\\\\- 9374.99954166422 i & 6629.1254198576 + 6629.1254198576 i & 6629.1254198576 + 6629.1254198576 i & -3124.99984722141\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -3124.99984722141, -6629.1254198576 + 6629.1254198576*I, -6629.1254198576 + 6629.1254198576*I, 9374.99954166422*I],\n", "[-6629.1254198576 - 6629.1254198576*I, 3124.99984722141, 3124.99984722141, 6629.1254198576 - 6629.1254198576*I],\n", "[-6629.1254198576 - 6629.1254198576*I, 3124.99984722141, 3124.99984722141, 6629.1254198576 - 6629.1254198576*I],\n", "[ -9374.99954166422*I, 6629.1254198576 + 6629.1254198576*I, 6629.1254198576 + 6629.1254198576*I, -3124.99984722141]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Dipole coupling Hamiltonian\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().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" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }