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 : protected: 39 : bool isReady_; //true only after initECVs 40 : double kbt_; 41 : unsigned totNumECVs_; 42 : 43 : //methods useful for linear expansions 44 : std::vector<double> getSteps(double,double,const unsigned,const std::string&,const bool,const double) const; 45 : unsigned estimateNumSteps(const double,const double,const std::vector<double>&,const std::string&) const; 46 : 47 : public: 48 : explicit ExpansionCVs(const ActionOptions&); 49 37 : virtual ~ExpansionCVs() {}; 50 : std::string getOutputComponentDescription( const std::string& cname, const Keywords& keys ) const override ; 51 : void apply() override; 52 : void calculate() override; 53 : static void registerKeywords(Keywords&); 54 138 : inline unsigned getNumberOfDerivatives() override { 55 138 : return 1; 56 : }; 57 : 58 : inline double getKbT() const { 59 67 : return kbt_; 60 : }; 61 50 : inline unsigned getTotNumECVs() const { 62 50 : plumed_massert(isReady_,"cannot ask for totNumECVs before ECV isReady"); 63 50 : return totNumECVs_; 64 : }; 65 : virtual std::vector< std::vector<unsigned> > getIndex_k() const; //might need to override this 66 : 67 : virtual void calculateECVs(const double *) = 0; 68 : virtual const double * getPntrToECVs(unsigned) = 0; 69 : virtual const double * getPntrToDerECVs(unsigned) = 0; 70 : virtual std::vector<std::string> getLambdas() const = 0; 71 : 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 72 : virtual void initECVs_restart(const std::vector<std::string>&) = 0; //arg: the lambdas read from DeltaF_name relative to this ECV 73 : }; 74 : 75 : } 76 : } 77 : 78 : #endif 79 :