diff --git a/CHANGES/v2.3.md b/CHANGES/v2.3.md index 02faf2fbe870478fb5889e9de2b6f9c61ec037ed..3bd9464339c73e15925f1feeed8eaa6b8ad393a9 100644 --- a/CHANGES/v2.3.md +++ b/CHANGES/v2.3.md @@ -262,6 +262,7 @@ For users: - Fixed some openMP regression (some related to the whole codes and some specifics for Coordination and Multicolvar), this were compiler dependent so not all users may have experienced them - Fixed an issue with \ref CS2BACKBONE when more than 2 chains were used - Fixed memory leak in \ref RDC. +- Fixed segmentation fault with more than two CVs in reweighting \ref METAD (see \issue{399}, thanks to fiskissimo). For developers: - Small fix in LDFLAGS when enabling coverage. diff --git a/regtest/basic/rt67-mpi/COLVAR.reference b/regtest/basic/rt67-mpi/COLVAR.reference index 7d00a355feca39f9bec7a530282a1b70349104d2..2f9cce0086b9293399fcf1e494ad3111e8f91a6b 100644 --- a/regtest/basic/rt67-mpi/COLVAR.reference +++ b/regtest/basic/rt67-mpi/COLVAR.reference @@ -14,13 +14,13 @@ 8.000000 -1.8429 1.3293 0.6692 0.5800 0.1025 9.000000 -2.2424 2.6059 0.0000 -0.1025 0.1109 10.000000 -1.1482 0.5350 1.8435 1.7326 0.1281 - 11.000000 -1.7580 2.0752 0.0012 -0.1269 0.1367 - 12.000000 -1.3186 3.0997 0.0000 -0.1367 0.1443 - 13.000000 -2.9911 2.8991 0.0000 -0.1443 0.1524 - 14.000000 -1.4112 0.0028 0.0285 -0.1239 0.1614 - 15.000000 -2.5995 2.6683 0.3230 0.1616 0.1714 - 16.000000 -1.4608 0.2622 0.9676 0.7962 0.1856 - 17.000000 -1.3791 1.1576 3.0484 2.8628 0.2090 - 18.000000 -1.6771 0.9078 1.5947 1.3857 0.2309 - 19.000000 -1.5241 1.2623 4.1823 3.9513 0.2607 - 20.000000 -1.1997 0.9529 3.1902 2.9295 0.2924 + 11.000000 -1.7580 2.0752 0.0012 -0.1269 0.1368 + 12.000000 -1.3186 3.0997 0.0000 -0.1368 0.1451 + 13.000000 -2.9911 2.8991 0.0000 -0.1451 0.1534 + 14.000000 -1.4112 0.0028 0.0285 -0.1250 0.1625 + 15.000000 -2.5995 2.6683 0.3230 0.1606 0.1725 + 16.000000 -1.4608 0.2622 0.9676 0.7951 0.1867 + 17.000000 -1.3791 1.1576 3.0484 2.8617 0.2101 + 18.000000 -1.6771 0.9078 1.5947 1.3846 0.2320 + 19.000000 -1.5241 1.2623 4.1823 3.9503 0.2617 + 20.000000 -1.1997 0.9529 3.1902 2.9285 0.2935 diff --git a/regtest/basic/rt67/COLVAR.reference b/regtest/basic/rt67/COLVAR.reference index 7d00a355feca39f9bec7a530282a1b70349104d2..2f9cce0086b9293399fcf1e494ad3111e8f91a6b 100644 --- a/regtest/basic/rt67/COLVAR.reference +++ b/regtest/basic/rt67/COLVAR.reference @@ -14,13 +14,13 @@ 8.000000 -1.8429 1.3293 0.6692 0.5800 0.1025 9.000000 -2.2424 2.6059 0.0000 -0.1025 0.1109 10.000000 -1.1482 0.5350 1.8435 1.7326 0.1281 - 11.000000 -1.7580 2.0752 0.0012 -0.1269 0.1367 - 12.000000 -1.3186 3.0997 0.0000 -0.1367 0.1443 - 13.000000 -2.9911 2.8991 0.0000 -0.1443 0.1524 - 14.000000 -1.4112 0.0028 0.0285 -0.1239 0.1614 - 15.000000 -2.5995 2.6683 0.3230 0.1616 0.1714 - 16.000000 -1.4608 0.2622 0.9676 0.7962 0.1856 - 17.000000 -1.3791 1.1576 3.0484 2.8628 0.2090 - 18.000000 -1.6771 0.9078 1.5947 1.3857 0.2309 - 19.000000 -1.5241 1.2623 4.1823 3.9513 0.2607 - 20.000000 -1.1997 0.9529 3.1902 2.9295 0.2924 + 11.000000 -1.7580 2.0752 0.0012 -0.1269 0.1368 + 12.000000 -1.3186 3.0997 0.0000 -0.1368 0.1451 + 13.000000 -2.9911 2.8991 0.0000 -0.1451 0.1534 + 14.000000 -1.4112 0.0028 0.0285 -0.1250 0.1625 + 15.000000 -2.5995 2.6683 0.3230 0.1606 0.1725 + 16.000000 -1.4608 0.2622 0.9676 0.7951 0.1867 + 17.000000 -1.3791 1.1576 3.0484 2.8617 0.2101 + 18.000000 -1.6771 0.9078 1.5947 1.3846 0.2320 + 19.000000 -1.5241 1.2623 4.1823 3.9503 0.2617 + 20.000000 -1.1997 0.9529 3.1902 2.9285 0.2935 diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp index 9367a13545b19c6c1b016ca9a98be8de25b8da9b..fe178a6c93c6d1302a9544a53902f8028f91628d 100644 --- a/src/bias/MetaD.cpp +++ b/src/bias/MetaD.cpp @@ -1862,8 +1862,8 @@ void MetaD::computeReweightingFactor() for(unsigned i=rank; i<ntotgrid; i+=stride) { t_index[0]=(i%rewf_grid_[0]); unsigned kk=i; - for(unsigned j=1; j<ncv-1; ++j) { kk=(kk-t_index[j-1])/rewf_grid_[i-1]; t_index[j]=(kk%rewf_grid_[i]); } - if( ncv>=2 ) t_index[ncv-1]=((kk-t_index[ncv-1])/rewf_grid_[ncv-2]); + for(unsigned j=1; j<ncv-1; ++j) { kk=(kk-t_index[j-1])/rewf_grid_[j-1]; t_index[j]=(kk%rewf_grid_[j]); } + if( ncv>=2 ) t_index[ncv-1]=((kk-t_index[ncv-2])/rewf_grid_[ncv-2]); for(unsigned j=0; j<ncv; ++j) vals[j]=dmin[j] + t_index[j]*grid_spacing[j];