{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "6718709f", "metadata": {}, "source": [ "# Cartesian 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_car, Dic_car = BS.ProductOperators_SpinHalf_Cartesian()" ] }, { "cell_type": "code", "execution_count": 4, "id": "73333478", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Id1 Id2 ',\n", " 'Id1 Ix2 ',\n", " 'Id1 Iy2 ',\n", " 'Id1 Iz2 ',\n", " 'Ix1 Id2 ',\n", " 'Ix1 Ix2 ',\n", " 'Ix1 Iy2 ',\n", " 'Ix1 Iz2 ',\n", " 'Iy1 Id2 ',\n", " 'Iy1 Ix2 ',\n", " 'Iy1 Iy2 ',\n", " 'Iy1 Iz2 ',\n", " 'Iz1 Id2 ',\n", " 'Iz1 Ix2 ',\n", " 'Iz1 Iy2 ',\n", " 'Iz1 Iz2 ']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Dic_car" ] }, { "cell_type": "code", "execution_count": 5, "id": "d0632fe6", "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": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_car[0].matrix" ] }, { "cell_type": "code", "execution_count": 6, "id": "41a46a96", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0.5 & 0 & 0\\\\0.5 & 0 & 0 & 0\\\\0 & 0 & 0 & 0.5\\\\0 & 0 & 0.5 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0.5, 0, 0],\n", "[0.5, 0, 0, 0],\n", "[ 0, 0, 0, 0.5],\n", "[ 0, 0, 0.5, 0]])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_car[1].matrix" ] }, { "cell_type": "code", "execution_count": 7, "id": "9a02a813", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & - 0.5 i & 0 & 0\\\\0.5 i & 0 & 0 & 0\\\\0 & 0 & 0 & - 0.5 i\\\\0 & 0 & 0.5 i & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, -0.5*I, 0, 0],\n", "[0.5*I, 0, 0, 0],\n", "[ 0, 0, 0, -0.5*I],\n", "[ 0, 0, 0.5*I, 0]])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_car[2].matrix" ] }, { "cell_type": "code", "execution_count": 8, "id": "cc6ad84e", "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": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Basis_car[3].matrix" ] }, { "attachments": {}, "cell_type": "markdown", "id": "90e59b54", "metadata": {}, "source": [ "### String Index" ] }, { "cell_type": "code", "execution_count": 9, "id": "5b50848d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['', 'Ix2', 'Iy2', 'Iz2', 'Ix1', 'Ix1Ix2', 'Ix1Iy2', 'Ix1Iz2', 'Iy1', 'Iy1Ix2', 'Iy1Iy2', 'Iy1Iz2', 'Iz1', 'Iz1Ix2', 'Iz1Iy2', 'Iz1Iz2']\n" ] } ], "source": [ "B_car = BS.String_to_Matrix(Dic_car, Basis_car)" ] }, { "cell_type": "code", "execution_count": 10, "id": "0577a8bb", "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0.5 & 0 & 0\\\\0.5 & 0 & 0 & 0\\\\0 & 0 & 0 & 0.5\\\\0 & 0 & 0.5 & 0\\end{matrix}\\right]$" ], "text/plain": [ "Matrix([\n", "[ 0, 0.5, 0, 0],\n", "[0.5, 0, 0, 0],\n", "[ 0, 0, 0, 0.5],\n", "[ 0, 0, 0.5, 0]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "B_car[\"Ix2\"].matrix" ] }, { "cell_type": "code", "execution_count": 11, "id": "a417da06", "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_car[''].matrix" ] }, { "cell_type": "code", "execution_count": null, "id": "1b3a2cd2", "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 }