Skip to content

Commit a830496

Browse files
committed
more rework of convert to complex
1 parent e20408b commit a830496

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/algorithms/derivatives/hamiltonian_derivatives.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ function JordanMPO_AC2_Hamiltonian(GL::MPSTensor, W1::JordanMPOTensor, W2::Jorda
197197
# starting left - ending right
198198
CB = if nonzero_length(W1.C) > 0 && nonzero_length(W2.B) > 0
199199
@plansor CB_[-1 -2; -3 -4] ≔ W1.C[-1; -3 1] * W2.B[1 -2; -4]
200-
only(CB_)
200+
# have to convert to complex if hamiltonian is real but states are complex
201+
scalartype(GL) <: Complex ? complex(only(CB_)) : only(CB_)
201202
else
202203
missing
203204
end
@@ -258,8 +259,7 @@ function JordanMPO_AC2_Hamiltonian(GL::MPSTensor, W1::JordanMPOTensor, W2::Jorda
258259

259260
return JordanMPO_AC2_Hamiltonian{O1, O2, O3, O4}(
260261
II, IC, ID,
261-
convert(O2, CB), # might have real eltype
262-
CA,
262+
CB, CA,
263263
AB, AA,
264264
BE, DE, EE
265265
)

0 commit comments

Comments
 (0)