{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# PyOR Quantum\n", "## Author: Vineeth Thalakottoor\n", "## Introduction to Dipolar 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 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\", \"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": 3, "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 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": [ "### Zeeman Hamiltonians" ] }, { "cell_type": "code", "execution_count": 4, "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": 5, "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": 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}-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": 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": [ "### Dipolar Hamiltonian with Dipolar alphabets" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}3125.0 & 0 & 0 & 0\\\\0 & -3125.0 & 3125.0 & 0\\\\0 & 3125.0 & -3125.0 & 0\\\\0 & 0 & 0 & 3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[3125.0, 0, 0, 0],\n", "[ 0, -3125.0, 3125.0, 0],\n", "[ 0, 3125.0, -3125.0, 0],\n", "[ 0, 0, 0, 3125.0]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"secular Homonuclear\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & 0 & 0 & 0\\\\0 & 3125.0 & 0 & 0\\\\0 & 0 & 3125.0 & 0\\\\0 & 0 & 0 & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-3125.0, 0, 0, 0],\n", "[ 0, 3125.0, 0, 0],\n", "[ 0, 0, 3125.0, 0],\n", "[ 0, 0, 0, -3125.0]])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"secular Hetronuclear\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & 0 & 0 & 0\\\\0 & 3125.0 & 0 & 0\\\\0 & 0 & 3125.0 & 0\\\\0 & 0 & 0 & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-3125.0, 0, 0, 0],\n", "[ 0, 3125.0, 0, 0],\n", "[ 0, 0, 3125.0, 0],\n", "[ 0, 0, 0, -3125.0]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"A\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 3125.0 & 0\\\\0 & 3125.0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, 0, 0, 0],\n", "[0, 0, 3125.0, 0],\n", "[0, 3125.0, 0, 0],\n", "[0, 0, 0, 0]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"B\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & -6629.0 + 6629.0 i & -6629.0 + 6629.0 i & 0\\\\0 & 0 & 0 & 6629.0 - 6629.0 i\\\\0 & 0 & 0 & 6629.0 - 6629.0 i\\\\0 & 0 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, -6629.0 + 6629.0*I, -6629.0 + 6629.0*I, 0],\n", "[0, 0, 0, 6629.0 - 6629.0*I],\n", "[0, 0, 0, 6629.0 - 6629.0*I],\n", "[0, 0, 0, 0]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"C\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\-6629.0 - 6629.0 i & 0 & 0 & 0\\\\-6629.0 - 6629.0 i & 0 & 0 & 0\\\\0 & 6629.0 + 6629.0 i & 6629.0 + 6629.0 i & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, 0, 0],\n", "[-6629.0 - 6629.0*I, 0, 0, 0],\n", "[-6629.0 - 6629.0*I, 0, 0, 0],\n", "[ 0, 6629.0 + 6629.0*I, 6629.0 + 6629.0*I, 0]])" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"D\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 9375.0 i\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0, 0, 0, 9375.0*I],\n", "[0, 0, 0, 0],\n", "[0, 0, 0, 0],\n", "[0, 0, 0, 0]])" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"E\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\- 9375.0 i & 0 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, 0, 0],\n", "[ 0, 0, 0, 0],\n", "[ 0, 0, 0, 0],\n", "[-9375.0*I, 0, 0, 0]])" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"F\"]\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & -6629.0 + 6629.0 i & -6629.0 + 6629.0 i & 9375.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\- 9375.0 i & 6629.0 + 6629.0 i & 6629.0 + 6629.0 i & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -3125.0, -6629.0 + 6629.0*I, -6629.0 + 6629.0*I, 9375.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[ -9375.0*I, 6629.0 + 6629.0*I, 6629.0 + 6629.0*I, -3125.0]])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "QS.Dipole_DipolarAlpabet = [\"All\"]\n", "\n", "theta = 45\n", "phi = 45\n", "QS.DipoleAngle = [(theta,phi)]\n", "\n", "Hd = Ham.DDcoupling()\n", "Hd.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hd.Hermitian()" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Dipole tensor PAF" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}25000.0 & 0 & 0\\\\0 & 25000.0 & 0\\\\0 & 0 & -50000.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[25000.0, 0, 0],\n", "[ 0, 25000.0, 0],\n", "[ 0, 0, -50000.0]])" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IT_PAF = Ham.InteractionTensor_PAF_Dipole(25.0e3)\n", "IT_PAF.Inverse2PI().matrix" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'Isotropic': 0.0, 'Anisotropy': -50000.0, 'Asymmetry': -0.0}" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "PAF_Decom = Ham.InteractionTensor_PAF_Decomposition(IT_PAF)\n", "PAF_Decom" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Dipole tensor LAB" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}6250.0 & -18750.0 & -26517.0\\\\-18750.0 & 6250.0 & -26517.0\\\\-26517.0 & -26517.0 & -12500.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 6250.0, -18750.0, -26517.0],\n", "[-18750.0, 6250.0, -26517.0],\n", "[-26517.0, -26517.0, -12500.0]])" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IT_LAB = Ham.InteractionTensor_LAB(IT_PAF,phi,theta,0)\n", "IT_LAB.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 20, "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": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom = Ham.InteractionTensor_LAB_Decomposition(IT_LAB)\n", "LAB_Decom['Isotropic'].matrix" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}6250.0 & -18750.0 & -26517.0\\\\-18750.0 & 6250.0 & -26517.0\\\\-26517.0 & -26517.0 & -12500.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 6250.0, -18750.0, -26517.0],\n", "[-18750.0, 6250.0, -26517.0],\n", "[-26517.0, -26517.0, -12500.0]])" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom[\"Symmetric\"].Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 22, "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": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LAB_Decom[\"Antisymmetric\"].Inverse2PI().Round(0).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Dipolar Hamiltonian in Lab frame (Cartesian, Euler rotation)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & -6629.0 + 6629.0 i & -6629.0 + 6629.0 i & 9375.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\- 9375.0 i & 6629.0 + 6629.0 i & 6629.0 + 6629.0 i & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -3125.0, -6629.0 + 6629.0*I, -6629.0 + 6629.0*I, 9375.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[ -9375.0*I, 6629.0 + 6629.0*I, 6629.0 + 6629.0*I, -3125.0]])" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "A = \"A\"\n", "B = \"B\"\n", "Hdd_LAB_Euler = Ham.Interaction_Hamiltonian_Catesian_Wigner(A,IT_PAF,B,phi,theta,0)\n", "Hdd_LAB_Euler.Inverse2PI().Round(0).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Dipolar Hamiltonian in Lab frame (Cartesian, Wigner rotation)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & -6629.0 + 6629.0 i & -6629.0 + 6629.0 i & 9375.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\- 9375.0 i & 6629.0 + 6629.0 i & 6629.0 + 6629.0 i & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -3125.0, -6629.0 + 6629.0*I, -6629.0 + 6629.0*I, 9375.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[ -9375.0*I, 6629.0 + 6629.0*I, 6629.0 + 6629.0*I, -3125.0]])" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hdd_LAB_Wig = Ham.Interaction_Hamiltonian_Catesian_Wigner(A,IT_PAF,B,phi,theta,0)\n", "Hdd_LAB_Wig.Inverse2PI().Round(0).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Dipolar Hamiltonian in Lab frame (Spherical Tensors, Wigner Rotation)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & -6629.0 + 6629.0 i & -6629.0 + 6629.0 i & 9375.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\-6629.0 - 6629.0 i & 3125.0 & 3125.0 & 6629.0 - 6629.0 i\\\\- 9375.0 i & 6629.0 + 6629.0 i & 6629.0 + 6629.0 i & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -3125.0, -6629.0 + 6629.0*I, -6629.0 + 6629.0*I, 9375.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[-6629.0 - 6629.0*I, 3125.0, 3125.0, 6629.0 - 6629.0*I],\n", "[ -9375.0*I, 6629.0 + 6629.0*I, 6629.0 + 6629.0*I, -3125.0]])" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hdd_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-spin\",\"all\", phi,theta,0)\n", "Hdd_LAB_ST.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & 0 & 0 & 0\\\\0 & 3125.0 & 0 & 0\\\\0 & 0 & 3125.0 & 0\\\\0 & 0 & 0 & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-3125.0, 0, 0, 0],\n", "[ 0, 3125.0, 0, 0],\n", "[ 0, 0, 3125.0, 0],\n", "[ 0, 0, 0, -3125.0]])" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hdd_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-spin\",\"secular\", phi,theta,0)\n", "Hdd_LAB_ST.Inverse2PI().Round(0).matrix" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-3125.0 & 0 & 0 & 0\\\\0 & 3125.0 & 3125.0 & 0\\\\0 & 3125.0 & 3125.0 & 0\\\\0 & 0 & 0 & -3125.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[-3125.0, 0, 0, 0],\n", "[ 0, 3125.0, 3125.0, 0],\n", "[ 0, 3125.0, 3125.0, 0],\n", "[ 0, 0, 0, -3125.0]])" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Hdd_LAB_ST = Ham.Interaction_Hamiltonian_SphericalTensor(A,IT_PAF,B,\"spin-spin\",\"secular + pseudosecular\", phi,theta,0)\n", "Hdd_LAB_ST.Inverse2PI().Round(0).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Cartesian tensor to Spherical tensors and back" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'rank0': (-0+0j),\n", " 'rank1': [(-0+0j), -0j, (-0+0j)],\n", " 'rank2': [0j, (-0+0j), (-384764.94904855924+0j), 0j, 0j]}" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "carTOst = ST.MatrixToSphericalTensors(IT_PAF )\n", "carTOst" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [], "source": [ "T0 = carTOst[\"rank0\"]\n", "T11, T10, T1m1 = carTOst[\"rank1\"]\n", "T22, T21, T20, T2m1, T2m2 = carTOst[\"rank2\"]" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}25000.0 & 0 & 0\\\\0 & 25000.0 & 0\\\\0 & 0 & -50000.0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[25000.0, 0, 0],\n", "[ 0, 25000.0, 0],\n", "[ 0, 0, -50000.0]])" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "spTOcar = ST.SphericalTensorsToMatrix(carTOst)\n", "spTOcar.Inverse2PI().matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Wigner d matrix" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0.854 & -0.5 & 0.146\\\\0.5 & 0.707 & -0.5\\\\0.146 & 0.5 & 0.854\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0.854, -0.5, 0.146],\n", "[ 0.5, 0.707, -0.5],\n", "[0.146, 0.5, 0.854]])" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rot.Wigner_d_Matrix(rank=1,beta=45).Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0.729 & -0.604 & 0.306 & -0.104 & 0.021\\\\0.604 & 0.354 & -0.612 & 0.354 & -0.104\\\\0.306 & 0.612 & 0.25 & -0.612 & 0.306\\\\0.104 & 0.354 & 0.612 & 0.354 & -0.604\\\\0.021 & 0.104 & 0.306 & 0.604 & 0.729\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0.729, -0.604, 0.306, -0.104, 0.021],\n", "[0.604, 0.354, -0.612, 0.354, -0.104],\n", "[0.306, 0.612, 0.25, -0.612, 0.306],\n", "[0.104, 0.354, 0.612, 0.354, -0.604],\n", "[0.021, 0.104, 0.306, 0.604, 0.729]])" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rot.Wigner_d_Matrix(rank=2,beta=45).Round(3).matrix" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Wigner D matrix" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}- 0.854 i & -0.354 + 0.354 i & 0.146\\\\0.354 - 0.354 i & 0.707 & -0.354 - 0.354 i\\\\0.146 & 0.354 + 0.354 i & 0.854 i\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -0.854*I, -0.354 + 0.354*I, 0.146],\n", "[0.354 - 0.354*I, 0.707, -0.354 - 0.354*I],\n", "[ 0.146, 0.354 + 0.354*I, 0.854*I]])" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rot.Wigner_D_Matrix(rank=1,alpha=45,beta=45,gamma=45).Round(3).matrix" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}-0.729 & 0.427 + 0.427 i & - 0.306 i & -0.073 + 0.073 i & 0.021\\\\-0.427 - 0.427 i & - 0.354 i & -0.433 + 0.433 i & 0.354 & -0.073 - 0.073 i\\\\- 0.306 i & 0.433 - 0.433 i & 0.25 & -0.433 - 0.433 i & 0.306 i\\\\0.073 - 0.073 i & 0.354 & 0.433 + 0.433 i & 0.354 i & 0.427 - 0.427 i\\\\0.021 & 0.073 + 0.073 i & 0.306 i & -0.427 + 0.427 i & -0.729\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ -0.729, 0.427 + 0.427*I, -0.306*I, -0.073 + 0.073*I, 0.021],\n", "[-0.427 - 0.427*I, -0.354*I, -0.433 + 0.433*I, 0.354, -0.073 - 0.073*I],\n", "[ -0.306*I, 0.433 - 0.433*I, 0.25, -0.433 - 0.433*I, 0.306*I],\n", "[ 0.073 - 0.073*I, 0.354, 0.433 + 0.433*I, 0.354*I, 0.427 - 0.427*I],\n", "[ 0.021, 0.073 + 0.073*I, 0.306*I, -0.427 + 0.427*I, -0.729]])" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rot.Wigner_D_Matrix(rank=2,alpha=45,beta=45,gamma=45).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 }