All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ManyRestraintsBase.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 "ManyRestraintsBase.h"
23 #include "vesselbase/Vessel.h"
24 
25 namespace PLMD {
26 namespace manyrestraints {
27 
32  ActionWithVessel::registerKeywords( keys );
34  keys.add("hidden","STRIDE","the frequency with which the forces due to the bias should be calculated. This can be used to correctly set up multistep algorithms");
35  keys.remove("TOL");
36 }
37 
39 Action(ao),
40 ActionAtomistic(ao),
41 ActionWithValue(ao),
42 ActionPilot(ao),
43 ActionWithVessel(ao)
44 {
45 }
46 
47 void ManyRestraintsBase::createRestraints( const unsigned& nrestraints ){
48  std::string fake_input;
49  for(unsigned i=0;i<nrestraints;++i) taskList.addIndexToList(i);
51  addVessel( "SUM", fake_input, 0, "bias" );
54 }
55 
57  plumed_dbg_assert( getNumberOfComponents()==1 );
58  getPntrToComponent(0)->addForce(-1.0);
59  bool wasforced=getForcesFromVessels( forcesToApply );
60  plumed_assert( wasforced ); setForcesOnAtoms( forcesToApply );
61 }
62 
63 }
64 }
65 
static void registerKeywords(Keywords &keys)
Register all the relevant keywords for the action.
void addForce(double f)
Add some force on this value.
Definition: Value.h:247
static void registerKeywords(Keywords &keys)
This is used to create PLMD::Action objects that are run with some set frequency. ...
Definition: ActionPilot.h:39
void add(const std::string &t, const std::string &k, const std::string &d)
Add a new keyword of type t with name k and description d.
Definition: Keywords.cpp:167
void addVessel(const std::string &name, const std::string &input, const int numlab=0, const std::string thislab="")
Add a vessel to the list of vessels.
bool getForcesFromVessels(std::vector< double > &forcesToApply)
Retrieve the forces from all the vessels (used in apply)
void readVesselKeywords()
Complete the setup of this object (this routine must be called after construction of ActionWithValue)...
Used to create a PLMD::Action that has some scalar or vectorial output that may or may not have some ...
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
Action used to create objects that access the positions of the atoms from the MD code.
void addIndexToList(const T &ii)
Add something to the active list.
Definition: DynamicList.h:235
Base class for all the input Actions.
Definition: Action.h:60
static void registerKeywords(Keywords &keys)
Register all the relevant keywords for the action.
Definition: Action.cpp:49
static void registerKeywords(Keywords &keys)
Create the keywords for actionPilot.
Definition: ActionPilot.cpp:27
DynamicList< unsigned > taskList
The list of tasks we have to perform.
void remove(const std::string &k)
Remove the keyword with name k.
Definition: Keywords.cpp:204
int getNumberOfComponents() const
Returns the number of values defined.
Value * getPntrToComponent(int i)
Return a pointer to the component by index.
void setForcesOnAtoms(const std::vector< double > &forcesToApply, unsigned ind=0)
Add the forces to the atoms.
void createRestraints(const unsigned &nrestraints)
void activateAll()
Make everything in the list active.
Definition: DynamicList.h:270
static void registerKeywords(Keywords &keys)