forked from plumed/plumed2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Restart.cpp
109 lines (85 loc) · 2.98 KB
/
Restart.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (c) 2012-2015 The plumed team
(see the PEOPLE file at the root of the distribution for a list of names)
See http://www.plumed-code.org for more information.
This file is part of plumed, version 2.
plumed is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
plumed is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with plumed. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#include "core/ActionSetup.h"
#include "core/ActionRegister.h"
#include "core/PlumedMain.h"
#include "core/Atoms.h"
#include "tools/Exception.h"
using namespace std;
namespace PLMD{
namespace setup{
//+PLUMEDOC GENERIC RESTART
/*
Activate restart.
This is a Setup directive and, as such, should appear
at the beginning of the input file. It influences the way
PLUMED treat files open for writing (see also \ref Files).
Notice that it is also possible to enable or disable restart on a per-action
basis using the RESTART keyword on a single action. In this case,
the keyword should be assigned a value. RESTART=AUTO means that global
settings are used, RESTART=YES or RESTART=NO respectively enable
and disable restart for that single action.
\attention
This directive can have also other side effects, e.g. on \ref METAD
and on some analysis action.
\par Examples
Using the following input:
\verbatim
d: DISTANCE ATOMS=1,2
PRINT ARG=d FILE=out
\endverbatim
(See also \ref DISTANCE and \ref PRINT).
a new 'out' file will be created. If an old one is on the way, it will be automatically backed up.
On the other hand, using the following input:
\verbatim
RESTART
d: DISTANCE ATOMS=1,2
PRINT ARG=d FILE=out
\endverbatim
the file 'out' will be appended.
(See also \ref DISTANCE and \ref PRINT).
In the following case, file out1 will be backed up and file out2 will be concatenated
\verbatim
RESTART
d1: DISTANCE ATOMS=1,2
d2: DISTANCE ATOMS=1,2
PRINT ARG=d1 FILE=out1 RESTART=NO
PRINT ARG=d2 FILE=out2
\endverbatim
(See also \ref DISTANCE and \ref PRINT).
*/
//+ENDPLUMEDOC
class Restart :
public virtual ActionSetup
{
public:
static void registerKeywords( Keywords& keys );
Restart(const ActionOptions&ao);
};
PLUMED_REGISTER_ACTION(Restart,"RESTART")
void Restart::registerKeywords( Keywords& keys ){
ActionSetup::registerKeywords(keys);
}
Restart::Restart(const ActionOptions&ao):
Action(ao),
ActionSetup(ao)
{
plumed.setRestart(true);
log<<"Restarting simulation: files will be appended\n";
}
}
}