Converting to state vector gives wrong energy
Posted: 15 Mar 2025, 20:52
Hi,
I am new to TenPy so need a bit of help. I am running DMRG on a TFIM and when I get the final energy it is -10.5. I also obtained the exact energy by exact diagonalization (since I have a small system size) and that is also very close to the DMRG energy. All good.
However, when I try to extract the state and then calculate the energy, I get a number that is very different (around +3.7). So I am confused whether I am extracting the state incorrectly. Basically, I want to extract (a) the final MPS from the DMRG calculations and (b) the final state resulting from this MPS.
Thank you
I am new to TenPy so need a bit of help. I am running DMRG on a TFIM and when I get the final energy it is -10.5. I also obtained the exact energy by exact diagonalization (since I have a small system size) and that is also very close to the DMRG energy. All good.
However, when I try to extract the state and then calculate the energy, I get a number that is very different (around +3.7). So I am confused whether I am extracting the state incorrectly. Basically, I want to extract (a) the final MPS from the DMRG calculations and (b) the final state resulting from this MPS.
Python: Select all
psi_mps_state = psi.get_theta(0, psi.L).to_ndarray()
print("PSI MPS Energy: ", (psi_mps_state.conj().reshape(1, -1) @ H_sp @ psi_mps_state.reshape(-1, 1)).real.item())
Thank you
