+1 vote
asked by (400 points)

I am writing an MPS along with the expectation values of some operators computed with respect to that MPS to an HDF5 file. I can successfully use the following command to read the MPS:

read(f,"psi",MPS)

However, I am not sure how to read the expectation values. What "type" should I use in that case? I have tried the following:

read(f,"energy",Float)

But it doesn't work. I am using the Julia version of ITensor.

Thank you!

1 Answer

+1 vote
answered by (70.1k points)
selected by
 
Best answer

Hi, good question. I believe all you’ll need to put is

read(f,”energy”)

And it will figure out the type for you.

We are working on an improved interface where you can also leave off the type for ITensor related types but right now it’s required. For some more information, when you are writing and reading native Julia types like floats, the write and read functions are just those from the HDF5.jl library. But we have created overloads of write and read for writing and reading ITensor types.

Miles

commented by (400 points)
Thanks for the prompt response, Miles! This works.
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...