All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Function.h
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 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-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
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_function_Function_h
23 #define __PLUMED_function_Function_h
24 
25 #include "core/ActionWithValue.h"
26 #include "core/ActionWithArguments.h"
27 
28 namespace PLMD{
29 namespace function{
30 
31 /**
32 \ingroup INHERIT
33 This is the abstract base class to use for implementing new CV function, within it there is
34 \ref AddingAFunction "information" as to how to go about implementing a new function.
35 */
36 
37 class Function:
38  public ActionWithValue,
39  public ActionWithArguments
40 {
41 protected:
42  void setDerivative(int,double);
43  void setDerivative(Value*,int,double);
45  void addComponentWithDerivatives( const std::string& name );
46 public:
47  Function(const ActionOptions&);
48  virtual ~Function(){}
49  void apply();
50  static void registerKeywords(Keywords&);
51 };
52 
53 inline
54 void Function::setDerivative(Value*v,int i,double d){
55  v->addDerivative(i,d);
56 }
57 
58 inline
59 void Function::setDerivative(int i,double d){
61 }
62 
63 }
64 }
65 
66 #endif
67 
A class for holding the value of a function together with its derivatives.
Definition: Value.h:46
Value * getPntrToValue()
Get a pointer to the default value.
This is used to create PLMD::Action objects that take the output from some other Action as input...
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
void addComponentWithDerivatives(const std::string &name)
Definition: Function.cpp:58
This class holds the keywords and their documentation.
Definition: Keywords.h:36
const std::string name
Name of the directive in the plumed.dat file.
Definition: Action.h:64
This class is used to bring the relevant information to the Action constructor.
Definition: Action.h:41
static void registerKeywords(Keywords &)
Definition: Function.cpp:28
void apply()
Apply an Action.
Definition: Function.cpp:64
Function(const ActionOptions &)
Definition: Function.cpp:35
This is the abstract base class to use for implementing new CV function, within it there is informati...
Definition: Function.h:37
void addDerivative(unsigned i, double d)
Add some derivative to the ith component of the derivatives array.
Definition: Value.h:224
void setDerivative(int, double)
Definition: Function.h:59