{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "6718709f", "metadata": {}, "source": [ "# PMZ Product Operators (Any Spin Half)\n", "- Author: Vineeth Francis Thalakottoor\n", "- Email: vineeth.thalakottoor@ens.psl.eu or vineethfrancis.physics@gmail.com" ] }, { "cell_type": "code", "execution_count": 1, "id": "27a57f94", "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", "import time\n", "%matplotlib ipympl\n", "\n", "# Import PyOR package\n", "from PyOR_QuantumSystem import QuantumSystem as QunS\n", "from PyOR_Hamiltonian import Hamiltonian\n", "from PyOR_DensityMatrix import DensityMatrix\n", "from PyOR_QuantumObject import QunObj\n", "from PyOR_HardPulse import HardPulse\n", "from PyOR_Basis import Basis\n", "from PyOR_Evolution import Evolutions\n", "from PyOR_Plotting import Plotting\n", "import PyOR_SignalProcessing as Spro\n", "from PyOR_Commutators import Commutators\n", "from PyOR_QuantumLibrary import QuantumLibrary\n", "from PyOR_Relaxation import RelaxationProcess" ] }, { "cell_type": "code", "execution_count": 2, "id": "ab0e39a3", "metadata": {}, "outputs": [], "source": [ "# Define the spin system\n", "#Spin_list = {\"A\" : \"H1\",\"B\" : \"H1\",\"C\" : \"H1\"}\n", "Spin_list = {\"A\" : \"H1\",\"B\" : \"H1\"}\n", "\n", "QS = QunS(Spin_list,PrintDefault=False)\n", "\n", "# initialize the system\n", "QS.Initialize()" ] }, { "attachments": {}, "cell_type": "markdown", "id": "6f86d849", "metadata": {}, "source": [ "## Product Operator Basis: Spherical Tensors" ] }, { "cell_type": "code", "execution_count": 3, "id": "efb23439", "metadata": {}, "outputs": [], "source": [ "BS = Basis(QS)\n", "\n", "Basis_PMZ, coherence_PMZ, Dic_PMZ = BS.ProductOperators_SpinHalf_PMZ()" ] }, { "cell_type": "code", "execution_count": 4, "id": "7cd39f7c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[-2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2]\n" ] } ], "source": [ "print(coherence_PMZ)" ] }, { "cell_type": "code", "execution_count": 5, "id": "73333478", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Im1 Im2 ', 'Im1 Iz2 ', 'Im1 Id2 ', 'Iz1 Im2 ', 'Id1 Im2 ', 'Im1 Ip2 ', 'Iz1 Iz2 ', 'Iz1 Id2 ', 'Id1 Iz2 ', 'Id1 Id2 ', 'Ip1 Im2 ', 'Iz1 Ip2 ', 'Id1 Ip2 ', 'Ip1 Iz2 ', 'Ip1 Id2 ', 'Ip1 Ip2 ']\n" ] } ], "source": [ "print(Dic_PMZ)" ] }, { "cell_type": "code", "execution_count": 6, "id": "d0632fe6", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\1.0 & 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", "[1.0, 0, 0, 0]])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_PMZ[0].matrix" ] }, { "cell_type": "code", "execution_count": 7, "id": "41a46a96", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0.707106781186547 & 0 & 0 & 0\\\\0 & -0.707106781186547 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, 0, 0],\n", "[ 0, 0, 0, 0],\n", "[0.707106781186547, 0, 0, 0],\n", "[ 0, -0.707106781186547, 0, 0]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_PMZ[1].matrix" ] }, { "cell_type": "code", "execution_count": 8, "id": "9a02a813", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0.707106781186547 & 0 & 0 & 0\\\\0 & 0.707106781186547 & 0 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, 0, 0],\n", "[ 0, 0, 0, 0],\n", "[0.707106781186547, 0, 0, 0],\n", "[ 0, 0.707106781186547, 0, 0]])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_PMZ[2].matrix" ] }, { "cell_type": "code", "execution_count": 9, "id": "cc6ad84e", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0.707106781186547 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & -0.707106781186547 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0, 0, 0],\n", "[0.707106781186547, 0, 0, 0],\n", "[ 0, 0, 0, 0],\n", "[ 0, 0, -0.707106781186547, 0]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_PMZ[3].matrix" ] }, { "attachments": {}, "cell_type": "markdown", "id": "b907f366", "metadata": {}, "source": [ "### String Index" ] }, { "cell_type": "code", "execution_count": 10, "id": "b87d99a9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Im1Im2', 'Im1Iz2', 'Im1', 'Iz1Im2', 'Im2', 'Im1Ip2', 'Iz1Iz2', 'Iz1', 'Iz2', '', 'Ip1Im2', 'Iz1Ip2', 'Ip2', 'Ip1Iz2', 'Ip1', 'Ip1Ip2']\n" ] } ], "source": [ "B_PMZ = BS.String_to_Matrix(Dic_PMZ, Basis_PMZ)" ] }, { "cell_type": "code", "execution_count": 11, "id": "326df8dc", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0.5 & 0 & 0 & 0\\\\0 & 0.5 & 0 & 0\\\\0 & 0 & 0.5 & 0\\\\0 & 0 & 0 & 0.5\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[0.5, 0, 0, 0],\n", "[ 0, 0.5, 0, 0],\n", "[ 0, 0, 0.5, 0],\n", "[ 0, 0, 0, 0.5]])" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "B_PMZ[''].matrix" ] }, { "cell_type": "code", "execution_count": 12, "id": "8c9fd4b5", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\1.0 & 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", "[1.0, 0, 0, 0]])" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "B_PMZ['Im1Im2'].matrix" ] }, { "cell_type": "code", "execution_count": null, "id": "b0e7a62d", "metadata": {}, "outputs": [], "source": [] } ], "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": 5 }