Skip to content

Commit d7e8860

Browse files
pbrehmerleburgel
andauthored
Make C4v rotation and reflection symmetry checks into warnings (#385)
* Make rotation and hermitian reflection errors into warnings * Catch errors in case spaces change in C4v input check * Replace error in _check_algorithm_combintion with warning --------- Co-authored-by: leburgel <lander.burgelman@gmail.com>
1 parent bae5188 commit d7e8860

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/algorithms/ctmrg/c4v.jl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,19 @@ function check_input(
118118
west_virtualspace(O) == _elementwise_dual(north_virtualspace(O)) ||
119119
throw(ArgumentError("C4v CTMRG requires south and west virtual space to be the dual of north and east virtual space."))
120120
# check rotation invariance of the local tensors, with the exact spaceflips we assume
121-
_isapprox_localsandwich(O, flip_virtualspace(_rotl90_localsandwich(O), [EAST, WEST]); atol = atol) ||
122-
throw(ArgumentError("C4v CTMRG requires the local tensors to be invariant under 90° rotation."))
121+
is_rotation_invariant = try
122+
_isapprox_localsandwich(O, flip_virtualspace(_rotl90_localsandwich(O), [EAST, WEST]); atol)
123+
catch
124+
false # _isapprox_localsandwich errors if the symmetry action changes the spaces (e.g. in case of non self-dual irreps)
125+
end
126+
is_rotation_invariant || @warn("The local tensors are not invariant under 90° rotation. In general, C4v CTMRG is not expected to work in this case.")
123127
# check the hermitian reflection invariance of the local tensors, with the exact spaceflips we assume
124-
_isapprox_localsandwich(
125-
O,
126-
flip_physicalspace(flip_virtualspace(herm_depth(O), [EAST, WEST]));
127-
atol = atol
128-
) ||
129-
throw(ArgumentError("C4v CTMRG requires the local tensors to be invariant under hermitian reflection."))
128+
is_herm_reflection_invariant = try
129+
_isapprox_localsandwich(O, flip_physicalspace(flip_virtualspace(herm_depth(O), [EAST, WEST])); atol)
130+
catch
131+
false
132+
end
133+
is_herm_reflection_invariant || @warn("The local tensors are not invariant under hermitian reflection. In general, C4v CTMRG is not expected to work in this case.")
130134
# TODO: check compatibility of network and environment spaces in general?
131135
return nothing
132136
end

src/algorithms/optimization/fixed_point_differentiation.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ function _check_algorithm_combination(::SequentialCTMRG, ::FixedPointGradient)
188188
end
189189
function _check_algorithm_combination(::C4vCTMRG, symm::Union{Nothing, <:SymmetrizationStyle})
190190
if !(symm isa RotateReflect)
191-
msg = "C4vCTMRG optimization is compatible only with RotateReflect symmetrization. \
192-
Make sure to set `symmetrization = RotateReflect()`."
193-
throw(ArgumentError(msg))
191+
msg = "C4vCTMRG optimization is compatible only with combined Hermitian reflection and rotation symmetrization. \
192+
Make sure to set `symmetrization = RotateReflect()` or implement an equivalent custom symmetrization scheme."
193+
@warn msg
194194
end
195195
return nothing
196196
end

0 commit comments

Comments
 (0)