@@ -13,10 +13,11 @@ struct JordanMPO_AC_Hamiltonian{O1,O2,O3} <: DerivativeOperator
1313 A:: O3 # continuing
1414 function JordanMPO_AC_Hamiltonian (onsite, not_started, finished, starting, ending,
1515 continuing)
16- tensor = coalesce (onsite, not_started, finished, starting, ending)
17- ismissing (tensor) && throw (ArgumentError (" unable to determine type" ))
18- S = spacetype (tensor)
19- M = storagetype (tensor)
16+ # obtaining storagetype of environments since these should have already mixed
17+ # the types of the operator and state
18+ gl = continuing[1 ]
19+ S = spacetype (gl)
20+ M = storagetype (gl)
2021 O1 = tensormaptype (S, 1 , 1 , M)
2122 O2 = tensormaptype (S, 2 , 2 , M)
2223 return new {O1,O2,typeof(continuing)} (onsite, not_started, finished, starting,
@@ -46,10 +47,11 @@ struct JordanMPO_AC2_Hamiltonian{O1,O2,O3,O4} <: DerivativeOperator
4647 DE:: Union{O1,Missing} # onsite left
4748 EE:: Union{O1,Missing} # finished
4849 function JordanMPO_AC2_Hamiltonian (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
49- tensor = coalesce (II, IC, ID, CB, CA, AB, AA, BE, DE, EE)
50- ismissing (tensor) && throw (ArgumentError (" unable to determine type" ))
51- S = spacetype (tensor)
52- M = storagetype (tensor)
50+ # obtaining storagetype of environments since these should have already mixed
51+ # the types of the operator and state
52+ gl = AA[1 ]
53+ S = spacetype (gl)
54+ M = storagetype (gl)
5355 O1 = tensormaptype (S, 1 , 1 , M)
5456 O2 = tensormaptype (S, 2 , 2 , M)
5557 O3 = tensormaptype (S, 3 , 3 , M)
@@ -107,7 +109,9 @@ function AC_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
107109 end
108110
109111 # not_started
110- if (! isfinite (operator) || site < length (operator)) && ! ismissing (starting)
112+ if isfinite (operator) && site == length (operator)
113+ not_started = missing
114+ elseif ! ismissing (starting)
111115 I = id (storagetype (GR[1 ]), physicalspace (W))
112116 @plansor starting[- 1 - 2 ; - 3 - 4 ] += I[- 1 ; - 3 ] * removeunit (GR[1 ], 2 )[- 4 ; - 2 ]
113117 not_started = missing
@@ -116,7 +120,9 @@ function AC_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
116120 end
117121
118122 # finished
119- if (! isfinite (operator) || site > 1 ) && ! ismissing (ending)
123+ if isfinite (operator) && site == 1
124+ finished = missing
125+ elseif ! ismissing (ending)
120126 I = id (storagetype (GL[end ]), physicalspace (W))
121127 @plansor ending[- 1 - 2 ; - 3 - 4 ] += removeunit (GL[end ], 2 )[- 1 ; - 3 ] * I[- 2 ; - 4 ]
122128 finished = missing
@@ -241,7 +247,9 @@ function AC2_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
241247 end
242248
243249 # finished
244- if ! ismissing (IC)
250+ if isfinite (operator) && site + 1 == length (operator)
251+ II = missing
252+ elseif ! ismissing (IC)
245253 I = id (storagetype (GR[1 ]), physicalspace (W2))
246254 @plansor IC[- 1 - 2 ; - 3 - 4 ] += I[- 1 ; - 3 ] * removeunit (GR[1 ], 2 )[- 4 ; - 2 ]
247255 II = missing
@@ -254,7 +262,9 @@ function AC2_hamiltonian(site::Int, below::_HAM_MPS_TYPES,
254262 end
255263
256264 # unstarted
257- if ! ismissing (BE)
265+ if isfinite (operator) && site == 1
266+ EE = missing
267+ elseif ! ismissing (BE)
258268 I = id (storagetype (GL[end ]), physicalspace (W1))
259269 @plansor BE[- 1 - 2 ; - 3 - 4 ] += removeunit (GL[end ], 2 )[- 1 ; - 3 ] * I[- 2 ; - 4 ]
260270 EE = missing
0 commit comments