MobleyLab / alchemical-analysis

An open tool implementing some recommended practices for analyzing alchemical free energy calculations
MIT License
113 stars 58 forks source link

Pymbar can't estimate bound on free energy #49

Open nhoutz1 opened 8 years ago

nhoutz1 commented 8 years ago

I have performed a bunch of thermodynamic-integration simulations for liquid water in Gromacs, and am trying to analyze the .xvg files. I'm using Windows 10 and installed Anaconda2 (64 bit) with the gui installer and then pymbar through Anaconda2 before downloading alchemical-analysis-master.

In a Windows command prompt, I entered:

python alchemical_analysis.py -d C:\ -t 200 -p 1 -v > results

This is the result: Traceback (most recent call last): File "alchemical_analysis.py", line 1224, in main() File "alchemical_analysis.py", line 1166, in main nsnapshots, lv, dhdlt, u_klt = parser_gromacs.readDataGromacs(P) File "C:<...>\alchemical-analysis-master\alchemical_analysis\parser_gromacs.py", line 187, in readDataGromacs fs = sorted(fs, key=F.sortedHelper) File "C:<...>\alchemical-analysis-master\alchemical_analysis\parser_gromacs.py", line 48, in sortedHelper self.state = l[0] = int(l[0]) # Will be of use for selective MBAR analysis. IndexError: list index out of range

where <...> is just the directory to which I downloaded alchemical-analysis-master. I don't understand the error and cannot find help for it online. In the directory where I have the .xvg files, all the files are simply named integers: 0.xvg, 1.xvg, 2.xvg, .... 20.xvg, and there are no other files in that folder. Am I calling the script correctly? Could it be the operating system (Windows vs. Linux)? I might be able to get on a Linux machine if it would help.

davidlmobley commented 8 years ago

Can you attach (i.e. via Dropbox or Google drive) your xvg files?

Also, it could be a naming issue - I think we're expecting xvg files to have names with a dot notation, i.e. "name.0.xvg", "name.1.xvg", or MAYBE '0.xvg', '1.xvg', etc. But "0xvg" and "1xvg" will probably not work.

Let us know!

On Tue, Dec 15, 2015 at 9:59 PM, nhoutz1 notifications@github.com wrote:

I have performed a bunch of thermodynamic-integration simulations for liquid water in Gromacs, and am trying to analyze the xvg files I'm using Windows 10 and installed Anaconda2 (64 bit) with the gui installer and then pymbar through Anaconda2 before downloading alchemical-analysis-master

In a Windows command prompt, I entered:

python alchemical_analysispy -d C:\ -t 200 -p 1 -v > results

This is the result: Traceback (most recent call last): File "alchemical_analysispy", line 1224, in main() File "alchemical_analysispy", line 1166, in main nsnapshots, lv, dhdlt, u_klt = parser_gromacsreadDataGromacs(P) File "C:<>\alchemical-analysis-master\alchemical_analysis\parser_gromacspy", line 187, in readDataGromacs fs = sorted(fs, key=FsortedHelper) File "C:<>\alchemical-analysis-master\alchemical_analysis\parser_gromacspy", line 48, in sortedHelper selfstate = l[0] = int(l[0]) # Will be of use for selective MBAR analysis IndexError: list index out of range

where <> is just the directory to which I downloaded alchemical-analysis-master I don't understand the error and cannot find help for it online In the directory where I have the xvg files, all the files are simply named integers: 0xvg, 1xvg, 2xvg, 20xvg, and there are no other files in that folder Am I calling the script correctly? Could it be the operating system (Windows vs Linux)? I might be able to get on a Linux machine if it would help

— Reply to this email directly or view it on GitHub https://github.com/MobleyLab/alchemical-analysis/issues/49.

David Mobley Associate Professor Department of Pharmaceutical Sciences Department of Chemistry 3134B Natural Sciences I University of California, Irvine Irvine, CA 92697 dmobley@uci.edu work (949) 824-6383 cell (949) 385-2436

nhoutz1 commented 8 years ago

Sure, I uploaded my .xvg files here: https://drive.google.com/folderview?id=0B6lGyVspwiohb2Q5eGpmRG05b3M&usp=sharing. And they do have dots in the names but I can see in your email reply the dots didn't show up for you. I tried renaming everything 'a.0.xvg', 'a.1.xvg' etc. but then the error became:

ERROR! No files found within directory 'C:' with prefix '1' and suffix 'xvg': check your inputs.

Thinking the code might be upset by the fact that my names begin with 0 (gromacs convention) instead of 1, I tried excluding 0.xvg by moving it to another folder to see if it would run but I got the same error as before where something complains when it tries to access the 0th (1st?) index of some array.

Thank you for your help!

davidlmobley commented 8 years ago

No, we use numbering beginning with 0/1 as well.

Could you provide the exact command you use to alchemical_analysis when you used the prefix "a"? I'm assuming that in the case you mentioned ("a.0.xvg", "a.1.xvg", etc.) you DID remember to use the -p option to specify "-p a"? (The option "-p 1" in your original case is incorrect, as this should be the prefix BEFORE the variable digits and .xvg extension.)

If so, then it's probably an issue where we need to fix something to play nice with Windows. Once I have the command you ran, I can test under Linux or OS X to confirm that everything works, and if it does it would mean it's an issue with path handling under windows.

Thanks.

On Wed, Dec 16, 2015 at 5:26 PM, nhoutz1 notifications@github.com wrote:

Sure, I uploaded my .xvg files here: https://drive.google.com/folderview?id=0B6lGyVspwiohb2Q5eGpmRG05b3M&usp=sharing. And they do have dots in the names but I can see in your email reply the dots didn't show up for you. I tried renaming everything 'a.0.xvg', 'a.1.xvg' etc. but then the error became:

ERROR! No files found within directory 'C:' with prefix '1' and suffix 'xvg': check your inputs.

Thinking the code might be upset by the fact that my names begin with 0 (gromacs convention) instead of 1, I tried excluding 0.xvg by moving it to another folder to see if it would run but I got the same error as before where something complains when it tries to access the 0th (1st?) index of some array.

Thank you for your help!

— Reply to this email directly or view it on GitHub https://github.com/MobleyLab/alchemical-analysis/issues/49#issuecomment-165308459 .

David Mobley dmobley@gmail.com 949-385-2436

nhoutz1 commented 8 years ago

That was the issue! I thought the -p flag was for pressure, not prefix. I think it used to be, anyway, and that is what it says in the old tutorial that I linked in my original post. I thought I was telling the program that my system was at 1 atmosphere, hence the '-p 1' which I did not change when I used the 'a.#.xvg' naming convention. Sorry, I should have read through all the flags on the main page.

Unfortunately, I now get a new error. Calling it like this:

python alchemical_analysis.py -d C:\ -t 200 -p a -v > results

Results in this: C:\Anaconda2\lib\site-packages\pymbar\utils.py:70: FutureWarning: comparison to None will result in an elementwise object comparison in the future. if N_k == None: C:\Anaconda2\lib\site-packages\pymbar\utils.py:320: RuntimeWarning: invalid value encountered in log out = np.log(numexpr.evaluate("exp(a - a_max)").sum(axis)) Traceback (most recent call last): File "alchemical_analysis.py", line 1224, in main() File "alchemical_analysis.py", line 1200, in main Deltaf_ij, dDeltaf_ij = estimatewithMBAR(u_kln, N_k, P.relative_tolerance, regular_estimate=True) File "alchemical_analysis.py", line 282, in estimatewithMBAR MBAR = pymbar.mbar.MBAR(u_kln, N_k, verbose = P.verbose, relative_tolerance = reltol, initialize = P.init_with) File "C:\Anaconda2\lib\site-packages\pymbar\mbar.py", line 257, in init self._initializeFreeEnergies(verbose, method=initialize) File "C:\Anaconda2\lib\site-packages\pymbar\mbar.py", line 1622, in _initializeFreeEnergies w_F, w_R, relative_tolerance=0.000001, verbose=False, compute_uncertainty=False) File "C:\Anaconda2\lib\site-packages\pymbar\bar.py", line 317, in BAR raise BoundsError(message) pymbar.utils.BoundsError: WARNING: Cannot determine bound on free energy