-
Notifications
You must be signed in to change notification settings - Fork 92
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
Enthalpic and Entropic Contributions from BAR #540
Conversation
The derivation in this paper is not really correct, or rather, it has a chunk of extra stuff whose expectation is zero and adds noise to the calculation (I talked to them a while back about this). Are there reasons the existing MBAR tools for entropy and enthalpy aren't useful/working? Or just not exposed correctly? (i.e. MBAR with 2 states gives the same expectations as BAR, you use the 2 state MBAR entropy/enthalpy calculations). |
@mrshirts It's exposed fine, but I have a use case where the free estimate from MBAR isn't aligning with BAR and TI estimates which are in close agreement to each other. I then decided to stick with BAR but still want the enthalpy/entropy contributions. That's a good point about the 2-state MBAR, I'll check that out. |
This PR also contains some small changes to improve documentation and removing someone's .vscode settings. I can close this PR and open another one with those. Alternatively, if the derivation is somewhat correct, can we adapt it to be completely correct? |
BAR and MBAR not agreeing in value would generally indicate there is either something suspicious with the data or the solver isn't working correctly. I would be happy to take a look if that's the case! Also BAR and MBAR have DIFFERENT error estimates (i.e. if you do 2-state MBAR and BAR you should get the SAME number, but DIFFERENT error estimates, especially for poor overlap), and that is something that I have been working to address. Bootstrap errors will be the same (and somewhere in between the analytical error estimates) |
IIRC (it's been quite a while since I worked through it), it has a term whose expectation is zero - if you leave that term out, it's the same as the MBAR 2-state entropy/enthalpy estimate. |
That would be great! |
That does sound like a good check. Makes me wonder if this is something that we are testing in our CI or unit tests. If not, maybe that's also worth adding to the tests. |
@mrshirts @ijpulidos I implemented the option to output the enthalpy/entropy for MBAR and BAR (via 2-state MBAR) in a PR to alchemlyb. From the solvated benzene example in the tests, the free energies for MBAR and stitched 2-state MBAR are close: The entropies and enthalpies are less satisfying. |
Entropy and enthalpy are always statistically far more noisy than free energy. I wrote about 60% of paper on this a few years ago that never got finished. Did you calculate the uncertainty for these quantities, preferably by bootstrap? |
@mrshirts The previous numbers were cumulative across states. Here is the output for adjacent state values and uncertainties (default without bootstrapping), they're pretty comparable, where "BAR" is a series of 2-state MBAR computations (I haven't coded up the error propagation for BAR with bootstrapping, I would love if someone has that): Here are the values and uncertainties with n_bootstrapping = 100: |
The paper referenced in this PR covers that ;) |
You should not need to do error propagation for BAR with bootstrapping. You calculate the values (given the ENTIRE PROCESS of adding up N-1 BAR estimates) with N bootstrap samples. One of the biggest advantages of bootstrapping is avoiding error propagation. |
Something is up with those uncertainties. They should be larger than the free energy uncertainties. There are correlations between the U and the S that should be showing up. Free energies are all behaving really nicely (within uncertainties between BAR and MBAR), U and S are not. I probably won't have time to look at it today, maybe Friday or the weekend. |
I meant that I don't have the code to populate the cumulative FE matrix in alchemlyb, which is why I put the adjacent states. One can reproduce these numbers using my branch for this alchemlyb PR and the following code:
|
This PR adds a function to calculate the enthalpic and entropic contributions of the free energy from BAR according to a previously published derivation.