Skip to content

Commit 0082ec3

Browse files
committed
Log bond dimension during TEBD.
1 parent ea9f48d commit 0082ec3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/TEBD.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct TEBDResults
1313
observables::Dict{String,Tuple{Vector{ComplexF64},Vector{ComplexF64},Vector{ComplexF64}}}
1414
localOperators::Dict{String,Vector{Vector{ComplexF64}}}
1515
correlationFunctions::Dict{String,Vector{Matrix{ComplexF64}}}
16+
maxBondDimension::Vector{Int64}
1617
end
1718

1819
function buildGatesTEBD1(model::Model, dt::Float64)::Vector{ITensor}
@@ -64,6 +65,8 @@ function storeTEBDResult(file::String, result::TEBDResults)
6465
HDF5.write(grpCorrelationFunctions, name, mat)
6566
end
6667

68+
HDF5.write(fptr, "max_bond_dimension", result.maxBondDimension)
69+
6770
HDF5.close(fptr)
6871
end
6972

@@ -95,7 +98,8 @@ function runTEBD(psi0::MPS, model::Model, options::TEBDOptions)::TEBDResults
9598
Float64[],
9699
Dict{String,Tuple{Vector{ComplexF64},Vector{ComplexF64},Vector{ComplexF64}}}(),
97100
Dict{String,Vector{Vector{ComplexF64}}}(),
98-
Dict{String,Vector{Matrix{ComplexF64}}}()
101+
Dict{String,Vector{Matrix{ComplexF64}}}(),
102+
Int64[]
99103
)
100104

101105
push!(results.time, time)
@@ -107,6 +111,7 @@ function runTEBD(psi0::MPS, model::Model, options::TEBDOptions)::TEBDResults
107111
push!(results.observables[observable.name][1], values[1])
108112
push!(results.observables[observable.name][2], values[2])
109113
push!(results.observables[observable.name][3], values[3])
114+
push!(results.maxBondDimension, maxlinkdim(psi))
110115
end
111116

112117
# measure initial local operators
@@ -121,6 +126,8 @@ function runTEBD(psi0::MPS, model::Model, options::TEBDOptions)::TEBDResults
121126
push!(results.correlationFunctions[correlationFunction.name], expect(psi, correlationFunction))
122127
end
123128

129+
maxBondDimension = 0
130+
124131
while time < options.tfinal
125132
psi = apply(gates, psi; cutoff = options.cutoff)
126133
time += options.dt
@@ -132,6 +139,8 @@ function runTEBD(psi0::MPS, model::Model, options::TEBDOptions)::TEBDResults
132139
push!(results.observables[observable.name][1], values[1])
133140
push!(results.observables[observable.name][2], values[2])
134141
push!(results.observables[observable.name][3], values[3])
142+
maxBondDimension = maxlinkdim(psi)
143+
push!(results.maxBondDimension, maxBondDimension)
135144
end
136145

137146
# measure initial local operators
@@ -149,6 +158,7 @@ function runTEBD(psi0::MPS, model::Model, options::TEBDOptions)::TEBDResults
149158
timestamp = Dates.format(now(), "YYYY-mm-dd HH:MM:SS")
150159

151160
@info "$timestamp: Finished time=$time ($percentage%)"
161+
@info " max bond dimension=$maxBondDimension"
152162
end
153163

154164
return results

0 commit comments

Comments
 (0)