Closed michaelstreif closed 1 year ago
You can add the keyword nonspinadapted
in your input file, so that your MPS will be non spin-adapted, then it will sample DETs.
Hi, thanks a lot for the quick response!
This solution will however make the code much slower, correct? And it could happen that the outcome will not respect the spin symmetry, right?
Is there a way to run it spin adapted and to do the conversion afterwards?
Thanks!
Hi,
Thanks for the clarification of the question.
This solution will however make the code much slower, correct? And it could happen that the outcome will not respect the spin symmetry, right?
Yes, both are correct. The block2
code allows you to have finer control of the efficiency and symmetry, but the workflow and the interpretation of the results can also be more complicated. Therefore, regarding your original question:
Is there a possibility to directly sample Slater determinants instead of CSFs at the end of a DMRG calculation?
The remaining may answer your question, but it will not be related to the direct sampling of DETs.
We only allow a direct sampling of (a) the coefficient of CSFs in a spin-adapted MPS; and (b) the coefficient of DETs in a non-spin-adapted MPS, because a spin-adapted MPS can be expressed as a linear combination of CSFs, and a non-spin-adapted MPS can be expressed as a linear combination of DETs. The spin-adapted MPS can conserve the total spin because each CSF has a well-defined total spin.
If we now want to get the DET coefficients from a spin-adapted MPS, we have to do this indirectly. There are at least three possible approaches:
(1) The MPS (spin-adapted) $\rightarrow$ CSF $\rightarrow$ DET approach
We can first compute (a) the CSF coefficients from the spin-adapted MPS. Then since every CSF can also be expressed as a linear combination of DETs, and (b) the coefficients between CSF and DET can be computed, we can multiply the two coefficients (a) and (b) to get the MPS (spin-adapted) $\rightarrow$ DET coefficients.
You can directly get the coefficients (a) from block2
. And the coefficients (b) can be computed using a simple python script https://github.com/hczhai/CSF.
(2) The MPS (spin-adapted) $\rightarrow$ MPS (non-spin-adapted) $\rightarrow$ DET approach
As an alternative approach, we can first do DMRG in the spin-adapted mode, so the optimization is efficient, then we can transform this spin-adapted MPS to a non-spin-adapted MPS. The transform can be done exactly, so that the transformed non-spin-adapted MPS will have a well-defined total spin. Then we can sample DET coefficients using this non-spin-adapted MPS. This approach should have no efficiency or total spin symmetry broken problems.
The input file for transforming MPS from spin-adapted to non-spin-adapted is given in the documentation https://block2.readthedocs.io/en/latest/user/advanced.html#mps-transform. After this transform, you can sample DETs using this transformed MPS with the nonspinadapted
keyword. You can also do all steps (DMRG + transform MPS + sampling) using a single input file:
sym d2h
orbitals data/C2.CAS.PVDZ.FCIDUMP.ORIG
spin 0
schedule default
maxM 500
maxiter 30
irrep_reorder
mps_tags KET
copy_mps ZKET
trans_mps_to_sz
sample 0.05
Note that the approach (1) and (2) may give you different results under some conditions. This is because a DET may be coupled with multiple CSFs, and the spin-adapted MPS can also contain multiple CSFs (with the same total spin). Therefore, to match the results of (1) and (2), when you do approach (1), you may need to include all relevant CSFs in the MPS associated with the DET. But it can be hard to determine all these CSFs a priori. When you use approach (2), it is important to note that the DET coefficient you got is associated with multiple CSFs (in the same MPS).
(2.1) Special considerations when the total spin $S$ of the spin-adapted MPS is not zero:
For this case, the sampling algorithm requires the spin-adapted MPS to be in the "singlet-embedding" format. You can either do the whole DMRG with the singlet_embedding
keyword, or transform the MPS from non-singlet-embedding to singlet-embedding at the end of a normal DMRG. More detailed discussion on this can be found in #22.
When the spin-adapted MPS has a total spin $S \neq 0$, this spin-adapted MPS will be a linear combination of multiple non-spin-adapted MPSs with different projected spin $S_z = -S, -S + 1, \cdots, S$. Therefore, when you do the MPS (spin-adapted) $\rightarrow$ MPS (non-spin-adapted) transform, you have to additionally set what $S_z$ the non-spin-adapted MPS should have. These are explained in the documentation https://block2.readthedocs.io/en/latest/user/advanced.html#singlet-embedding. The following is an example input file for the case of sampling the DETs in the $S=1, S_z=-1$ (triplet) MPS:
sym d2h
orbitals data/C2.CAS.PVDZ.FCIDUMP.ORIG
spin 2
schedule default
maxM 500
maxiter 30
irrep_reorder
singlet_embedding
mps_tags KET
copy_mps ZKET
trans_mps_to_sz
resolve_twosz -2
normalize_mps
sample 0.05
Note that the keyword normalize_mps
indicates whether the non-spin-adapted MPS should be normalized or not. If normalize_mps
is given, for a complete sampling the sum of all DET coefficients squared is equal to one. If normalize_mps
is not given then only the original spin-adapted MPS is normalized, so the sum is smaller than one, because this is only the sum of all $2S_z = -2$ DETs but the sum of all $2S_z = -2, 0$ and $2$ DETs will be one.
If resolve_twosz -2
is not given, the transformed non-spin-adapted MPS will be an ensemble of all $2S_z = -2, 0$ and $2$ MPSs. Then the sampling will generate DETs with all possibile $S_z$.
(3) The MPS (non-spin-adapted) $\rightarrow$ DET approach
If the DMRG is done in the non-spin-adapted formalism, we can still check whether the final non-spin-adapted MPS has a well-defined total spin quantum number, by computing the expectation value $\langle S^2 \rangle$ of this MPS. Most of the time, the non-spin-adapted MPS may still have a well-defined total spin quantum number. So this solves the symmetry problem, but as you mentioned the non-spin-adapted DMRG may still be slower.
The documentation says:
However, sample always samples CSFs. Is there a possibility to directly sample Slater determinants instead of CSFs at the end of a DMRG calculation?
Thank you!