# Read psi from idmrg into ITensorInfiniteMPS.jl

**URL:** <https://itensor.discourse.group/t/read-psi-from-idmrg-into-itensorinfinitemps-jl/890>\
**Category:** ITensor Julia Questions\
**Tags:** julia, cpp, mps\
**Created:** [May 21, 2023, 7:12pm UTC](https://itensor.discourse.group/t/read-psi-from-idmrg-into-itensorinfinitemps-jl/890 "2023-05-21T19:12:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![L\_Zhang](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/l_zhang/32/245_2.png) [@L\_Zhang](https://itensor.discourse.group/u/L_Zhang)\
**Post date:** [May 21, 2023, 7:12pm UTC](https://itensor.discourse.group/t/read-psi-from-idmrg-into-itensorinfinitemps-jl/890/1 "2023-05-21T19:12:54Z")

</div>

Can the wave function obtained from [iDMRG](https://github.com/ITensor/iDMRG)  
be loaded into [ITensorInfiniteMPS.jl](https://github.com/ITensor#:~:text=on%20Apr%2014-,ITensorInfiniteMPS.jl,-Public)  
to do the transfer matrix spectrum calculation?

Because of my poor coding skill, I try to avoid the difficulty of arnoldi algorithm in C++ and the huge memory consumption of vumps procedure in Julia.

I’ve read the HDF5 method of transforming data from C++ to Juia.  
So I try to do it.

save hdf5 in C++:

```auto
auto fo = h5_open("h5sav", 'w');
    // h5_write(fo,"sites",sites);
    h5_write(fo, "psi", psi);
    h5_write(fo, "H_infi", H_infi);

```

read in Julia

```auto
fi = h5open("h5sav", "r")
ψ.C = read(fi, "psi", InfiniteCanonicalMPS)
close(fi)

```

and it comes to an error

```auto
ERROR: LoadError: HDF5 group or file does not contain InfiniteCanonicalMPS data
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] read(parent::HDF5.File, name::String, #unused#::Type{InfiniteCanonicalMPS})
   @ ITensorInfiniteMPS ~/.julia/packages/ITensorInfiniteMPS/C1o6c/src/infinitemps.jl:258
 [3] top-level scope
   @ ~/ITensorInfiniteMPS.jl/imps/zigzagsu3/readtm.jl:33
in expression starting at /data/home/jhzhang/ITensorInfiniteMPS.jl/imps/zigzagsu3/readtm.jl:33

```

it seems like a type error.  
I just wonder if it is easy to solve. If it isn’t, I would try another way.
