All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Load.cpp
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 #include "core/ActionSetup.h"
23 #include "core/ActionRegister.h"
24 #include "core/PlumedMain.h"
25 #include "tools/Exception.h"
26 
27 using namespace std;
28 
29 namespace PLMD{
30 namespace setup{
31 
32 //+PLUMEDOC GENERIC LOAD
33 /*
34 Loads a library, possibly defining new actions.
35 
36 It is available only
37 on systems allowing for dynamic loading. It can also be fed with a cpp file,
38 in which case the file is compiled first.
39 
40 \par Examples
41 
42 \verbatim
43 LOAD FILE=extensions.so
44 \endverbatim
45 
46 */
47 //+ENDPLUMEDOC
48 
49 class Load :
50  public virtual ActionSetup
51 {
52 public:
53  static void registerKeywords( Keywords& keys );
54  Load(const ActionOptions&ao);
55 };
56 
57 PLUMED_REGISTER_ACTION(Load,"LOAD")
58 
59 void Load::registerKeywords( Keywords& keys ){
60  ActionSetup::registerKeywords(keys);
61  keys.add("compulsory","FILE","file to be loaded");
62 }
63 
64 Load::Load(const ActionOptions&ao):
65 Action(ao),
66 ActionSetup(ao)
67 {
68  std::string f;
69  parse("FILE",f);
70  checkRead();
71  plumed.load(f);
72 }
73 
74 }
75 }
76 
Provides the keyword LOAD
Definition: Load.cpp:49
void checkRead()
Check if Action was properly read.
Definition: Action.cpp:161
STL namespace.
Action used to create a PLMD::Action that do something during setup only e.g.
Definition: ActionSetup.h:33
void parse(const std::string &key, T &t)
Parse one keyword as generic type.
Definition: Action.h:273
This class holds the keywords and their documentation.
Definition: Keywords.h:36
This class is used to bring the relevant information to the Action constructor.
Definition: Action.h:41
Base class for all the input Actions.
Definition: Action.h:60
Main plumed object.
Definition: Plumed.h:201