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

Update fep with alchemlyb and multiple edr files input #132

Merged
merged 17 commits into from
Mar 20, 2021

Conversation

VOD555
Copy link
Contributor

@VOD555 VOD555 commented Mar 17, 2021

-Use alchemlyb to calculate free energies with mbar and TI (if replace current TI calculation with alchemlyb, we should also deprecate plot function in fep.py)
-Allow multiple edr files for each fep window

@VOD555 VOD555 requested a review from orbeckst March 17, 2021 00:45
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some issues and does not contain alchemlyb yet (?)

mdpow/fep.py Outdated
@@ -693,7 +694,9 @@ def dgdl_edr(self, *args):
if not os.path.exists(fn):
logger.error("Missing dgdl.edr file %(fn)r.", vars())
raise IOError(errno.ENOENT, "Missing dgdl.edr file", fn)
return fn
edrs = glob.glob(*args + (self.deffnm + '*.edr',))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks as if it might wrongly raise an exception if there isn't a deffnm.edr file present.

How about something like (removing lines start ing at fn = ...)

pattern = os.path.join(args) + self.deffnm + '*.edr'
edrs = glob.glob(pattern)
if not edrs:
            logger.error("Missing dgdl.edr file %(pattern)r.", vars())
            raise IOError(errno.ENOENT, "Missing dgdl.edr file", pattern)
return [os.path.abspath(i) for i in edrs]

(Btw, I would be surprised if edrs = glob.glob(*args + (self.deffnm + '*.edr',)) actually worked.)

mdpow/fep.py Outdated
logger.info(" {0} --> {1}".format(edr, xvgfile))
gromacs.g_energy(s=tpr, f=edr, odh=xvgfile)
dirct = os.path.abspath(os.path.dirname(edr[0]))
total_edr = os.path.join(dirct, 'total.edr')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does total.edr come from? Why is there a hard-coded name??

At least make the name configurable as a kwarg

def dgdl_tpr(self, *args, **kwargs):
   total_edr_name = kwargs.get("total_edr_name", "total.edr")

mdpow/fep.py Outdated
dirct = os.path.abspath(os.path.dirname(edr[0]))
total_edr = os.path.join(dirct, 'total.edr')
logger.info(" {0} --> {1}".format('edrs', total_edr))
total_edr = gromacs.eneconv(f=edr, o=total_edr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is total_edr now? I don't think that GW will return a specific filename. Should probably be

Suggested change
total_edr = gromacs.eneconv(f=edr, o=total_edr)
gromacs.eneconv(f=edr, o=total_edr)

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good, especially with the tests. Some smaller things – please ping me when done & I merge and then look at mdpow-fep.

My main question is how you set self.method and self.SI and how you decide to use alchemlyb. That's important for knowing how to pass these values from the cfg file/scripts to the python API. If you add a short explanation in the comments or docs (even better) then I can attempt mdpow-fep.

mdpow/fep.py Outdated Show resolved Hide resolved
mdpow/fep.py Show resolved Hide resolved
mdpow/fep.py Outdated Show resolved Hide resolved
mdpow/fep.py Show resolved Hide resolved
mdpow/fep.py Outdated Show resolved Hide resolved
mdpow/fep.py Show resolved Hide resolved
mdpow/fep.py Outdated Show resolved Hide resolved
setup.py Show resolved Hide resolved
@orbeckst orbeckst linked an issue Mar 19, 2021 that may be closed by this pull request
@orbeckst orbeckst self-assigned this Mar 20, 2021
@orbeckst orbeckst merged commit 97f0cf6 into Becksteinlab:develop Mar 20, 2021
@orbeckst
Copy link
Member

Can you please look at #133 next? I don’t have time today to do it.

@VOD555 VOD555 deleted the new_analyze branch May 1, 2021 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement MBAR
2 participants