Main plumed object. More...
#include <PlumedMain.h>
Classes | |
struct | plumed_error_handler |
Error handler. More... | |
Public Member Functions | |
PlumedMain () | |
~PlumedMain () | |
void | backwardPropagate () |
Perform the backward loop on active actions. More... | |
void | calc () |
Complete PLUMED calculation. More... | |
bool | callErrorHandler (int code, const char *msg) const |
Call error handler. More... | |
std::string | cite (const std::string &) |
Add a citation, returning a string containing the reference number, something like "[10]". More... | |
void | cmd (const std::string &key, const TypesafePtr &val, const std::size_t *shape) |
void | cmd (const std::string &key, const TypesafePtr &val, const std::size_t *shape) |
void | cmd (const std::string &key, const TypesafePtr &val, std::size_t nelem, const std::size_t *shape=nullptr) |
void | cmd (const std::string &key, const TypesafePtr &val, std::size_t nelem, const std::size_t *shape=nullptr) |
void | cmd (const std::string &key, const TypesafePtr &val=nullptr) override |
cmd method, accessible with standard Plumed.h interface. More... | |
virtual void | cmd (const std::string &key, const TypesafePtr &val=nullptr)=0 |
void | eraseFile (FileBase &) |
Erase a file. More... | |
void | exit (int c=0) |
Stop the run. More... | |
int | fclose (FILE *fp) |
Closes a file opened with PlumedMain::fopen() More... | |
void | fflush () |
Flush all files. More... | |
FILE * | fopen (const char *path, const char *mode) |
Opens a file. More... | |
const ActionSet & | getActionSet () const |
Reference to the list of Action's. More... | |
Atoms & | getAtoms () |
Reference to atoms object. More... | |
double | getBias () const |
get the value of the bias More... | |
bool | getCPT () const |
Check if checkpointing. More... | |
ExchangePatterns & | getExchangePatterns () |
Access to exchange patterns. More... | |
bool | getExchangeStep () const |
Get exchangeStep flag. More... | |
template<typename T > | |
unsigned | getGoodNumThreads (const std::vector< T > &v) const |
Get a reasonable number of threads so as to access to vector v;. More... | |
template<typename T > | |
unsigned | getGoodNumThreads (const T *x, unsigned s) const |
Get a reasonable number of threads so as to access to an array of size s located at x. More... | |
Log & | getLog () |
Referenge to the log stream. More... | |
unsigned | getNumThreads () const |
Get number of threads that can be used by openmp. More... | |
bool | getRestart () const |
Check if restarting. More... | |
long int | getStep () const |
Return the number of the step. More... | |
const std::string & | getSuffix () const |
Get the suffix string. More... | |
double | getWork () const |
get the value of the work More... | |
void | init () |
Initialize the object. More... | |
void | insertFile (FileBase &) |
Insert a file. More... | |
void | justApply () |
Backward propagate and update. More... | |
void | justCalculate () |
Perform the forward loop on active actions. More... | |
void | load (const std::string &) |
Load a shared library. More... | |
void | performCalc () |
Perform the calculation. More... | |
void | performCalcNoForces () |
Perform the calculation without backpropagation nor update() Shortcut for: waitData() + justCalculate() More... | |
void | performCalcNoUpdate () |
Perform the calculation without update() Shortcut for: waitData() + justCalculate() + backwardPropagate() More... | |
void | prepareCalc () |
Prepare the calculation. More... | |
void | prepareDependencies () |
Prepare the list of active Actions and needed atoms. More... | |
void | readInputFile (const std::string &str) |
Read an input file. More... | |
void | readInputFile (IFile &ifile) |
Read an input file. More... | |
void | readInputLine (const std::string &str) |
Read an input string. More... | |
void | readInputLines (const std::string &str) |
Read an input buffer. More... | |
void | readInputWords (const std::vector< std::string > &str) |
Read an input string. More... | |
void | resetActive (bool active) |
Enforce active flag. More... | |
void | runJobsAtEndOfCalculation () |
If there are calculations that need to be done at the very end of the calculations this makes sures they are done. More... | |
void | setEndPlumed () |
Set end of input file. More... | |
void | setExchangeStep (bool f) |
Set exchangeStep flag. More... | |
void | setRestart (bool f) |
Set restart flag. More... | |
void | setSuffix (const std::string &) |
Set the suffix string. More... | |
void | shareData () |
Share the needed atoms. More... | |
void | stop () |
Stop the calculation cleanly (both the MD code and plumed) More... | |
void | update () |
Call the update() method. More... | |
void | updateFlagsPop () |
Pop a state from update flags. More... | |
void | updateFlagsPush (bool) |
Push a state to update flags. More... | |
bool | updateFlagsTop () |
Get top of update flags. More... | |
void | waitData () |
Scatters the needed atoms. More... | |
Public Attributes | |
Communicator & | comm =*comm_fwd |
Communicator for plumed. More... | |
bool | detailedTimers |
Flag to switch on detailed timers. More... | |
Communicator & | multi_sim_comm =*multi_sim_comm_fwd |
bool | novirial |
Flag to switch off virial calculation (for debug and MD codes with no barostat) More... | |
std::map< std::string, double > | passMap |
Generic map string -> double intended to pass information across Actions. More... | |
TypesafePtr & | stopFlag =*stopFlag_fwd |
Stuff to make plumed stop the MD code cleanly. More... | |
bool | stopNow |
std::stack< bool > | updateFlags |
Stack for update flags. More... | |
Private Attributes | |
ActionSet & | actionSet =*actionSet_fwd |
Set of actions found in plumed.dat file. More... | |
ForwardDecl< ActionSet > | actionSet_fwd |
Forward declaration. More... | |
bool | active |
Condition for plumed to be active. More... | |
Atoms & | atoms =*atoms_fwd |
Object containing information about atoms (such as positions,...). More... | |
ForwardDecl< Atoms > | atoms_fwd |
Forward declaration. More... | |
double | bias |
The total bias (=total energy of the restraints) More... | |
Citations & | citations =*citations_fwd |
tools/Citations.holder More... | |
ForwardDecl< Citations > | citations_fwd |
Forward declaration. More... | |
std::unique_ptr< WithCmd > | cltool |
ForwardDecl< Communicator > | comm_fwd |
Forward declaration. More... | |
DLLoader & | dlloader =*dlloader_fwd |
ForwardDecl< DLLoader > | dlloader_fwd |
Forward declaration. More... | |
bool | doCheckPoint |
Flag for checkpointig. More... | |
bool | endPlumed |
End of input file. More... | |
plumed_error_handler | error_handler = {NULL,NULL} |
ExchangePatterns & | exchangePatterns =*exchangePatterns_fwd |
Class of possible exchange patterns, used for BIASEXCHANGE but also for future parallel tempering. More... | |
ForwardDecl< ExchangePatterns > | exchangePatterns_fwd |
Forward declaration. More... | |
bool | exchangeStep |
Set to true if on an exchange step. More... | |
std::set< FileBase * > | files |
Pointers to files opened in actions associated to this object. More... | |
std::unique_ptr< WithCmd > | grex |
bool | initialized |
Flag to avoid double initialization. More... | |
Log & | log =*log_fwd |
Log stream. More... | |
ForwardDecl< Log > | log_fwd |
Forward declaration. More... | |
std::string | MDEngine |
Name of MD engine. More... | |
ForwardDecl< Communicator > | multi_sim_comm_fwd |
Forward declaration. More... | |
std::unique_ptr< DataFetchingObject > | mydatafetcher |
Object containing data we would like to grab and pass back. More... | |
std::vector< ActionPilot * > | pilots |
Set of Pilot actions. More... | |
std::string | plumedDat |
Name of the input file. More... | |
bool | restart |
Flag for restart. More... | |
long int | step |
Present step number. More... | |
ForwardDecl< TypesafePtr > | stopFlag_fwd |
Forward declaration. More... | |
Stopwatch & | stopwatch =*stopwatch_fwd |
ForwardDecl< Stopwatch > | stopwatch_fwd |
Forward declaration. More... | |
std::string | suffix |
Suffix string for file opening, useful for multiple simulations in the same directory. More... | |
double | work |
The total work. More... | |
Main plumed object.
In MD engines this object is not manipulated directly but it is wrapped in plumed or PLMD::Plumed objects. Its main method is cmd(), which defines completely the external plumed interface. It does not contain any static data.
PLMD::PlumedMain::PlumedMain | ( | ) |
PLMD::PlumedMain::~PlumedMain | ( | ) |
void PLMD::PlumedMain::backwardPropagate | ( | ) |
Perform the backward loop on active actions.
Needed to apply the forces back.
void PLMD::PlumedMain::calc | ( | ) |
Complete PLUMED calculation.
Shortcut for prepareCalc() + performCalc()
|
inline |
Call error handler.
Should only be called from plumed_plumedmain_cmd(). If the error handler was not set, returns false.
std::string PLMD::PlumedMain::cite | ( | const std::string & | item | ) |
Add a citation, returning a string containing the reference number, something like "[10]".
|
inlineinherited |
|
inline |
|
inlineinherited |
|
inline |
|
overridevirtual |
cmd method, accessible with standard Plumed.h interface.
key | The name of the command to be executed. |
val | The argument of the command to be executed. It is called as plumed_cmd() or as PLMD::Plumed::cmd() It is the interpreter for plumed commands. It basically contains the definition of the plumed interface. If you want to add a new functionality to the interface between plumed and an MD engine, this is the right place Notice that this interface should always keep retro-compatibility |
Implements PLMD::WithCmd.
virtual void PLMD::WithCmd::cmd |
void PLMD::PlumedMain::eraseFile | ( | FileBase & | f | ) |
Erase a file.
void PLMD::PlumedMain::exit | ( | int | c = 0 | ) |
Stop the run.
int PLMD::PlumedMain::fclose | ( | FILE * | fp | ) |
Closes a file opened with PlumedMain::fopen()
void PLMD::PlumedMain::fflush | ( | ) |
Flush all files.
FILE * PLMD::PlumedMain::fopen | ( | const char * | path, |
const char * | mode | ||
) |
Opens a file.
Similar to plain fopen, but, if it finds an error in opening the file, it also tries with path+suffix. This trick is useful for multiple replica simulations.
|
inline |
Reference to the list of Action's.
|
inline |
Reference to atoms object.
double PLMD::PlumedMain::getBias | ( | ) | const |
get the value of the bias
|
inline |
Check if checkpointing.
|
inline |
Access to exchange patterns.
|
inline |
Get exchangeStep flag.
unsigned PLMD::PlumedMain::getGoodNumThreads | ( | const std::vector< T > & | v | ) | const |
Get a reasonable number of threads so as to access to vector v;.
unsigned PLMD::PlumedMain::getGoodNumThreads | ( | const T * | x, |
unsigned | s | ||
) | const |
Get a reasonable number of threads so as to access to an array of size s located at x.
Log & PLMD::PlumedMain::getLog | ( | ) |
Referenge to the log stream.
unsigned PLMD::PlumedMain::getNumThreads | ( | ) | const |
Get number of threads that can be used by openmp.
|
inline |
Check if restarting.
|
inline |
Return the number of the step.
|
inline |
Get the suffix string.
double PLMD::PlumedMain::getWork | ( | ) | const |
get the value of the work
void PLMD::PlumedMain::init | ( | ) |
Initialize the object.
Should be called once.
void PLMD::PlumedMain::insertFile | ( | FileBase & | f | ) |
Insert a file.
void PLMD::PlumedMain::justApply | ( | ) |
Backward propagate and update.
Shortcut for backwardPropagate() + update() I leave it here for backward compatibility
void PLMD::PlumedMain::justCalculate | ( | ) |
Perform the forward loop on active actions.
void PLMD::PlumedMain::load | ( | const std::string & | ss | ) |
Load a shared library.
void PLMD::PlumedMain::performCalc | ( | ) |
Perform the calculation.
Shortcut for waitData() + justCalculate() + justApply(). Equivalently: waitData() + justCalculate() + backwardPropagate() + update().
void PLMD::PlumedMain::performCalcNoForces | ( | ) |
Perform the calculation without backpropagation nor update() Shortcut for: waitData() + justCalculate()
void PLMD::PlumedMain::performCalcNoUpdate | ( | ) |
Perform the calculation without update() Shortcut for: waitData() + justCalculate() + backwardPropagate()
void PLMD::PlumedMain::prepareCalc | ( | ) |
Prepare the calculation.
Here it is checked which are the active Actions and communication of the relevant atoms is initiated. Shortcut for prepareDependencies() + shareData()
void PLMD::PlumedMain::prepareDependencies | ( | ) |
Prepare the list of active Actions and needed atoms.
Scan the Actions to see which are active and which are not, so as to prepare a list of the atoms needed at this step.
void PLMD::PlumedMain::readInputFile | ( | const std::string & | str | ) |
Read an input file.
str | name of the file |
void PLMD::PlumedMain::readInputFile | ( | IFile & | ifile | ) |
Read an input file.
ifile |
void PLMD::PlumedMain::readInputLine | ( | const std::string & | str | ) |
Read an input string.
str | name of the string At variance with readInputWords(), this is splitting the string into words |
void PLMD::PlumedMain::readInputLines | ( | const std::string & | str | ) |
Read an input buffer.
str | name of the string Same as readInputFile, but first write str on a temporary file and then read that files. At variance with readInputLine, it can take care of comments and continuation lines. |
void PLMD::PlumedMain::readInputWords | ( | const std::vector< std::string > & | str | ) |
Read an input string.
str | name of the string |
|
inline |
Enforce active flag.
This is a (bit dirty) hack to solve a bug. When there is no active ActionPilot, several shortcuts are used. However, these shortcuts can block GREX module. This function allows to enforce active plumed when doing exchanges, thus fixing the bug.
void PLMD::PlumedMain::runJobsAtEndOfCalculation | ( | ) |
If there are calculations that need to be done at the very end of the calculations this makes sures they are done.
|
inline |
Set end of input file.
|
inline |
Set exchangeStep flag.
|
inline |
Set restart flag.
|
inline |
Set the suffix string.
void PLMD::PlumedMain::shareData | ( | ) |
Share the needed atoms.
In asynchronous implementations, this method sends the required atoms to all the plumed processes, without waiting for the communication to complete.
void PLMD::PlumedMain::stop | ( | ) |
Stop the calculation cleanly (both the MD code and plumed)
void PLMD::PlumedMain::update | ( | ) |
Call the update() method.
|
inline |
Pop a state from update flags.
|
inline |
Push a state to update flags.
|
inline |
Get top of update flags.
void PLMD::PlumedMain::waitData | ( | ) |
Scatters the needed atoms.
In asynchronous implementations, this method waits for the communications started in shareData() to be completed. Otherwise, just send around needed atoms.
|
private |
Set of actions found in plumed.dat file.
|
private |
Forward declaration.
|
private |
Condition for plumed to be active.
At every step, PlumedMain is checking if there are Action's requiring some work. If at least one Action requires some work, this variable is set to true.
Object containing information about atoms (such as positions,...).
|
private |
Forward declaration.
|
private |
The total bias (=total energy of the restraints)
|
private |
tools/Citations.holder
|
private |
Forward declaration.
|
private |
Communicator& PLMD::PlumedMain::comm =*comm_fwd |
Communicator for plumed.
Includes all the processors used by plumed.
|
private |
Forward declaration.
bool PLMD::PlumedMain::detailedTimers |
Flag to switch on detailed timers.
|
private |
|
private |
Forward declaration.
|
private |
Flag for checkpointig.
|
private |
End of input file.
Set to true to terminate reading
|
private |
|
private |
Class of possible exchange patterns, used for BIASEXCHANGE but also for future parallel tempering.
|
private |
Forward declaration.
|
private |
Set to true if on an exchange step.
|
private |
Pointers to files opened in actions associated to this object.
Notice that with the current implementation this should be at the top of this structure. Indeed, this should be destroyed after all the actions allocated in this PlumedMain object have been destroyed.
|
private |
|
private |
Flag to avoid double initialization.
|
private |
Forward declaration.
|
private |
Name of MD engine.
Communicator& PLMD::PlumedMain::multi_sim_comm =*multi_sim_comm_fwd |
|
private |
Forward declaration.
|
private |
Object containing data we would like to grab and pass back.
bool PLMD::PlumedMain::novirial |
Flag to switch off virial calculation (for debug and MD codes with no barostat)
std::map<std::string,double> PLMD::PlumedMain::passMap |
Generic map string -> double intended to pass information across Actions.
|
private |
Set of Pilot actions.
These are the action the, if they are Pilot::onStep(), can trigger execution
|
private |
Name of the input file.
|
private |
Flag for restart.
|
private |
Present step number.
TypesafePtr& PLMD::PlumedMain::stopFlag =*stopFlag_fwd |
Stuff to make plumed stop the MD code cleanly.
|
private |
Forward declaration.
bool PLMD::PlumedMain::stopNow |
|
private |
|
private |
Forward declaration.
Should be placed after log since its constructor takes a log reference as an argument.
|
private |
Suffix string for file opening, useful for multiple simulations in the same directory.
std::stack<bool> PLMD::PlumedMain::updateFlags |
Stack for update flags.
Store information used in class generic::UpdateIf
|
private |
The total work.
This computed by accumulating the change in external potentials.
Hosted by GitHub | 1.8.17 |