# Warning: type ITensors.ITensorMPS.MPS does not exist in workspace; reconstructing

**URL:** <https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149>\
**Category:** ITensor Julia Questions\
**Created:** [December 3, 2024, 6:44am UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149 "2024-12-03T06:44:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![swanchristmas](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/swanchristmas/32/395_2.png) [@swanchristmas](https://itensor.discourse.group/u/swanchristmas)\
**Post date:** [December 3, 2024, 6:44am UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149/1 "2024-12-03T06:44:47Z")

</div>

I previously stored an MPS (from v0.6.23 of the ITensors.jl package) in a JLD2 file. However, after updating to version 0.7, I’m unable to load it properly since the current type should be `ITensorMPS.MPS`.

My loading approach is as follows:

```auto
using JLD2, ITensors, ITensorMPS
path = "xxx.jld2"
jldopen(path, "r") do file
    ψ = file["ψ"]
end

```

Has anyone encountered a similar issue? How can I reconcile this problem and load the MPS correctly in the updated version?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![swanchristmas](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/swanchristmas/32/395_2.png) [@swanchristmas](https://itensor.discourse.group/u/swanchristmas)\
**Post date:** [December 3, 2024, 7:00am UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149/2 "2024-12-03T07:00:38Z")

</div>

**My current solution is:**

```auto
using JLD2, ITensors, ITensorMPS
path = "xxx.jld2"
jldopen(path, "r") do file
    ψ = file["ψ"]
    ψ = MPS(ψ.data)
end

```

I’m also aware that the official I/O approach uses the HDF5 format, where one can assign the `MPS` type during loading like this:

```auto
psi = read(f, "psi", MPS)

```

Should I stop storing MPS in JLD2 files and switch to the recommended HDF5 format?

---

<div class="post-metadata">

**Author:** ![miles](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/miles/32/6_2.png) [@miles](https://itensor.discourse.group/u/miles)\
**Post date:** [December 3, 2024, 8:47pm UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149/3 "2024-12-03T20:47:50Z")

</div>

Yes, I would recommend using HDF5 if you want longer-term portability, and if you do not need any of the features that JLD2 offers.

---

<div class="post-metadata">

**Author:** ![swanchristmas](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/swanchristmas/32/395_2.png) [@swanchristmas](https://itensor.discourse.group/u/swanchristmas)\
**Post date:** [December 4, 2024, 4:46pm UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149/4 "2024-12-04T16:46:17Z")

</div>

Thanks, Miles.  
Also, I’ve found the official solution for using JLD2 with explicit type remapping:

```auto
using JLD2, ITensors, ITensorMPS
path = "xxx.jld2"
jldopen(path, "r"; typemap=Dict("ITensors.ITensorMPS.MPS" => MPS)) do file
    ψ = file["ψ"]
end

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/itensor/original/1X/d3072b13e047cd06df7f3981547c0917d940dfa4.png) [@system](https://itensor.discourse.group/u/system)\
**Post date:** [December 14, 2024, 4:46pm UTC](https://itensor.discourse.group/t/warning-type-itensors-itensormps-mps-does-not-exist-in-workspace-reconstructing/2149/5 "2024-12-14T16:46:53Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
