MobleyLab / alchemical-analysis

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

index out of bounds error with some values of bForwrev #64

Closed matteoaldeghi closed 8 years ago

matteoaldeghi commented 8 years ago

I find that when using certain values with the flag "-f", I get an index out of bounds error because the array ts in the function dF_t() is one element longer than expected. I found this issue with -f values of 6 or 28 so far.

I believe it has to do with the fact the array tf is defined with numpy.arange: tf = numpy.arange(0,1+increment,increment)_(max(nsnapshots)-1)+1 In some cases (like for 6 or 28) it seems that the 'stop' (1+increment) element is included in the array, later on resulting in a ts array that is one element longer than expected, and with ts[-1] having a time over the end time of the simulation. I imagine it could be a problem related to the representation of floating numbers, and possibly replacing arange with linspace might be enough to solve the issue: tf = numpy.linspace(0.0, 1.0, ntf)(max(nsnapshots)-1)+1

davidlmobley commented 8 years ago

Can you provide some sample data to reproduce this? We've not run into this yet and a fix will be simpler if we can reproduce the problem.

On Wed, Jan 13, 2016 at 2:54 AM, MatteoA notifications@github.com wrote:

I find that when using certain values with the flag "-f", I get an index out of bounds error because the array ts in the function dF_t() is one element longer than expected I found this issue with -f values of 6 or 28 so far

I believe it has to do with the fact the array tf is defined with numpyarange: tf = numpyarange(0,1+increment,increment)

_(max(nsnapshots)-1)+1 In some cases (like for 6 or 28) it seems that the 'stop' (1+increment) element is included in the array, later on resulting in a ts array that is one element longer than expected, and with ts[-1] having a time over the end time of the simulation I imagine it could be a problem related to the representation of floating numbers, and possibly replacing arange with linspace might be enough to solve the issue: tf = numpylinspace(00, 10, ntf)(max(nsnapshots)-1)+1

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

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

matteoaldeghi commented 8 years ago

Of course, here are the xvg files with the first 0.5ns of some data I was looking at: https://www.dropbox.com/sh/1xngv1t3isx7a23/AACvL9zB6n12lbC78Ywpspy1a?dl=0

davidlmobley commented 8 years ago

Should be resolved by #72 . Can you check?

matteoaldeghi commented 8 years ago

Just checked, this seems resolved now indeed.

davidlmobley commented 8 years ago

Marking as closed.