LCOV - code coverage report
Current view: top level - multicolvar - MFilterMore.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 28 29 96.6 %
Date: 2026-11-05 10:19:04 Functions: 2 3 66.7 %

          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 deprecated 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           5 : void MFilterMore::registerKeywords(Keywords& keys) {
      46           5 :   ActionShortcut::registerKeywords( keys );
      47          10 :   keys.setDeprecated("MORE_THAN");
      48           5 :   keys.add("compulsory","DATA","the vector you wish to transform");
      49           5 :   keys.add("compulsory","SWITCH","the switching function that transform");
      50          10 :   keys.addDeprecatedFlag("LOWMEM","");
      51           5 :   keys.addFlag("HIGHEST",false,"this flag allows you to recover the highest of these variables.");
      52          10 :   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 more than a tolerance and zero otherwise");
      53          10 :   keys.addOutputComponent("highest","HIGHEST","scalar","the largest of the colvars");
      54           5 :   keys.needsAction("CUSTOM");
      55           5 :   keys.needsAction("GROUP");
      56           5 :   keys.needsAction("MORE_THAN");
      57           5 :   keys.needsAction("HIGHEST");
      58           5 : }
      59             : 
      60           1 : MFilterMore::MFilterMore(const ActionOptions& ao):
      61             :   Action(ao),
      62           1 :   ActionShortcut(ao) {
      63           1 :   warning("This action has been deprecated.  Look at the log to see how the same result is achieved with the new syntax");
      64             :   bool lowmem;
      65           1 :   parseFlag("LOWMEM",lowmem);
      66           1 :   if( lowmem ) {
      67           0 :     warning("LOWMEM flag is deprecated and is no longer required for this action");
      68             :   }
      69             :   std::string dd;
      70           2 :   parse("DATA",dd);
      71             :   std::string swit;
      72           1 :   parse("SWITCH",swit);
      73           2 :   readInputLine( getShortcutLabel() + "_grp: GROUP ATOMS=" + dd + "_grp");
      74           3 :   readInputLine( getShortcutLabel() + ": MORE_THAN ARG=" + dd + " SWITCH={" + swit + "}");
      75             :   bool highest;
      76           1 :   parseFlag("HIGHEST",highest);
      77           1 :   if( highest ) {
      78           3 :     readInputLine( getShortcutLabel() + "_filtered: CUSTOM ARG=" + dd + "," + getShortcutLabel() + " FUNC=x*y PERIODIC=NO");
      79           3 :     readInputLine( getShortcutLabel() + "_highest: HIGHEST ARG=" + getShortcutLabel() + "_filtered");
      80             :   }
      81           1 : }
      82             : 
      83             : }
      84             : }

Generated by: LCOV version 1.16