Skip to content

Commit 8fead4d

Browse files
authored
Fix_notebook.jl
1 parent 18765ee commit 8fead4d

File tree

1 file changed

+11
-16
lines changed
  • examples/quantum1d/1.ising-cft

1 file changed

+11
-16
lines changed

examples/quantum1d/1.ising-cft/main.jl

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,33 +51,28 @@ either diagramatically as
5151
5252
or in the code as:
5353
"""
54-
55-
id = complex(isomorphism(ℂ^2, ℂ^2))
56-
@tensor O[-1 -2; -3 -4] := id[-1, -3] * id[-2, -4]
57-
T = periodic_boundary_conditions(InfiniteMPO([O]), L)
54+
function O_shift(L)
55+
id = complex(isomorphism(ℂ^2, ℂ^2))
56+
@tensor O[-1 -2; -3 -4] := id[-1, -3] * id[-2, -4]
57+
T = periodic_boundary_conditions(InfiniteMPO([O]), L)
58+
return T;
59+
end
5860

5961
md"""
6062
We can then calculate the momentum of the groundstate as the expectation value of this
6163
operator. However, there is a subtlety because of the degeneracies in the energy
6264
eigenvalues. The eigensolver will find an orthonormal basis within each energy subspace, but
6365
this basis is not necessarily a basis of eigenstates of the translation operator. In order
6466
to fix this, we diagonalize the translation operator within each energy subspace.
67+
The resulting energy levels have one-to-one correspondence to the operators in CFT, where the momentum is related to their conformal spin as $P_n = \frac{2\pi}{L}S_n$.
6568
"""
66-
67-
momentum(ψᵢ, ψⱼ=ψᵢ) = angle(dot(ψᵢ, T * ψⱼ))
68-
69+
6970
function fix_degeneracies(basis)
70-
N = zeros(ComplexF64, length(basis), length(basis))
7171
M = zeros(ComplexF64, length(basis), length(basis))
7272
for i in eachindex(basis), j in eachindex(basis)
73-
N[i, j] = dot(basis[i], basis[j])
74-
M[i, j] = momentum(basis[i], basis[j])
73+
M[i, j] = dot(basis[i],O_shift(L)*basis[j])
7574
end
7675

77-
vals, vecs = eigen(Hermitian(N))
78-
M = (vecs' * M * vecs)
79-
M /= diagm(vals)
80-
8176
vals, vecs = eigen(M)
8277
return angle.(vals)
8378
end
@@ -99,7 +94,7 @@ plot(momenta,
9994
xlabel="momentum",
10095
ylabel="energy",
10196
legend=false)
102-
97+
vline!([2π/L*i for i=-3:3],color="gray",linestyle=:dash)
10398
md"""
10499
## Finite bond dimension
105100
@@ -122,7 +117,6 @@ E_ex, qps = excitations(H_mps, QuasiparticleAnsatz(), ψ, envs; num=16)
122117
states_mps = vcat(ψ, map(qp -> convert(FiniteMPS, qp), qps))
123118
E_mps = map(x -> expectation_value(x, H_mps), states_mps)
124119

125-
T_mps = periodic_boundary_conditions(InfiniteMPO([O]), L_mps)
126120
momenta_mps = Float64[]
127121
append!(momenta_mps, fix_degeneracies(states[1:1]))
128122
append!(momenta_mps, fix_degeneracies(states[2:2]))
@@ -139,3 +133,4 @@ plot(momenta_mps,
139133
xlabel="momentum",
140134
ylabel="energy",
141135
legend=false)
136+
vline!([2π/L*i for i=-3:3],color="gray",linestyle=:dash)

0 commit comments

Comments
 (0)