From 6c46bb3b701ff153de42790529327ebdc4b403dd Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Tue, 26 Nov 2024 17:04:13 +0000 Subject: [PATCH 1/3] Fixed secondarystructure/rt-coverage-antibetarmsd regtest I think this regtest was maybe migrated across from version 2.9. It can't pass if you run it in plumed 2.10 unless you make these changes. --- .../rt-coverage-antibetarmsd/colvar.reference | 2 +- .../rt-coverage-antibetarmsd/forces.reference | 2 +- .../secondarystructure/rt-coverage-antibetarmsd/plumed.dat | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/regtest/secondarystructure/rt-coverage-antibetarmsd/colvar.reference b/regtest/secondarystructure/rt-coverage-antibetarmsd/colvar.reference index 2e093c7e02..8224042792 100644 --- a/regtest/secondarystructure/rt-coverage-antibetarmsd/colvar.reference +++ b/regtest/secondarystructure/rt-coverage-antibetarmsd/colvar.reference @@ -1,4 +1,4 @@ -#! FIELDS time b.lessthan brf.lessthan br.lessthan p.lessthan prf.lessthan pr.lessthan sum +#! FIELDS time b_lessthan brf_lessthan br_lessthan p_lessthan prf_lessthan pr_lessthan sum 0.000000 0.0607 0.1654 0.1654 0.2681 0.1425 0.1425 0.3287 0.050000 0.0000 42.5600 42.5600 14.6579 4.1424 4.1424 14.6579 0.100000 0.0188 34.0262 34.0262 13.0049 3.2851 3.2851 13.0238 diff --git a/regtest/secondarystructure/rt-coverage-antibetarmsd/forces.reference b/regtest/secondarystructure/rt-coverage-antibetarmsd/forces.reference index cbb160398c..27c89ca644 100644 --- a/regtest/secondarystructure/rt-coverage-antibetarmsd/forces.reference +++ b/regtest/secondarystructure/rt-coverage-antibetarmsd/forces.reference @@ -1,4 +1,4 @@ -#! FIELDS time b.lessthan brf.lessthan br.lessthan p.lessthan prf.lessthan pr.lessthan sum @8.bias @8.force2 +#! FIELDS time b_lessthan brf_lessthan br_lessthan p_lessthan prf_lessthan pr_lessthan sum r.bias r.force2 0.000000 -0.3893763023 -0.1653910914 -0.1653910914 -0.5967893540 -0.1425260828 -0.1425260828 -0.3287218854 0.0000000000 0.0000000000 0.050000 -14.6578542139 -42.5600014141 -42.5600014141 -29.3157084279 -4.1424316083 -4.1424316083 -14.6578542139 0.0000000000 0.0000000000 0.100000 -13.0426114706 -34.0261914601 -34.0261914601 -26.0287209912 -3.2850812434 -3.2850812434 -13.0237774873 0.0000000000 0.0000000000 diff --git a/regtest/secondarystructure/rt-coverage-antibetarmsd/plumed.dat b/regtest/secondarystructure/rt-coverage-antibetarmsd/plumed.dat index 4fc2b04fd5..1985091b07 100644 --- a/regtest/secondarystructure/rt-coverage-antibetarmsd/plumed.dat +++ b/regtest/secondarystructure/rt-coverage-antibetarmsd/plumed.dat @@ -7,9 +7,9 @@ PARABETARMSD RESIDUES=all TYPE=OPTIMAL-FAST STRANDS_CUTOFF=1.0 LESS_THAN={RATION PARABETARMSD RESIDUES=all TYPE=OPTIMAL STRANDS_CUTOFF=1.0 LESS_THAN={RATIONAL R_0=0.1 NN=8 MM=12 NOSTRETCH} LABEL=pr COMBINE ARG=b.lessthan,p.lessthan PERIODIC=NO LABEL=sum -RESTRAINT ARG=b.*,brf.*,br.*,p.*,prf.*,pr.*,sum KAPPA=1.,1.,1.,1,1,1,1 AT=0,0,0,0,0,0,0 SLOPE=0,0,0,0,0,0,0 +r: RESTRAINT ARG=b.*,brf.*,br.*,p.*,prf.*,pr.*,sum KAPPA=1.,1.,1.,1,1,1,1 AT=0,0,0,0,0,0,0 SLOPE=0,0,0,0,0,0,0 -DUMPFORCES ARG=* FILE=forces STRIDE=1 +DUMPFORCES ARG=b.*,brf.*,br.*,p.*,prf.*,pr.*,sum,r.* FILE=forces STRIDE=1 PRINT ARG=b.*,brf.*,br.*,p.*,prf.*,pr.*,sum STRIDE=1 FILE=colvar FMT=%8.4f From 3be870e0e1ac2e950f41be1c0c3bdbdc766ac696 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Tue, 26 Nov 2024 17:07:37 +0000 Subject: [PATCH 2/3] Added functionality to keep track of deprecated actions in syntax file --- src/cltools/GenJson.cpp | 10 ++++++++++ src/core/ActionRegister.cpp | 7 ++++--- src/multicolvar/DumpMultiColvar.cpp | 1 + src/multicolvar/MFilterLess.cpp | 1 + src/multicolvar/MFilterMore.cpp | 1 + src/multicolvar/UWalls.cpp | 1 + src/tools/Keywords.cpp | 9 +++++++++ src/tools/Keywords.h | 6 ++++++ 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index 8c9adec6ce..44ae7ced84 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -123,6 +123,16 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { // Now output keyword information Keywords keys; actionRegister().getKeywords( action_names[i], keys ); std::cout<<" \"displayname\" : \""< ActionRegister::create(const std::vector & images auto content=get(images,ao.line[0]); Keywords keys; keys.thisactname = ao.line[0]; - content.keys(keys); + keys.replaceaction = "none"; content.keys(keys); ActionOptions nao( ao,keys ); auto fullPath=getFullPath(images,ao.line[0]); nao.setFullPath(fullPath); @@ -79,7 +79,7 @@ bool ActionRegister::printTemplate(const std::string& action, bool include_optio //no need to insert the try/catch block: check will ensure that action is known if( check(action) ) { Keywords keys; keys.thisactname = action; - get(action).keys(keys); + keys.replaceaction = "none"; get(action).keys(keys); keys.print_template(action, include_optional); return true; } else { @@ -101,6 +101,7 @@ bool ActionRegister::getKeywords(const std::string& action, Keywords& keys) { //no need to insert the try/catch block: check will ensure that action is known if(check(action)) { keys.thisactname = action; + keys.replaceaction = "none"; get(action).keys(keys); return true; } @@ -108,7 +109,7 @@ bool ActionRegister::getKeywords(const std::string& action, Keywords& keys) { } void ActionRegister::getKeywords(const std::vector & images, const std::string& action, Keywords& keys) { - auto content=get(images,action); keys.thisactname = action; content.keys(keys); + auto content=get(images,action); keys.thisactname = action; keys.replaceaction = "none"; content.keys(keys); } } diff --git a/src/multicolvar/DumpMultiColvar.cpp b/src/multicolvar/DumpMultiColvar.cpp index b716a99cef..a0b04d25d8 100644 --- a/src/multicolvar/DumpMultiColvar.cpp +++ b/src/multicolvar/DumpMultiColvar.cpp @@ -47,6 +47,7 @@ PLUMED_REGISTER_ACTION(DumpMultiColvar,"DUMPMULTICOLVAR") void DumpMultiColvar::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); + keys.setDeprecated("DUMPATOMS"); keys.add("compulsory","DATA","the vector you wish to transform"); keys.add("compulsory","FILE","the file that you would like to output the data to"); keys.remove("HAS_VALUES"); keys.needsAction("DUMPATOMS"); diff --git a/src/multicolvar/MFilterLess.cpp b/src/multicolvar/MFilterLess.cpp index 83f1978515..b8f0c817f3 100644 --- a/src/multicolvar/MFilterLess.cpp +++ b/src/multicolvar/MFilterLess.cpp @@ -47,6 +47,7 @@ PLUMED_REGISTER_ACTION(MFilterLess,"MFILTER_LESS") void MFilterLess::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); + keys.setDeprecated("LESS_THAN"); keys.add("compulsory","DATA","the vector you wish to transform"); keys.add("compulsory","SWITCH","the switching function that transform"); keys.setValueDescription("vector","a vector that has the same dimension as the input vector with elements equal to one if the corresponding component of the vector is less than a tolerance and zero otherwise"); diff --git a/src/multicolvar/MFilterMore.cpp b/src/multicolvar/MFilterMore.cpp index 363a773891..2507d1b3a8 100644 --- a/src/multicolvar/MFilterMore.cpp +++ b/src/multicolvar/MFilterMore.cpp @@ -47,6 +47,7 @@ PLUMED_REGISTER_ACTION(MFilterMore,"MFILTER_MORE") void MFilterMore::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); + keys.setDeprecated("MORE_THAN"); keys.add("compulsory","DATA","the vector you wish to transform"); keys.add("compulsory","SWITCH","the switching function that transform"); keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); diff --git a/src/multicolvar/UWalls.cpp b/src/multicolvar/UWalls.cpp index 68892cdf57..29d6dffd61 100644 --- a/src/multicolvar/UWalls.cpp +++ b/src/multicolvar/UWalls.cpp @@ -48,6 +48,7 @@ PLUMED_REGISTER_ACTION(UWalls,"UWALLS") void UWalls::registerKeywords(Keywords& keys) { ActionShortcut::registerKeywords( keys ); + keys.setDeprecated("UPPER_WALLS"); keys.add("compulsory","DATA","the values you want to restrain"); keys.add("compulsory","AT","the radius of the sphere"); keys.add("compulsory","KAPPA","the force constant for the wall. The k_i in the expression for a wall."); diff --git a/src/tools/Keywords.cpp b/src/tools/Keywords.cpp index ca9af95d6e..4904a0ccd8 100644 --- a/src/tools/Keywords.cpp +++ b/src/tools/Keywords.cpp @@ -776,4 +776,13 @@ std::string Keywords::getDisplayName() const { return thisactname; } +void Keywords::setDeprecated( const std::string& name ) { + replaceaction = name; +} + +std::string Keywords::getReplacementAction() const { + return replaceaction; +} + + } diff --git a/src/tools/Keywords.h b/src/tools/Keywords.h index efce8b38a0..6c84a5a601 100644 --- a/src/tools/Keywords.h +++ b/src/tools/Keywords.h @@ -66,6 +66,8 @@ class Keywords { bool isatoms; /// The name of the action that has this set of keywords std::string thisactname; +/// The action to use in place of this deprecated action + std::string replaceaction; /// The names of the allowed keywords std::vector keys; /// The names of the reserved keywords @@ -217,6 +219,10 @@ class Keywords { std::string getDisplayName() const ; /// Set the display name void setDisplayName( const std::string& name ); +/// Get the action that should be used to replace this one if action has been deprecated + std::string getReplacementAction() const ; +/// Note that this action has been deprecated + void setDeprecated( const std::string& name ); }; } From 347fc5063aac303abc9a0042837855a7541c4d87 Mon Sep 17 00:00:00 2001 From: Gareth Aneurin Tribello Date: Tue, 26 Nov 2024 17:12:01 +0000 Subject: [PATCH 3/3] Ran astyle --- src/cltools/GenJson.cpp | 10 +++++----- src/tools/Keywords.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cltools/GenJson.cpp b/src/cltools/GenJson.cpp index 44ae7ced84..bd609eb880 100644 --- a/src/cltools/GenJson.cpp +++ b/src/cltools/GenJson.cpp @@ -126,11 +126,11 @@ int GenJson::main(FILE* in, FILE*out,Communicator& pc) { // This is used for noting actions that have been deprecated std::string replacement = keys.getReplacementAction(); if( replacement!="none" ) { - bool found=false; - for(unsigned j=0; j