joselado / dmrgpy

DMRGPy is a Python library to compute quasi-one-dimensional spin chains and fermionic systems using matrix product states with DMRG as implemented in ITensor. Most of the computations can be performed both with DMRG and exact diagonalization for small systems, which allows one to benchmark the results.
GNU General Public License v3.0
87 stars 20 forks source link

Human readable mps.MPS structures #7

Closed alidiak closed 3 years ago

alidiak commented 3 years ago

Hey Joselado,

I really appreciate you creating this package, it's so helpful! I was wondering and trying to figure out how can one convert the output of the dmrgpy.mps.MPS class into say a list of matrices? The .mps built in function reads the binary .mps files generated from sims into bytes: b'\x03\x00\x00\x00\x00...', but I am not sure how to convert this to human readable. I've tried struct.unpack, but it typically results in nonsense.

Thanks for your time.

joselado commented 3 years ago

Hi alidiak,

thanks for your message and your nice feedback!

Currently, unfortunately it is not possible to access the individual matrices of the mps.MPS object, as currently, the mps.MPS is an abstract object storing the binary .mps info. In other words, the object allows to do any kind of MPS-MPO algebra, but unfortunately not to access the individual matrices. This could be certainly very interesting to have, and in particular, using the HDF5 support of ITensor would be not complex to implement. Thanks for bringing up this point!

Best regards, Jose

alidiak commented 3 years ago

Ok great, thank you very much for pointing me in the right direction! I was thinking to try reinstall a current version of Itensor in the Itensor folder, changing the options.mk according to https://itensor.org/docs.cgi?vers=cppv3&page=install/install_with_hdf5, and then recompile and write a c++ script to translate the .mps data into HDF5 files. I'll report back after trying the above.

Best, Alex

joselado commented 3 years ago

Hi Alex,

yes, that would be certainly the way to do it! Nevertheless, I think that it might be possible that additional small changes in the code have to be implemented to be able to see the individual matrices in the mps.MPS object.

Best, Jose