Skip to content

Commit

Permalink
update docs for su2 to sz
Browse files Browse the repository at this point in the history
  • Loading branch information
hczhai committed Sep 25, 2024
1 parent 74d18d2 commit ac47a3d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/source/tutorial/qc-hamiltonians.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)``."
]
},
{
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit ac47a3d

Please sign in to comment.