Skip to content

Commit

Permalink
Solved bug in matrix time dependent FD method
Browse files Browse the repository at this point in the history
  • Loading branch information
OtiDioti authored Feb 5, 2025
1 parent 800c6aa commit b405b35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sympt/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def __checks_and_prepare_solver(self, method, mask, max_order=2):
self.__H_old = (self.H_input + self.V_input).expand()
# Set the perturbative interaction to zero
self.__V_old = S.Zero


if method != 'FD' and method != 'SW' and mask is not None:
# Add the Hermitian conjugate and the blocks to the mask. This ensures that the mask is Hermitian
Expand Down Expand Up @@ -521,7 +522,10 @@ def __checks_and_prepare_solver(self, method, mask, max_order=2):
if not mulgroup.is_t_periodic():
raise ValueError("Non periodic time dependencies are not yet supported")
###################################################
freqs_orders = [get_order(exponential.args[0])[0] for exponential in (self.__H_old + self.__V_old).atoms(exp) if exponential.has(t)]
if method == "SW":
freqs_orders = [get_order(exponential.args[0])[0] for exponential in (self.__H_old + self.__V_old).atoms(exp) if exponential.has(t)]
else:
freqs_orders = [get_order(exponential.args[0])[0] for exponential in self.__H_old.atoms(exp) if exponential.has(t)]

if len(set(freqs_orders)) > 1:
raise ValueError('The Hamiltonian contains multiple frequencies with different orders. This is not supported yet.')
Expand Down

0 comments on commit b405b35

Please sign in to comment.