diff --git a/CHANGES/v2.3.txt b/CHANGES/v2.3.txt index c2928f73645a00902bff9ab34c627faf3cf01ee2..a612e95c2d933d959d9864e4c9d4051f980e2746 100644 --- a/CHANGES/v2.3.txt +++ b/CHANGES/v2.3.txt @@ -157,6 +157,7 @@ See branch \branch{v2.3} on git repository. - Fixed bug when using \ref MOVINGRESTRAINT with periodic variables such as \ref TORSION \issue{225}. - Fixed bug in \ref HBONDS that used to apear when you used DONORNS and ACCEPTORS with same numbers of atoms - Fixed bug in \ref DISTANCES that appears when using BETWEEN and link cells. +- Prevented users from causing segfaults by storing derivatives without LOWMEM flag. In these caess PLUMED crashes with meaningful errors. For developers: - plumedcheck validation has been made stricter. All the checks are now described in the developer manual. diff --git a/regtest/adjmat/rt-dfg-wcsurf/plumed.dat b/regtest/adjmat/rt-dfg-wcsurf/plumed.dat index 4c61916607c34404a7591d38ecff1cef1e4c69b6..f437edd08acb5ceae0db8e0ced6bb2aacba59e94 100644 --- a/regtest/adjmat/rt-dfg-wcsurf/plumed.dat +++ b/regtest/adjmat/rt-dfg-wcsurf/plumed.dat @@ -5,7 +5,7 @@ cf: MFILTER_MORE DATA=c1 SWITCH={RATIONAL D_0=2.0 R_0=0.1} LOWMEM # Build a contact matrix mat: CONTACT_MATRIX ATOMS=cf SWITCH={EXP D_0=4.0 R_0=0.5 D_MAX=6.0} # Find largest cluster -dfs: DFSCLUSTERING MATRIX=mat +dfs: DFSCLUSTERING MATRIX=mat LOWMEM clust1: CLUSTER_PROPERTIES CLUSTERS=dfs CLUSTER=1 nat: CLUSTER_NATOMS CLUSTERS=dfs CLUSTER=1 diff --git a/regtest/adjmat/rt-topolog-deriv/plumed.dat b/regtest/adjmat/rt-topolog-deriv/plumed.dat index f3e1bc1bf64777f1c2e204ac7f8314652398c65e..bbb0e42bf1d2e3b9eebdac7e54652d38808a3ba3 100644 --- a/regtest/adjmat/rt-topolog-deriv/plumed.dat +++ b/regtest/adjmat/rt-topolog-deriv/plumed.dat @@ -8,7 +8,7 @@ TOPOLOGY_MATRIX ... LABEL=mat ... TOPOLOGY_MATRIX -dfs: DFSCLUSTERING MATRIX=mat +dfs: DFSCLUSTERING LOWMEM MATRIX=mat mm: CLUSTER_PROPERTIES CLUSTERS=dfs CLUSTER=1 SUM diff --git a/src/vesselbase/StoreDataVessel.cpp b/src/vesselbase/StoreDataVessel.cpp index 76122a5f65fa061b1700692b64ffbd6008f4a24d..13f4c9ab6f88ccd77b2d9ac5c3b0382b76b9163a 100644 --- a/src/vesselbase/StoreDataVessel.cpp +++ b/src/vesselbase/StoreDataVessel.cpp @@ -51,6 +51,9 @@ void StoreDataVessel::resize(){ nspace = 1; active_der.resize( max_lowmem_stash * ( 1 + getAction()->getNumberOfDerivatives() ) ); } else { + if( getAction()->getNumberOfDerivatives()>getAction()->maxderivatives ){ + error("not enough memory to store derivatives for action " + getAction()->getLabel() + " use LOWMEM option"); + } nspace = 1 + getAction()->maxderivatives; active_der.resize( getNumberOfStoredValues() * ( 1 + getAction()->maxderivatives ) ); }