-
Notifications
You must be signed in to change notification settings - Fork 38
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
QuTiPv5 Paper Notebook: new Solver class and various applications of mesolve, brsolve and heom #111
base: main
Are you sure you want to change the base?
Conversation
- added simple sesolver - added mesolver for local dissipation - added mesolver for global version - added comparison to brsolver - everything supported by text from the paper
- collapse list is now created by a function and for specific hamiltonians - fixed variable names to fit 80 char width - fixed typos
- fixed many typos and errors - rewrote much in own words - added reference section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Langhaarzombie this looks great. Left a few comments and suggestions.
## Testing | ||
|
||
```python | ||
# test sesolve gives the same result as SESolver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess checking long-time limit of global ME is close to ground state, and that global and brmesolve produce similar results in that example, is enough?
```python | ||
t = 0 | ||
dt = 40 / 100 | ||
se_solver2 = SESolver(H) | ||
se_solver2.start(psi0, t) | ||
while t < 40: | ||
t = t + dt | ||
psi = se_solver2.step(t) | ||
# process the result psi and calculate next time step | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is a bit meh to be honest (it is from me 🙂), and it doesn't really show the args
stuff that the text above it discusses... Not sure what to do about it
```python | ||
plt.plot(tlist_fine, me_local_res.expect[0], label="i=1") | ||
plt.plot(tlist_fine, me_local_res.expect[1], label="i=2") | ||
plt.xlabel("Time") | ||
plt.ylabel(r"$\langle \sigma_z^{(i)} \rangle$") | ||
plt.legend() | ||
plt.show() | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this plot something with manual_res
?
```python | ||
plt.plot(tlist, adi_me_res.expect[0], "-", label="mesolve") | ||
plt.plot(tlist, np.real(results_corr_fit.expect[0]), '--', label=r'heomsolve') | ||
plt.plot(tlist, brme_result.expect[0], ":", linewidth=6, | ||
label="brmesolve non-flat") | ||
plt.plot(tlist, brme_result2.expect[0], ":", linewidth=6, label="brmesolve") | ||
|
||
plt.xlabel(r"$t\, /\, \Delta^{-1}$", fontsize=18) | ||
plt.ylabel(r"$\langle \sigma_z \rangle$", fontsize=18) | ||
plt.legend() | ||
plt.show() | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is maybe not obvious how to do that, I have added the HEOM part using the new environment module. However, I am confused that the plot looks a bit different from the one in the paper... I must have missed some parameter, but couldn't immediately find what I am missing
``` | ||
|
||
```python | ||
# HEOM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the parameter gamma
is slightly changed we need to refit the heom bath here, i.e., have again:
max_depth = 4 # number of hierarchy levels
wsamp = 2 * np.pi
w0 = 5 * 2 * np.pi
gamma_heom = 1.9 * w0
lambd = np.sqrt(
0.5 * gamma / (gamma_heom * wsamp)
* ((w0**2 - wsamp**2) ** 2 + (gamma_heom**2) * ((wsamp) ** 2))
)
# Create Environment
bath = UnderDampedEnvironment(lam=lambd, w0=w0, gamma=gamma_heom, T=1e-10)
fit_times = np.linspace(0, 5, 1000) # range for correlation function fit
# Fit correlation function with exponentials
exp_bath, fit_info = bath.approx_by_cf_fit(fit_times, Ni_max=1, Nr_max=2, target_rsme=None)
print(fit_info["summary"])
- adjusted formatting acc. to repo specs - added Paul as author - streamlined equation formatting
This notebook includes the examples in the qutip v5 paper that are found in section 3.2 up until (and including) 3.3.4.
The PR remains as a draft for now as much of the code needed to generate the last few plots that are connected to the HEOM environment. See PR #2534 in the main qutip repo.
Therefore the things left to do are: