Skip to content

Commit

Permalink
Fix some docstrings and comments in bofin_solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlambert committed Dec 22, 2024
1 parent 50dc67a commit 8946824
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions qutip/solver/heom/bofin_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,18 +990,25 @@ def _calculate_rhs(self):
if self.L_sys.isconstant:
# For the constant case, we just add the Liouvillian to the
# diagonal blocks of the RHS matrix.
# Note: Any time-dependent terms from input/output exponents
# are included in rhs_mat_t
rhs_mat += _data.kron(h_identity, self.L_sys(0).to("csr").data)
rhs = QobjEvo(Qobj(rhs_mat, dims=rhs_dims))+ rhs_mat_td
rhs = QobjEvo(Qobj(rhs_mat, dims=rhs_dims)) + rhs_mat_td
else:
# In the time dependent case, we construct the parameters
# In the 'system' time dependent case, we construct the parameters
# for the ODE gradient function under the assumption that
#
# RHSmat(t) = RHSmat + time dependent terms that only affect the
# diagonal blocks of the RHS matrix.
# RHSmat(t) = RHSmat + rhs_mat_td from input/output terms
# + time dependent terms that only affect the
# diagonal blocks of the RHS matrix
#
# This assumption holds because only _grad_n dependents on
# the system Liouvillian (and not _grad_prev or _grad_next) and
# the bath coupling operators are not time-dependent.
# most bath coupling operators are not time-dependent.

#Assuming full time-dependence for all bath coupling operators is
#very costly for large problems, so we avoid that for the moment.

rhs = QobjEvo(Qobj(rhs_mat, dims=rhs_dims)) + rhs_mat_td

def _kron(x):
Expand Down Expand Up @@ -1471,7 +1478,8 @@ def gather(self):

def gather_td(self):
""" Create the HEOM liouvillian from a sorted list of smaller sparse
matrices.
matrices with time-dependent coeffecients. Used by input and output
exponents.
.. note::
Expand All @@ -1484,12 +1492,16 @@ def gather_td(self):
Returns
-------
rhs : :obj:`Data`
A combined matrix of shape ``(block * nhe, block * ne)``.
rhs : :obj:`QobjEvo`
A combined QobjEvo of shape ``(block * nhe, block * ne)``
containing time-dependent input/output couplings.
"""

self._ops_td.sort(key=lambda x: x[4])
RHStemp = 0
#we group terms by 'exponent'/TD funct given by 'kpos'
#and add them together. Most efficient construction
#we could find for the moment.

for k, ops in groupby(self._ops_td, key=lambda x: x[4]):
ops = np.array(list(ops), dtype=[
Expand Down

0 comments on commit 8946824

Please sign in to comment.