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
Bosonic fitting #2260
base: master
Are you sure you want to change the base?
Bosonic fitting #2260
Conversation
… created an utils class
…r spectrums for existing baths
Sorry for the delay on the docstrings and so on, I think all suggestions should be incorporated now. However, thanks to Paul's suggestion of adapting the tutorial 1e. I realized that I made a "mistake from the very beggining", namely the function used to fit the correlation function is only good if the imaginary part of the spectral density is 0 at t=0, because I'm using so No matter how many terms I take The downside is that since this function has 4 parameters, it required changing other functions as well, luckily only functions starting with _, hopefully this won't delay the PR too much. I updated the tutorials with this as well, and added a bit so that passing the parameters for the fitting is easier (after this comment), if the change is not desirable we can just go back to the commit before this comment |
…zero is not zero at t=0, but keeping it simple when it is not
… from zero to flag
@@ -0,0 +1,37 @@ | |||
|
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.
Please do not commit this file to the repo.
qutip/solver/heom/bofin_fit.py
Outdated
Note: If one of lower, upper, sigma, guesses is None, all are discarded | ||
|
||
Returns | ||
------- | ||
- A Bosonic Bath created with the fit parameters for the original | ||
spectral density function (that was provided or interpolated) | ||
- A dictionary containing the following information about the fit: |
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.
The output of this looks a bit broken (unsure how to get it right, though)
qutip/solver/heom/bofin_fit.py
Outdated
Note: If one of lower, upper, sigma, guesses is None, all are discarded | ||
|
||
Returns | ||
------- | ||
- A Bosonic Bath created with the fit parameters from the original | ||
correlation function (that was provided or interpolated). | ||
- A dictionary containing the following information about the fit: |
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.
Same formatting thing here
Somehow vscode published those review comments above before I was done reviewing. Only one more comment though: in the tests, you ignore some RuntimeWarnings here and there; it would be good to add a comment explaining why. Thank you for adding a good amount of tests! If these last minor points get addressed, this looks good to me. Only those utility functions in the |
Description
The aim of this project is to enhance the capabilities of qutip's HEOM implementation by introducing a set of tools that offer the option to simulate arbitrary spectral densities or correlation functions.
To achieve this the main idea is to fit our wanted spectral density by a set of underdamped Drude-Lorentz spectral densities or correlation functions. The idea is that the user will supply his desired spectral density or correlation function and the tools will automatically do the fit and construct the corresponding HEOM bath. Guesses ffor the fit and the number of terms will be decided automatically if the user does not specify them. To decided on the number of terms, we will used the normalized root mean square error as a measure of the goodness of the fit.
I also added functions to bosonic bath to quickly obtain the correlation function, power spectrum and spectral density for the existing bosonic baths
Note
Those tests fail because mpmath is not in the requirements, it is needed because the scipy version of the Rienmann zeta function doesn't take complex arguments (scipy/scipy#9182).
Related issues or PRs
The Qutip tutorial notebooks are updated to show this new functionality in (qutip/qutip-tutorials#72)