Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2020-2021 of Michele Invernizzi. 3 : 4 : This file is part of the OPES plumed module. 5 : 6 : The OPES plumed module is free software: you can redistribute it and/or modify 7 : it under the terms of the GNU Lesser General Public License as published by 8 : the Free Software Foundation, either version 3 of the License, or 9 : (at your option) any later version. 10 : 11 : The OPES plumed module is distributed in the hope that it will be useful, 12 : but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : GNU Lesser General Public License for more details. 15 : 16 : You should have received a copy of the GNU Lesser General Public License 17 : along with plumed. If not, see <http://www.gnu.org/licenses/>. 18 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 19 : #ifndef __PLUMED_opes_ExpansionCVs_h 20 : #define __PLUMED_opes_ExpansionCVs_h 21 : 22 : #include "core/ActionWithValue.h" 23 : #include "core/ActionWithArguments.h" 24 : 25 : namespace PLMD { 26 : namespace opes { 27 : 28 : /* 29 : \ingroup INHERIT 30 : This is the abstract base class to use for implementing expansion CVs (ECVs). 31 : ECVs should be used together with the OPESexpanded action. 32 : They take as argument regular CVs, and output them as components without modification. 33 : */ 34 : 35 : class ExpansionCVs: 36 : public ActionWithValue, 37 : public ActionWithArguments 38 : { 39 : protected: 40 : bool isReady_; //true only after initECVs 41 : double kbt_; 42 : unsigned totNumECVs_; 43 : 44 : //methods useful for linear expansions 45 : std::vector<double> getSteps(double,double,const unsigned,const std::string&,const bool,const double) const; 46 : unsigned estimateNumSteps(const double,const double,const std::vector<double>&,const std::string&) const; 47 : 48 : public: 49 : explicit ExpansionCVs(const ActionOptions&); 50 37 : virtual ~ExpansionCVs() {}; 51 : void apply() override; 52 : void calculate() override; 53 : static void registerKeywords(Keywords&); 54 170 : inline unsigned getNumberOfDerivatives() override {return 1;}; 55 : 56 67 : inline double getKbT() const {return kbt_;}; 57 50 : inline unsigned getTotNumECVs() const {plumed_massert(isReady_,"cannot ask for totNumECVs before ECV isReady"); return totNumECVs_;}; 58 : virtual std::vector< std::vector<unsigned> > getIndex_k() const; //might need to override this 59 : 60 : virtual void calculateECVs(const double *) = 0; 61 : virtual const double * getPntrToECVs(unsigned) = 0; 62 : virtual const double * getPntrToDerECVs(unsigned) = 0; 63 : virtual std::vector<std::string> getLambdas() const = 0; 64 : virtual void initECVs_observ(const std::vector<double>&,const unsigned,const unsigned) = 0; //arg: all the observed CVs, the total numer of CVs, the first CV index referring to this ECV 65 : virtual void initECVs_restart(const std::vector<std::string>&) = 0; //arg: the lambdas read from DeltaF_name relative to this ECV 66 : }; 67 : 68 : } 69 : } 70 : 71 : #endif 72 :