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

Segmentation fault whenever more than 2 CVs are used for METAD with REWEIGHTING_NGRID #328

Closed
OleinikovasV opened this issue Jan 9, 2018 · 3 comments

Comments

@OleinikovasV
Copy link

PLUMED consistently breaks at a REWEIGHTING_NHILLS step whenever I run METAD with REWEIGHTING_NGRID using more than two arguments (it works fine with one and two). Does not drop any useful error messages other than "Segmentation fault".
I need this to obtain configuration weights using REWEIGHT_METAD for my simulation of METAD using 3 CVs.

@valsson
Copy link
Contributor

valsson commented Jan 9, 2018

Hello,

I have a feeling what might be the problem. Can you do the changes shown here, recompile and check if it works.

Omar

@ladislav-hovan
Copy link
Contributor

Hi Omar,

I was also looking at this issue, and with the changes you've suggested, the "Segmentation fault" message is replaced by "Floating point exception (core dumped)". However, I've noticed something else - on line 1862, an attempt is made to access the (i-1)th element of the rewf_grid_. The variable i starts with the value of rank, and there is no reason why it can't be zero. Indeed, if plumed is compiled without MPI, it will always be zero. This would instantly cause the segfault to happen (accessing the -1st element of the array). However, since I'm not sure about how the formula works, I am unable to fix it.

Ladislav

@riccardocapelli
Copy link
Contributor

Hi all,

I have the same problem as ladislav, and the fix suggested by Omar does not work. There is a way to overcome this problem?

Thank you!

Riccardo

fiskissimo added a commit to fiskissimo/plumed2 that referenced this issue Oct 17, 2018
…ith REWEIGHTING_NGRID plumed#328

I tried to interpret and fix the code and for me it works nicely with 1 to 3 CVs. 
Here a brief description: the index i spans through the whole reweghting-grid (according to the mpi rank in case of mpi).
rewf_grid_ contains the size on each dimension of the reweghting-grid. t_index is the array containing the coordinates of i in each dimension of the grid. The indexes had to be changed from i to j in line 1967, which indeed spans correctly the dimensions of the grid. In 1968 in order to get the correct index, we need to subtract the former index (ncv-2 -- instead of "ncv-1" which is yet not assigned -- from what is left of kk).

I didn't attempt any further test.

Please let me know if I had misinterpreted the code.
GiovanniBussi pushed a commit that referenced this issue Dec 17, 2018
…ith REWEIGHTING_NGRID #328

I tried to interpret and fix the code and for me it works nicely with 1 to 3 CVs.
Here a brief description: the index i spans through the whole reweghting-grid (according to the mpi rank in case of mpi).
rewf_grid_ contains the size on each dimension of the reweghting-grid. t_index is the array containing the coordinates of i in each dimension of the grid. The indexes had to be changed from i to j in line 1967, which indeed spans correctly the dimensions of the grid. In 1968 in order to get the correct index, we need to subtract the former index (ncv-2 -- instead of "ncv-1" which is yet not assigned -- from what is left of kk).

I didn't attempt any further test.

Please let me know if I had misinterpreted the code.

Fixes #399
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

No branches or pull requests

5 participants