# on purification scheme

**URL:** <https://itensor.discourse.group/t/on-purification-scheme/2087>\
**Category:** ITensor Julia Questions\
**Created:** [October 25, 2024, 9:23am UTC](https://itensor.discourse.group/t/on-purification-scheme/2087 "2024-10-25T09:23:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Explorer](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@Explorer](https://itensor.discourse.group/u/Explorer)\
**Post date:** [October 25, 2024, 9:23am UTC](https://itensor.discourse.group/t/on-purification-scheme/2087/1 "2024-10-25T09:23:09Z")

</div>

I am trying to find the thermal state using a purification scheme for the following model

H{=}\sum\_{j}^{N-1}{\bf S}\_{j}.{\bf S}\_{j{+}1}+ h \sum\_{j}^{N} S^z\_{j}

The following implementation gives the correct benchmark results only for two values of h=0, 1

```
 gates = ITensor[]      
 for j=1:N-1
 s1 = s[j]
 s2 = s[j+1] 
 hj = op("Sz",s1) * op("Sz",s2) +
     1/2 * op("S+",s1) * op("S-",s2) +
     1/2 * op("S-",s1) * op("S+",s2) -
     h * op("Sz",s1) * op("Id",s2) 

 Gj = exp(-1.0* tau/2 * hj)
push!(gates,Gj)
end

hj = - h * op("Id",s[N-1]) * op("Sz",s[N]) 
Gj = exp(-1.0 * tau/2 * hj)
push!(gates,Gj)

append!(gates,reverse(gates)) 

```

@miles Is the above implementation of trotter gates correct for the H ?. Could you please help me with this ?

---

<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 15, 2024, 3:00am UTC](https://itensor.discourse.group/t/on-purification-scheme/2087/2 "2024-12-15T03:00:49Z")

</div>

For implementing the purification method for the 1D Heisenberg model, we actually give a fully working example in this example file in the ITensorMPS.jl repo:  
[https://github.com/ITensor/ITensorMPS.jl/blob/main/examples/finite\_temperature/purification.jl](https://github.com/ITensor/ITensorMPS.jl/blob/main/examples/finite_temperature/purification.jl)  
The only difference from your case is that you would need to add a magnetic field term. To make it fit the pattern of that code, you could add a term like

\frac{h}{2} S^z\_i + \frac{h}{2} S^z\_{i+1}

to each two-site local Hamiltonian operator.

Also, please do not address questions directly to one of us, but instead post your questions in a general way. There are others here who are also answering questions frequently.
