Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2012-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_tools_LeptonCall_h 23 : #define __PLUMED_tools_LeptonCall_h 24 : 25 : #include "core/Action.h" 26 : #include "lepton/Lepton.h" 27 : 28 : namespace PLMD { 29 : 30 : /// \ingroup TOOLBOX 31 : class LeptonCall { 32 : private: 33 : unsigned nargs; 34 : bool allow_extra_args; 35 : /// Lepton expression. 36 : /// \warning Since lepton::CompiledExpression is mutable, a vector is necessary for multithreading! 37 : std::vector<lepton::CompiledExpression> expression; 38 : /// Lepton expression for derivative 39 : /// \warning Since lepton::CompiledExpression is mutable, a vector is necessary for multithreading! 40 : std::vector<std::vector<lepton::CompiledExpression> > expression_deriv; 41 : std::vector<double*> lepton_ref; 42 : std::vector<double*> lepton_ref_deriv; 43 : public: 44 : void set(const std::string & func, const std::vector<std::string>& var, Action* action=NULL, const bool& a=false ); 45 : unsigned getNumberOfArguments() const ; 46 : double evaluate( const std::vector<double>& args ) const ; 47 : double evaluateDeriv( const unsigned& ider, const std::vector<double>& args ) const ; 48 : }; 49 : 50 : inline 51 : unsigned LeptonCall::getNumberOfArguments() const { 52 567230 : return nargs; 53 : } 54 : 55 : } 56 : 57 : #endif 58 :