All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Restart.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 "core/Atoms.h"
26 #include "tools/Exception.h"
27 
28 using namespace std;
29 
30 namespace PLMD{
31 namespace setup{
32 
33 //+PLUMEDOC GENERIC RESTART
34 /*
35 Activate restart.
36 
37 This is a Setup directive and, as such, should appear
38 at the beginning of the input file.
39 
40 \par Examples
41 
42 Using the following input:
43 \verbatim
44 d: DISTANCE ATOMS=1,2
45 PRINT ARG=d FILE=out
46 \endverbatim
47 a new 'out' file will be created. If an old one is on the way, it will be automatically backed up.
48 On the other hand, using the following input:
49 \verbatim
50 RESTART
51 d: DISTANCE ATOMS=1,2
52 PRINT ARG=d FILE=out
53 \endverbatim
54 the file 'out' will be appended.
55 (See also \ref DISTANCE and \ref PRINT).
56 
57 \attention
58 This directive can have also other side effects, e.g. on \ref METAD
59 
60 */
61 //+ENDPLUMEDOC
62 
63 class Restart :
64  public virtual ActionSetup
65 {
66 public:
67  static void registerKeywords( Keywords& keys );
68  Restart(const ActionOptions&ao);
69 };
70 
71 PLUMED_REGISTER_ACTION(Restart,"RESTART")
72 
73 void Restart::registerKeywords( Keywords& keys ){
74  ActionSetup::registerKeywords(keys);
75 }
76 
77 Restart::Restart(const ActionOptions&ao):
78 Action(ao),
79 ActionSetup(ao)
80 {
81  plumed.setRestart(true);
82  log<<"Restarting simulation: files will be appended\n";
83 }
84 
85 }
86 }
Provides the keyword RESTART
Definition: Restart.cpp:63
Log & log
Reference to the log stream.
Definition: Action.h:93
STL namespace.
Action used to create a PLMD::Action that do something during setup only e.g.
Definition: ActionSetup.h:33
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