From ac47a3d54c0ecd8b927b9009a59e2c44d9928109 Mon Sep 17 00:00:00 2001 From: Huanchen Zhai Date: Wed, 25 Sep 2024 16:11:18 -0700 Subject: [PATCH] update docs for su2 to sz --- docs/source/tutorial/qc-hamiltonians.ipynb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/tutorial/qc-hamiltonians.ipynb b/docs/source/tutorial/qc-hamiltonians.ipynb index a862f00b..14b7df76 100644 --- a/docs/source/tutorial/qc-hamiltonians.ipynb +++ b/docs/source/tutorial/qc-hamiltonians.ipynb @@ -2107,7 +2107,11 @@ "\n", "We can also transform the spin-adapted MPS generated in the ``SU2`` mode to the non-spin-adapted MPS, which can be used in the ``SZ`` mode. After obtaining the non-spin-adapted MPS, one need to redo ``driver.initialize_system``, ``driver.get_qc_mpo``, etc. to make sure every object is now represented in the ``SZ`` mode, then you can operate on the ``SZ`` non-spin-adapted MPS.\n", "\n", - "In the following example, we first compute the spin-adapted MPS, then translate it into the non-spin-adapted MPS to extract the determinant coefficients." + "In the following example, we first compute the spin-adapted MPS, then translate it into the non-spin-adapted MPS to extract the determinant coefficients.\n", + "\n", + "As the transform from SU2 format to SZ format is only implemented for left canonicalized MPS, we need to add a line ``driver.align_mps_center(ket, ref=0)`` to change its canonical center to zero (if it is not zero) before translating an MPS from SU2 format to SZ format.\n", + "\n", + "For a non-singlet SU2 MPS (not the case in the example below), as it can have multiple SZ components, we need to specify a specific SZ component. This is done via the ``sz`` argument of ``driver.mps_change_to_sz``. When we extract only a component of the non-singlet SU2 MPS, the norm of the extracted MPS will be smaller than the norm of the original SU2 MPS. Therefore, one may explicitly compute the ``norm**2`` of the translated MPS (using ``driver.expectation(zket, driver.get_identity_mpo(), zket)``), and the computed PDM quantities should be scaled by ``1 / norm**2``. Quantities like orbital entropies have to be computed after the MPS is normalized. MPSs can be normalized using ``zket.iscale(1 / norm)``." ] }, { @@ -2202,6 +2206,7 @@ " thrds=thrds, iprint=1)\n", "print('DMRG energy = %20.15f' % energy)\n", "\n", + "driver.align_mps_center(ket, ref=0)\n", "csfs, coeffs = driver.get_csf_coefficients(ket, cutoff=0.05, iprint=1)\n", "zket = driver.mps_change_to_sz(ket, \"ZKET\")\n", "\n",