-
Dear Block2 developers, First of all, thanks for an awesome program and excellent documentation! I would like to calculate orbital entropies for a set of states but I run into problems. My approach was to first split the MPS into the different states
This approach works well for the first state but for the second state, I get an assertion error:
Do you know of a way how to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for using the As the error message indicates, # Split states
kets = [driver.split_mps(ket, ir, tag="KET-%d" % ir) for ir in range(ket.nroots)]
# Change from SU(2) to SZ symmetry in order to calculate orbital entropies
zkets = [driver.mps_change_to_sz(ket, "ZKET-%d" % ir) for ir, ket in enumerate(kets)]
driver.symm_type = SymmetryTypes.SZ
driver.initialize_system(n_sites=ncas, n_elec=n_elec, spin=spin, orb_sym=orb_sym)
mpo = driver.get_qc_mpo(h1e=h1e, g2e=g2e, ecore=ecore, iprint=0)
impo = driver.get_identity_mpo()
for zket in zkets:
print("SZ energy :", driver.expectation(zket, mpo, zket) / driver.expectation(zket, impo, zket))
# Calculate orbital entanglement
ordm1 = driver.get_orbital_entropies(zket, orb_type=1)
print("Orbital entropies:")
print(ordm1) Of course, you can always use |
Beta Was this translation helpful? Give feedback.
Thanks for using the
block2
package.As the error message indicates,
mps_change_to_sz
is supposed to be used in the SU2 mode. But since you putdriver.symm_type = SymmetryTypes.SZ
in the first iteration in the for loop,driver
will be in the SZ mode during the second iteration. To solve the problem, you may putdriver.symm_type = SymmetryTypes.SZ
outside the loop, and make sure allmps_change_to_sz
is done beforedriver.symm_type = SymmetryTypes.SZ
. The following is an example script: