Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new store_density_matricies Result option #2303

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/2303.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only pre-compute density matricies if keep_runs_results is False
14 changes: 11 additions & 3 deletions qutip/solver/heom/bofin_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _post_init(self):

self.store_ados = self.options["store_ados"]
if self.store_ados:
self.final_ado_state = None
self._final_ado_state = None
self.ado_states = []

def _e_op_func(self, e_op):
Expand All @@ -407,9 +407,17 @@ def _store_state(self, t, ado_state):
self.ado_states.append(ado_state)

def _store_final_state(self, t, ado_state):
self.final_state = ado_state.rho
self._final_state = ado_state.rho
if self.store_ados:
self.final_ado_state = ado_state
self._final_ado_state = ado_state

@property
def final_ado_state(self):
if self._final_ado_state is not None:
return self._final_state
if self.ado_states:
return self.ado_states[-1]
return None


def heomsolve(
Expand Down
5 changes: 3 additions & 2 deletions qutip/solver/mcsolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class _MCSystem(_MTSystem):
"""
Container for the operators of the solver.
"""

def __init__(self, rhs, c_ops, n_ops):
self.rhs = rhs
self.c_ops = c_ops
Expand Down Expand Up @@ -247,8 +248,8 @@ def set_state(self, t, state0, generator,
self.target_norm = 0.0
else:
self.target_norm = (
self._generator.random() * (1 - jump_prob_floor)
+ jump_prob_floor
self._generator.random() * (1 - jump_prob_floor)
+ jump_prob_floor
)
self._integrator.set_state(t, state0)
self._is_set = True
Expand Down