Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2014-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 : #ifndef __PLUMED_multicolvar_MultiColvarFilter_h 23 : #define __PLUMED_multicolvar_MultiColvarFilter_h 24 : 25 : #include "tools/HistogramBead.h" 26 : #include "BridgedMultiColvarFunction.h" 27 : 28 : namespace PLMD { 29 : namespace multicolvar { 30 : 31 : /** 32 : \ingroup INHERIT 33 : This is the abstract base class to use for implementing a new way of filtering collective variable values 34 : to see whether or not they are within a certain range 35 : */ 36 : 37 : class MultiColvarFilter : public BridgedMultiColvarFunction { 38 : private: 39 : /// Are we doing a filtering of the coordinates or a transoformation 40 : bool filter; 41 : public: 42 : static void registerKeywords( Keywords& keys ); 43 : explicit MultiColvarFilter(const ActionOptions&); 44 : /// Do everything required to setup the derivatives 45 : void doJobsRequiredBeforeTaskList() override; 46 : /// Get the number of quantities in the colvar 47 : unsigned getNumberOfQuantities() const override; 48 : /// Actually do what we are asked 49 : void completeTask( const unsigned& curr, MultiValue& invals, MultiValue& outvals ) const override; 50 : /// Do the filtering 51 : virtual double applyFilter( const double& val, double& df ) const=0; 52 : /// Just checks there are no bridging forces 53 : void addBridgeForces( const std::vector<double>& bb ); 54 : }; 55 : 56 : inline 57 28192 : unsigned MultiColvarFilter::getNumberOfQuantities() const { 58 28192 : return getPntrToMultiColvar()->getNumberOfQuantities(); 59 : } 60 : 61 : } 62 : } 63 : #endif