Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions src/algorithms/time_evolution/evoltools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,38 @@
c c+1
```
"""
function _get_gatempo_se(gate::LocalOperator, row::Int, col::Int)
Nr, Nc = size(gate.lattice)
function _get_gatempo_se(ham::LocalOperator, dt::Number, row::Int, col::Int)
Nr, Nc = size(ham)

Check warning on line 185 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L184-L185

Added lines #L184 - L185 were not covered by tests
@assert 1 <= row <= Nr && 1 <= col <= Nc
unit = id(space(gate.terms[1].second, 1))
sites = (
sites = [

Check warning on line 187 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L187

Added line #L187 was not covered by tests
CartesianIndex(row, col),
CartesianIndex(row, col + 1),
CartesianIndex(row - 1, col + 1),
)
nb1x = get_gateterm(gate, (sites[1], sites[2]))
nb1y = get_gateterm(gate, (sites[2], sites[3]))
nb2 = get_gateterm(gate, (sites[1], sites[3]))
op = (1 / 2) * (nb1x ⊗ unit + unit ⊗ nb1y) + permute(nb2 ⊗ unit, ((1, 3, 2), (4, 6, 5)))
]
nb1x = get_gateterm(ham, (sites[1], sites[2]))
nb1y = get_gateterm(ham, (sites[2], sites[3]))
nb2 = get_gateterm(ham, (sites[1], sites[3]))

Check warning on line 194 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L192-L194

Added lines #L192 - L194 were not covered by tests
# identity operator at each site
units = map(sites) do site
site_ = CartesianIndex(mod1(site[1], Nr), mod1(site[2], Nc))
return id(physicalspace(ham)[site_])

Check warning on line 198 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L196-L198

Added lines #L196 - L198 were not covered by tests
end
# when iterating through ┘, └, ┌, ┐ clusters in the unit cell,
# NN / NNN bonds are counted 4 / 2 times, respectively.
@tensor Odt[i' j' k'; i j k] :=

Check warning on line 202 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L202

Added line #L202 was not covered by tests
-dt * (
(nb1x[i' j'; i j] * units[3][k' k] + units[1][i'; i] * nb1y[j' k'; j k]) / 4 +
(nb2[i' k'; i k] * units[2][j'; j]) / 2
)
op = exp(Odt)

Check warning on line 207 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L207

Added line #L207 was not covered by tests
return gate_to_mpo3(op)
end

"""
Construct the 3-site gate MPOs on the southeast cluster
for 3-site simple update on square lattice.
"""
function _get_gatempos_se(gate::LocalOperator)
Nr, Nc = size(gate.lattice)
return collect(_get_gatempo_se(gate, r, c) for r in 1:Nr, c in 1:Nc)
function _get_gatempos_se(ham::LocalOperator, dt::Number)
Nr, Nc = size(ham.lattice)
return collect(_get_gatempo_se(ham, dt, r, c) for r in 1:Nr, c in 1:Nc)

Check warning on line 217 in src/algorithms/time_evolution/evoltools.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/evoltools.jl#L215-L217

Added lines #L215 - L217 were not covered by tests
end
2 changes: 1 addition & 1 deletion src/algorithms/time_evolution/simpleupdate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Each SU run is converged when the singular value difference becomes smaller than
$(TYPEDFIELDS)
"""
struct SimpleUpdate
dt::Float64
dt::Number
tol::Float64
maxiter::Int
trscheme::TensorKit.TruncationScheme
Expand Down
14 changes: 9 additions & 5 deletions src/algorithms/time_evolution/simpleupdate3site.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,13 @@
),
)
peps2 = deepcopy(peps)
for i in 1:2
for i in 1:4

Check warning on line 417 in src/algorithms/time_evolution/simpleupdate3site.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate3site.jl#L417

Added line #L417 was not covered by tests
for site in CartesianIndices(peps2.vertices)
r, c = site[1], site[2]
gs = gatempos[i][r, c]
_su3site_se!(r, c, gs, peps2, alg)
end
peps2 = (i == 1) ? rotl90(peps2) : rotr90(peps2)
peps2 = rotl90(peps2)

Check warning on line 423 in src/algorithms/time_evolution/simpleupdate3site.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate3site.jl#L423

Added line #L423 was not covered by tests
end
return peps2
end
Expand All @@ -432,9 +432,13 @@
peps::InfiniteWeightPEPS, ham::LocalOperator, alg::SimpleUpdate; check_interval::Int=500
)
time_start = time()
gate = get_expham(alg.dt, ham)
# convert gates to 3-site MPOs
gatempos = [_get_gatempos_se(gate), _get_gatempos_se(rotl90(gate))]
# convert Hamiltonian to 3-site exponentiated gate MPOs
gatempos = [

Check warning on line 436 in src/algorithms/time_evolution/simpleupdate3site.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/time_evolution/simpleupdate3site.jl#L436

Added line #L436 was not covered by tests
_get_gatempos_se(ham, alg.dt),
_get_gatempos_se(rotl90(ham), alg.dt),
_get_gatempos_se(rot180(ham), alg.dt),
_get_gatempos_se(rotr90(ham), alg.dt),
]
wtdiff = 1.0
wts0 = deepcopy(peps.weights)
for count in 1:(alg.maxiter)
Expand Down
4 changes: 4 additions & 0 deletions src/operators/localoperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
return O.lattice
end

function Base.size(O::LocalOperator)
return size(O.lattice)

Check warning on line 109 in src/operators/localoperator.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/localoperator.jl#L108-L109

Added lines #L108 - L109 were not covered by tests
end

# Real and imaginary part
# -----------------------
function Base.real(O::LocalOperator)
Expand Down