Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2013-2023 The plumed team 3 : (see the PEOPLE file at the root of the distribution for a list of names) 4 : 5 : See http://www.plumed.org for more information. 6 : 7 : This file is part of plumed, version 2. 8 : 9 : plumed is free software: you can redistribute it and/or modify 10 : it under the terms of the GNU Lesser General Public License as published by 11 : the Free Software Foundation, either version 3 of the License, or 12 : (at your option) any later version. 13 : 14 : plumed is distributed in the hope that it will be useful, 15 : but WITHOUT ANY WARRANTY; without even the implied warranty of 16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 : GNU Lesser General Public License for more details. 18 : 19 : You should have received a copy of the GNU Lesser General Public License 20 : along with plumed. If not, see <http://www.gnu.org/licenses/>. 21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 22 : #include "core/ActionShortcut.h" 23 : #include "core/ActionRegister.h" 24 : 25 : //+PLUMEDOC MCOLVAR MFILTER_MORE 26 : /* 27 : Apply one minus a switching function to the input vector. 28 : 29 : This action has been depracated as it is equivalent to [MORE_THAN](MORE_THAN.md). 30 : 31 : */ 32 : //+ENDPLUMEDOC 33 : 34 : namespace PLMD { 35 : namespace multicolvar { 36 : 37 : class MFilterMore : public ActionShortcut { 38 : public: 39 : static void registerKeywords(Keywords& keys); 40 : explicit MFilterMore(const ActionOptions&); 41 : }; 42 : 43 : PLUMED_REGISTER_ACTION(MFilterMore,"MFILTER_MORE") 44 : 45 2 : void MFilterMore::registerKeywords(Keywords& keys) { 46 2 : ActionShortcut::registerKeywords( keys ); 47 4 : keys.setDeprecated("MORE_THAN"); 48 2 : keys.add("compulsory","DATA","the vector you wish to transform"); 49 2 : keys.add("compulsory","SWITCH","the switching function that transform"); 50 2 : keys.addFlag("LOWMEM",false,"this flag does nothing and is present only to ensure back-compatibility"); 51 2 : keys.addFlag("HIGHEST",false,"this flag allows you to recover the highest of these variables."); 52 4 : keys.addOutputComponent("highest","HIGHEST","scalar","the largest of the colvars"); 53 2 : keys.needsAction("CUSTOM"); 54 2 : keys.needsAction("GROUP"); 55 2 : keys.needsAction("MORE_THAN"); 56 2 : keys.needsAction("HIGHEST"); 57 2 : } 58 : 59 0 : MFilterMore::MFilterMore(const ActionOptions& ao): 60 : Action(ao), 61 0 : ActionShortcut(ao) { 62 0 : warning("This action has been depracated. Look at the log to see how the same result is achieved with the new syntax"); 63 : bool lowmem; 64 0 : parseFlag("LOWMEM",lowmem); 65 0 : if( lowmem ) { 66 0 : warning("LOWMEM flag is deprecated and is no longer required for this action"); 67 : } 68 : std::string dd; 69 0 : parse("DATA",dd); 70 : std::string swit; 71 0 : parse("SWITCH",swit); 72 0 : readInputLine( getShortcutLabel() + "_grp: GROUP ATOMS=" + dd + "_grp"); 73 0 : readInputLine( getShortcutLabel() + ": MORE_THAN ARG=" + dd + " SWITCH={" + swit + "}"); 74 : bool highest; 75 0 : parseFlag("HIGHEST",highest); 76 0 : if( highest ) { 77 0 : readInputLine( getShortcutLabel() + "_filtered: CUSTOM ARG=" + dd + "," + getShortcutLabel() + " FUNC=x*y PERIODIC=NO"); 78 0 : readInputLine( getShortcutLabel() + "_highest: HIGHEST ARG=" + getShortcutLabel() + "_filtered"); 79 : } 80 0 : } 81 : 82 : } 83 : }