Skip to content

Commit

Permalink
Update flimesolve.py
Browse files Browse the repository at this point in the history
Forgot to turn the returned Floquet States into a Qobj. Fixed that.
  • Loading branch information
magnamancer committed Apr 29, 2024
1 parent 4e5a62c commit feda016
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions qutip/solver/flimesolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def _floquet_rate_matrix(floquet_basis, Nt, c_ops, time_sense=0):
timet = floquet_basis.T
dt = timet / Nt
tlist = np.linspace(0, timet - dt, Nt)
omega = (2 * np.pi) / floquet_basis.T # Frequency dependence of Hamiltonian
omega = (
2 * np.pi
) / floquet_basis.T # Frequency dependence of Hamiltonian

total_R_tensor = defaultdict(lambda: 0)
for cdx, c_op in enumerate(c_ops):
Expand Down Expand Up @@ -251,7 +253,10 @@ def flimesolve(
dt = tlist[1] - tlist[0]
tlist_zeroed = tlist - tlist[0]
Nt_finder = abs(tlist_zeroed + dt - floquet_basis.T)
Nt = list(np.where(Nt_finder == np.amin(Nt_finder)))[0][0] + 1
Nt = (
list(np.where(Nt_finder == np.amin(Nt_finder)))[0][0]
+ 1
)
else:
Nt = 2**4
options["Nt"] = Nt
Expand Down Expand Up @@ -314,7 +319,9 @@ def _floquet_state_table(floquet_basis, tlist):
dims = len(floquet_basis.e_quasi)

taulist_test = np.array(tlist) % floquet_basis.T
taulist_correction = np.argwhere(abs(taulist_test - floquet_basis.T) < 1e-10)
taulist_correction = np.argwhere(
abs(taulist_test - floquet_basis.T) < 1e-10
)
taulist_test_new = np.round(taulist_test, 10)
taulist_test_new[taulist_correction] = 0

Expand Down Expand Up @@ -459,7 +466,10 @@ def _create_rhs(self, rate_matrix_dictionary):
Rate_Qobj_list = {
key: Qobj(
rate_matrix_dictionary[key],
dims=[self.floquet_basis.U(0).dims, self.floquet_basis.U(0).dims],
dims=[
self.floquet_basis.U(0).dims,
self.floquet_basis.U(0).dims,
],
copy=False,
).to("csr")
for key in rate_matrix_dictionary
Expand Down Expand Up @@ -631,14 +641,17 @@ def run(
sols_comp = [
Qobj(
_data.Dense(state),
dims=[self.floquet_basis.U(0).dims[0], self.floquet_basis.U(0).dims[0]],
dims=[
self.floquet_basis.U(0).dims[0],
self.floquet_basis.U(0).dims[0],
],
copy=False,
)
for state in sols_comp_arr
]

for idx, state in enumerate(sols_comp):
results.add(tlist[idx], state, fstates_table[idx])
results.add(tlist[idx], state, Qobj(fstates_table[idx]))

stats["run time"] = time() - _time_start
return results
Expand Down

0 comments on commit feda016

Please sign in to comment.