Classes | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
PLMD::PlumedMain Class Reference

Main plumed object. More...

#include <PlumedMain.h>

Inheritance diagram for PLMD::PlumedMain:
Inheritance graph
[legend]

Classes

class  DeprecatedAtoms
 
struct  plumed_error_handler
 Error handler. More...
 

Public Member Functions

 PlumedMain ()
 
 ~PlumedMain ()
 
void activateParseOnlyMode ()
 Turn on parse only mode to deactivate restart in all actions. More...
 
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 char *key, const TypesafePtr &val=nullptr)
 This is needed to avoid ambiguities. More...
 
void cmd (const char *key, const TypesafePtr &val=nullptr)
 This is needed to avoid ambiguities. More...
 
virtual void cmd (const std::string &key, const TypesafePtr &val=nullptr)
 This is the legacy method we used in older plumed versions, so it is still possible. More...
 
virtual void cmd (const std::string &key, const TypesafePtr &val=nullptr)
 This is the legacy method we used in older plumed versions, so it is still possible. More...
 
void cmd (std::string_view key, const TypesafePtr &val) override
 cmd method, accessible with standard Plumed.h interface. More...
 
void cmd (std::string_view key, const TypesafePtr &val, const std::size_t *shape)
 
void cmd (std::string_view key, const TypesafePtr &val, const std::size_t *shape)
 
template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0>
void cmd (std::string_view key, const TypesafePtr &val, I nelem, const std::size_t *shape=nullptr)
 
template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0>
void cmd (std::string_view key, const TypesafePtr &val, I nelem, const std::size_t *shape=nullptr)
 
void cmd (std::string_view key, const TypesafePtr &val, std::initializer_list< SizeLike > shape)
 
void cmd (std::string_view key, const TypesafePtr &val, std::initializer_list< SizeLike > shape)
 
virtual void cmd (std::string_view key, const TypesafePtr &val=nullptr)
 This is the preferred method as it avoid allocations of temporaries. More...
 
unsigned decreaseReferenceCounter () noexcept
 Atomically decrease reference counter and return the new value. More...
 
void enableNestedExceptions ()
 
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 ActionSetgetActionSet () const
 Reference to the list of Action's. More...
 
DeprecatedAtomsgetAtoms ()
 
double getBias () const
 get the value of the bias More...
 
bool getCPT () const
 Check if checkpointing. More...
 
bool getEndPlumed () const
 Get the value of the end plumed flag. More...
 
ExchangePatternsgetExchangePatterns ()
 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...
 
int getGpuDeviceId () const
 Get the value of the gpuDeviceId. More...
 
void getKeywordsForAction (const std::string &action, Keywords &keys) const
 Get the keywords for a particular action. More...
 
LoggetLog ()
 Referenge to the log stream. More...
 
bool getNestedExceptions () const
 
unsigned getNumThreads () const
 Get number of threads that can be used by openmp. More...
 
int getRealPrecision () const
 Get the real preicision. More...
 
bool getRestart () const
 Check if restarting. More...
 
long long int getStep () const
 Return the number of the step. More...
 
const std::string & getSuffix () const
 Get the suffix string. More...
 
const UnitsgetUnits ()
 Get the units that are being used. More...
 
double getWork () const
 get the value of the work More...
 
unsigned increaseReferenceCounter () noexcept
 Atomically increase reference counter and return the new value. More...
 
void init ()
 Initialize the object. More...
 
bool inputsAreActive () const
 Check if there is active input in the action set. 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...
 
double MDQuantityToPLUMED (const std::string &unit, const TypesafePtr &m) const
 Take a typesafe pointer from the MD code and convert it to a double. More...
 
bool parseOnlyMode () const
 This checks if parse only mode is active and turns off any restart. 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 plumedQuantityToMD (const std::string &unit, const double &eng, const TypesafePtr &m) const
 Take an energy that is calculated by PLUMED and pass it to a typesafe pointer that the MD code can access. More...
 
void prepareCalc ()
 Prepare the calculation. More...
 
void prepareDependencies ()
 Prepare the list of active Actions and needed atoms. More...
 
void readBinary (std::istream &)
 
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, const bool &before_init=false)
 Read an input string. More...
 
void readInputLines (const std::string &str)
 Read an input buffer. More...
 
void readInputWords (const std::vector< std::string > &str, const bool &before_init)
 Read an input string. More...
 
void resetActive (bool active)
 Enforce active flag. More...
 
void resetInputs ()
 If there are calculations that need to be done at the very end of the calculations this makes sures they are done. More...
 
void runJobsAtEndOfCalculation ()
 
void setEndPlumed ()
 Set end of input file. More...
 
void setEnergyValue (const std::string &name)
 Used to set the name of the action that holds the energy. More...
 
void setExchangeStep (bool f)
 Set exchangeStep flag. More...
 
void setInputForce (const std::string &name, const TypesafePtr &val)
 This sets the the forces with a particular name to the pointer to the data in the MD code. More...
 
void setInputValue (const std::string &name, const unsigned &start, const unsigned &stride, const TypesafePtr &val)
 This sets the the value with a particular name to the pointer to the data in the MD code. More...
 
void setRestart (bool f)
 Set restart flag. More...
 
void setSuffix (const std::string &)
 Set the suffix string. More...
 
void setUnits (const bool &natural, const Units &u)
 This updates the units of the input quantities. More...
 
void shareAll ()
 Ensure that all the atoms are shared. 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...
 
unsigned useCountReferenceCounter () const noexcept
 Report the reference counter. More...
 
bool usingNaturalUnits () const
 Are we using natural units. More...
 
bool valueExists (const std::string &name) const
 This determines if the user has created a value to hold the quantity that is being passed. More...
 
void waitData ()
 Scatters the needed atoms. More...
 
void writeBinary (std::ostream &) const
 Transfer information from input MD code. More...
 

Public Attributes

Communicatorcomm =*comm_fwd
 Communicator for plumed. More...
 
bool detailedTimers =false
 Flag to switch on detailed timers. More...
 
int gpuDeviceId =-1
 GpuDevice Identifier. More...
 
Communicatormulti_sim_comm =*multi_sim_comm_fwd
 
bool novirial =false
 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...
 
TypesafePtrstopFlag =*stopFlag_fwd
 Stuff to make plumed stop the MD code cleanly. More...
 
bool stopNow =false
 
std::stack< bool > updateFlags
 Stack for update flags. More...
 

Private Member Functions

void setupInterfaceActions ()
 This sets up the vector that contains the interface to the MD code. More...
 
void startStep ()
 This sets up the values that are set from the MD code. More...
 

Private Attributes

ActionSetactionSet =*actionSet_fwd
 Set of actions found in plumed.dat file. More...
 
ForwardDecl< ActionSetactionSet_fwd
 Forward declaration. More...
 
bool active =false
 Condition for plumed to be active. More...
 
double bias =0.0
 The total bias (=total energy of the restraints) More...
 
Citationscitations =*citations_fwd
 tools/Citations.holder More...
 
ForwardDecl< Citationscitations_fwd
 Forward declaration. More...
 
std::unique_ptr< WithCmdcltool
 
ForwardDecl< Communicatorcomm_fwd
 Forward declaration. More...
 
DeprecatedAtomsdatoms =*datoms_fwd
 Object containing old bits of atoms that are used by many folks. More...
 
ForwardDecl< DeprecatedAtomsdatoms_fwd
 Forward declaration. More...
 
DLLoaderdlloader =*dlloader_fwd
 
ForwardDecl< DLLoaderdlloader_fwd
 Forward declaration. More...
 
bool doCheckPoint =false
 Flag for checkpointig. More...
 
bool doParseOnly =false
 Flag for parse only mode – basically just forces restart to turn off. More...
 
bool endPlumed =false
 End of input file. More...
 
plumed_error_handler error_handler = {NULL,NULL}
 
ExchangePatternsexchangePatterns =*exchangePatterns_fwd
 Class of possible exchange patterns, used for BIASEXCHANGE but also for future parallel tempering. More...
 
ForwardDecl< ExchangePatternsexchangePatterns_fwd
 Forward declaration. More...
 
bool exchangeStep =false
 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< WithCmdgrex
 
bool initialized =false
 Flag to avoid double initialization. More...
 
std::vector< ActionForInterface * > inputs
 Vector of actions that are passed data from the MD code. More...
 
Loglog =*log_fwd
 Log stream. More...
 
ForwardDecl< Loglog_fwd
 Forward declaration. More...
 
std::string MDEngine {"mdcode"}
 Name of MD engine. More...
 
ForwardDecl< Communicatormulti_sim_comm_fwd
 Forward declaration. More...
 
std::string name_of_energy {""}
 A string that holds the name of the action that gets the energy from the MD code. More...
 
bool nestedExceptions =false
 
std::unique_ptr< DataPassingToolspasstools
 These are tools to pass data to PLUMED. More...
 
std::vector< ActionPilot * > pilots
 Set of Pilot actions. More...
 
std::string plumedDat
 Name of the input file. More...
 
std::atomic< unsigned > referenceCounter {}
 
bool restart =false
 Flag for restart. More...
 
long long int step =0
 Present step number. More...
 
ForwardDecl< TypesafePtrstopFlag_fwd
 Forward declaration. More...
 
Stopwatchstopwatch =*stopwatch_fwd
 
ForwardDecl< Stopwatchstopwatch_fwd
 Forward declaration. More...
 
std::string suffix
 Suffix string for file opening, useful for multiple simulations in the same directory. More...
 
double work =0.0
 The total work. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PlumedMain()

PLMD::PlumedMain::PlumedMain ( )

◆ ~PlumedMain()

PLMD::PlumedMain::~PlumedMain ( )

Member Function Documentation

◆ activateParseOnlyMode()

void PLMD::PlumedMain::activateParseOnlyMode ( )

Turn on parse only mode to deactivate restart in all actions.

This is only used by plumed driver –parse-only

◆ backwardPropagate()

void PLMD::PlumedMain::backwardPropagate ( )

Perform the backward loop on active actions.

Needed to apply the forces back.

◆ calc()

void PLMD::PlumedMain::calc ( )

Complete PLUMED calculation.

Shortcut for prepareCalc() + performCalc()

◆ callErrorHandler()

bool PLMD::PlumedMain::callErrorHandler ( int  code,
const char *  msg 
) const
inline

Call error handler.

Should only be called from plumed_plumedmain_cmd(). If the error handler was not set, returns false.

◆ cite()

std::string PLMD::PlumedMain::cite ( const std::string &  item)

Add a citation, returning a string containing the reference number, something like "[10]".

◆ cmd() [1/12]

void PLMD::WithCmd::cmd ( const char *  key,
const TypesafePtr val = nullptr 
)
inlineinherited

This is needed to avoid ambiguities.

◆ cmd() [2/12]

void PLMD::WithCmd::cmd
inline

This is needed to avoid ambiguities.

◆ cmd() [3/12]

virtual void PLMD::WithCmd::cmd ( const std::string &  key,
const TypesafePtr val = nullptr 
)
inlinevirtualinherited

This is the legacy method we used in older plumed versions, so it is still possible.

If this is not overridden, it will call the preferred method

◆ cmd() [4/12]

virtual void PLMD::WithCmd::cmd
inline

This is the legacy method we used in older plumed versions, so it is still possible.

If this is not overridden, it will call the preferred method

◆ cmd() [5/12]

void PLMD::PlumedMain::cmd ( std::string_view  key,
const TypesafePtr val 
)
overridevirtual

cmd method, accessible with standard Plumed.h interface.

Parameters
keyThe name of the command to be executed.
valThe 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

Reimplemented from PLMD::WithCmd.

◆ cmd() [6/12]

void PLMD::WithCmd::cmd ( std::string_view  key,
const TypesafePtr val,
const std::size_t *  shape 
)
inlineinherited

◆ cmd() [7/12]

void PLMD::WithCmd::cmd
inline

◆ cmd() [8/12]

template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0>
void PLMD::WithCmd::cmd ( std::string_view  key,
const TypesafePtr val,
nelem,
const std::size_t *  shape = nullptr 
)
inlineinherited

◆ cmd() [9/12]

template<typename I , typename std::enable_if< std::is_integral< I >::value, int >::type = 0>
void PLMD::WithCmd::cmd ( typename I  ,
typename std::enable_if< std::is_integral< I >::value, int >::type  = 0 
)
inline

◆ cmd() [10/12]

void PLMD::WithCmd::cmd ( std::string_view  key,
const TypesafePtr val,
std::initializer_list< SizeLike shape 
)
inlineinherited

◆ cmd() [11/12]

void PLMD::WithCmd::cmd
inline

◆ cmd() [12/12]

virtual void PLMD::WithCmd::cmd
inline

This is the preferred method as it avoid allocations of temporaries.

If this is not overridded, it will call the legacy method.

◆ decreaseReferenceCounter()

unsigned PLMD::PlumedMain::decreaseReferenceCounter ( )
noexcept

Atomically decrease reference counter and return the new value.

◆ enableNestedExceptions()

void PLMD::PlumedMain::enableNestedExceptions ( )

◆ eraseFile()

void PLMD::PlumedMain::eraseFile ( FileBase f)

Erase a file.

◆ exit()

void PLMD::PlumedMain::exit ( int  c = 0)

Stop the run.

◆ fclose()

int PLMD::PlumedMain::fclose ( FILE *  fp)

Closes a file opened with PlumedMain::fopen()

◆ fflush()

void PLMD::PlumedMain::fflush ( )

Flush all files.

◆ fopen()

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.

◆ getActionSet()

const ActionSet & PLMD::PlumedMain::getActionSet ( ) const
inline

Reference to the list of Action's.

◆ getAtoms()

PlumedMain::DeprecatedAtoms & PLMD::PlumedMain::getAtoms ( )

◆ getBias()

double PLMD::PlumedMain::getBias ( ) const

get the value of the bias

◆ getCPT()

bool PLMD::PlumedMain::getCPT ( ) const
inline

Check if checkpointing.

◆ getEndPlumed()

bool PLMD::PlumedMain::getEndPlumed ( ) const
inline

Get the value of the end plumed flag.

◆ getExchangePatterns()

ExchangePatterns& PLMD::PlumedMain::getExchangePatterns ( )
inline

Access to exchange patterns.

◆ getExchangeStep()

bool PLMD::PlumedMain::getExchangeStep ( ) const
inline

Get exchangeStep flag.

◆ getGoodNumThreads() [1/2]

template<typename T >
unsigned PLMD::PlumedMain::getGoodNumThreads ( const std::vector< T > &  v) const

Get a reasonable number of threads so as to access to vector v;.

◆ getGoodNumThreads() [2/2]

template<typename T >
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.

◆ getGpuDeviceId()

int PLMD::PlumedMain::getGpuDeviceId ( ) const
inline

Get the value of the gpuDeviceId.

◆ getKeywordsForAction()

void PLMD::PlumedMain::getKeywordsForAction ( const std::string &  action,
Keywords keys 
) const

Get the keywords for a particular action.

◆ getLog()

Log & PLMD::PlumedMain::getLog ( )

Referenge to the log stream.

◆ getNestedExceptions()

bool PLMD::PlumedMain::getNestedExceptions ( ) const
inline

◆ getNumThreads()

unsigned PLMD::PlumedMain::getNumThreads ( ) const

Get number of threads that can be used by openmp.

◆ getRealPrecision()

int PLMD::PlumedMain::getRealPrecision ( ) const

Get the real preicision.

◆ getRestart()

bool PLMD::PlumedMain::getRestart ( ) const
inline

Check if restarting.

◆ getStep()

long long int PLMD::PlumedMain::getStep ( ) const
inline

Return the number of the step.

◆ getSuffix()

const std::string & PLMD::PlumedMain::getSuffix ( ) const
inline

Get the suffix string.

◆ getUnits()

const Units & PLMD::PlumedMain::getUnits ( )

Get the units that are being used.

◆ getWork()

double PLMD::PlumedMain::getWork ( ) const

get the value of the work

◆ increaseReferenceCounter()

unsigned PLMD::PlumedMain::increaseReferenceCounter ( )
noexcept

Atomically increase reference counter and return the new value.

◆ init()

void PLMD::PlumedMain::init ( )

Initialize the object.

Should be called once.

◆ inputsAreActive()

bool PLMD::PlumedMain::inputsAreActive ( ) const

Check if there is active input in the action set.

◆ insertFile()

void PLMD::PlumedMain::insertFile ( FileBase f)

Insert a file.

◆ justApply()

void PLMD::PlumedMain::justApply ( )

Backward propagate and update.

Shortcut for backwardPropagate() + update() I leave it here for backward compatibility

◆ justCalculate()

void PLMD::PlumedMain::justCalculate ( )

Perform the forward loop on active actions.

◆ load()

void PLMD::PlumedMain::load ( const std::string &  fileName)

Load a shared library.

◆ MDQuantityToPLUMED()

double PLMD::PlumedMain::MDQuantityToPLUMED ( const std::string &  unit,
const TypesafePtr m 
) const

Take a typesafe pointer from the MD code and convert it to a double.

◆ parseOnlyMode()

bool PLMD::PlumedMain::parseOnlyMode ( ) const

This checks if parse only mode is active and turns off any restart.

◆ performCalc()

void PLMD::PlumedMain::performCalc ( )

Perform the calculation.

Shortcut for waitData() + justCalculate() + justApply(). Equivalently: waitData() + justCalculate() + backwardPropagate() + update().

◆ performCalcNoForces()

void PLMD::PlumedMain::performCalcNoForces ( )

Perform the calculation without backpropagation nor update() Shortcut for: waitData() + justCalculate()

◆ performCalcNoUpdate()

void PLMD::PlumedMain::performCalcNoUpdate ( )

Perform the calculation without update() Shortcut for: waitData() + justCalculate() + backwardPropagate()

◆ plumedQuantityToMD()

void PLMD::PlumedMain::plumedQuantityToMD ( const std::string &  unit,
const double &  eng,
const TypesafePtr m 
) const

Take an energy that is calculated by PLUMED and pass it to a typesafe pointer that the MD code can access.

◆ prepareCalc()

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()

◆ prepareDependencies()

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.

◆ readBinary()

void PLMD::PlumedMain::readBinary ( std::istream &  i)

◆ readInputFile() [1/2]

void PLMD::PlumedMain::readInputFile ( const std::string &  str)

Read an input file.

Parameters
strname of the file

◆ readInputFile() [2/2]

void PLMD::PlumedMain::readInputFile ( IFile ifile)

Read an input file.

Parameters
ifile

◆ readInputLine()

void PLMD::PlumedMain::readInputLine ( const std::string &  str,
const bool &  before_init = false 
)

Read an input string.

Parameters
strname of the string At variance with readInputWords(), this is splitting the string into words

◆ readInputLines()

void PLMD::PlumedMain::readInputLines ( const std::string &  str)

Read an input buffer.

Parameters
strname 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.

◆ readInputWords()

void PLMD::PlumedMain::readInputWords ( const std::vector< std::string > &  str,
const bool &  before_init 
)

Read an input string.

Parameters
strname of the string

◆ resetActive()

void PLMD::PlumedMain::resetActive ( bool  active)
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.

◆ resetInputs()

void PLMD::PlumedMain::resetInputs ( )

If there are calculations that need to be done at the very end of the calculations this makes sures they are done.

This function does clearInputForces for the list of atoms that have a force on them. This is an optimisation to prevent calling std::fill over a large array

◆ runJobsAtEndOfCalculation()

void PLMD::PlumedMain::runJobsAtEndOfCalculation ( )

◆ setEndPlumed()

void PLMD::PlumedMain::setEndPlumed ( )
inline

Set end of input file.

◆ setEnergyValue()

void PLMD::PlumedMain::setEnergyValue ( const std::string &  name)

Used to set the name of the action that holds the energy.

◆ setExchangeStep()

void PLMD::PlumedMain::setExchangeStep ( bool  f)
inline

Set exchangeStep flag.

◆ setInputForce()

void PLMD::PlumedMain::setInputForce ( const std::string &  name,
const TypesafePtr val 
)

This sets the the forces with a particular name to the pointer to the data in the MD code.

◆ setInputValue()

void PLMD::PlumedMain::setInputValue ( const std::string &  name,
const unsigned &  start,
const unsigned &  stride,
const TypesafePtr val 
)

This sets the the value with a particular name to the pointer to the data in the MD code.

◆ setRestart()

void PLMD::PlumedMain::setRestart ( bool  f)
inline

Set restart flag.

◆ setSuffix()

void PLMD::PlumedMain::setSuffix ( const std::string &  s)
inline

Set the suffix string.

◆ setUnits()

void PLMD::PlumedMain::setUnits ( const bool &  natural,
const Units u 
)

This updates the units of the input quantities.

◆ setupInterfaceActions()

void PLMD::PlumedMain::setupInterfaceActions ( )
private

This sets up the vector that contains the interface to the MD code.

◆ shareAll()

void PLMD::PlumedMain::shareAll ( )

Ensure that all the atoms are shared.

This is used in GREX to ensure that we transfer all the positions from the MD code to PLUMED.

◆ shareData()

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.

◆ startStep()

void PLMD::PlumedMain::startStep ( )
private

This sets up the values that are set from the MD code.

◆ stop()

void PLMD::PlumedMain::stop ( )

Stop the calculation cleanly (both the MD code and plumed)

◆ update()

void PLMD::PlumedMain::update ( )

Call the update() method.

◆ updateFlagsPop()

void PLMD::PlumedMain::updateFlagsPop ( )
inline

Pop a state from update flags.

◆ updateFlagsPush()

void PLMD::PlumedMain::updateFlagsPush ( bool  on)
inline

Push a state to update flags.

◆ updateFlagsTop()

bool PLMD::PlumedMain::updateFlagsTop ( )
inline

Get top of update flags.

◆ useCountReferenceCounter()

unsigned PLMD::PlumedMain::useCountReferenceCounter ( ) const
noexcept

Report the reference counter.

◆ usingNaturalUnits()

bool PLMD::PlumedMain::usingNaturalUnits ( ) const

Are we using natural units.

◆ valueExists()

bool PLMD::PlumedMain::valueExists ( const std::string &  name) const

This determines if the user has created a value to hold the quantity that is being passed.

◆ waitData()

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.

◆ writeBinary()

void PLMD::PlumedMain::writeBinary ( std::ostream &  o) const

Transfer information from input MD code.

Member Data Documentation

◆ actionSet

ActionSet& PLMD::PlumedMain::actionSet =*actionSet_fwd
private

Set of actions found in plumed.dat file.

◆ actionSet_fwd

ForwardDecl<ActionSet> PLMD::PlumedMain::actionSet_fwd
private

Forward declaration.

◆ active

bool PLMD::PlumedMain::active =false
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.

◆ bias

double PLMD::PlumedMain::bias =0.0
private

The total bias (=total energy of the restraints)

◆ citations

Citations& PLMD::PlumedMain::citations =*citations_fwd
private

tools/Citations.holder

◆ citations_fwd

ForwardDecl<Citations> PLMD::PlumedMain::citations_fwd
private

Forward declaration.

◆ cltool

std::unique_ptr<WithCmd> PLMD::PlumedMain::cltool
private

◆ comm

Communicator& PLMD::PlumedMain::comm =*comm_fwd

Communicator for plumed.

Includes all the processors used by plumed.

◆ comm_fwd

ForwardDecl<Communicator> PLMD::PlumedMain::comm_fwd
private

Forward declaration.

◆ datoms

DeprecatedAtoms& PLMD::PlumedMain::datoms =*datoms_fwd
private

Object containing old bits of atoms that are used by many folks.

◆ datoms_fwd

ForwardDecl<DeprecatedAtoms> PLMD::PlumedMain::datoms_fwd
private

Forward declaration.

◆ detailedTimers

bool PLMD::PlumedMain::detailedTimers =false

Flag to switch on detailed timers.

◆ dlloader

DLLoader& PLMD::PlumedMain::dlloader =*dlloader_fwd
private

◆ dlloader_fwd

ForwardDecl<DLLoader> PLMD::PlumedMain::dlloader_fwd
private

Forward declaration.

◆ doCheckPoint

bool PLMD::PlumedMain::doCheckPoint =false
private

Flag for checkpointig.

◆ doParseOnly

bool PLMD::PlumedMain::doParseOnly =false
private

Flag for parse only mode – basically just forces restart to turn off.

◆ endPlumed

bool PLMD::PlumedMain::endPlumed =false
private

End of input file.

Set to true to terminate reading

◆ error_handler

plumed_error_handler PLMD::PlumedMain::error_handler = {NULL,NULL}
private

◆ exchangePatterns

ExchangePatterns& PLMD::PlumedMain::exchangePatterns =*exchangePatterns_fwd
private

Class of possible exchange patterns, used for BIASEXCHANGE but also for future parallel tempering.

◆ exchangePatterns_fwd

ForwardDecl<ExchangePatterns> PLMD::PlumedMain::exchangePatterns_fwd
private

Forward declaration.

◆ exchangeStep

bool PLMD::PlumedMain::exchangeStep =false
private

Set to true if on an exchange step.

◆ files

std::set<FileBase*> PLMD::PlumedMain::files
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.

◆ gpuDeviceId

int PLMD::PlumedMain::gpuDeviceId =-1

GpuDevice Identifier.

◆ grex

std::unique_ptr<WithCmd> PLMD::PlumedMain::grex
private

◆ initialized

bool PLMD::PlumedMain::initialized =false
private

Flag to avoid double initialization.

◆ inputs

std::vector<ActionForInterface*> PLMD::PlumedMain::inputs
private

Vector of actions that are passed data from the MD code.

◆ log

Log& PLMD::PlumedMain::log =*log_fwd
private

Log stream.

◆ log_fwd

ForwardDecl<Log> PLMD::PlumedMain::log_fwd
private

Forward declaration.

◆ MDEngine

std::string PLMD::PlumedMain::MDEngine {"mdcode"}
private

Name of MD engine.

◆ multi_sim_comm

Communicator& PLMD::PlumedMain::multi_sim_comm =*multi_sim_comm_fwd

◆ multi_sim_comm_fwd

ForwardDecl<Communicator> PLMD::PlumedMain::multi_sim_comm_fwd
private

Forward declaration.

◆ name_of_energy

std::string PLMD::PlumedMain::name_of_energy {""}
private

A string that holds the name of the action that gets the energy from the MD code.

Set empty if energy is not used.

◆ nestedExceptions

bool PLMD::PlumedMain::nestedExceptions =false
private

◆ novirial

bool PLMD::PlumedMain::novirial =false

Flag to switch off virial calculation (for debug and MD codes with no barostat)

◆ passMap

std::map<std::string,double> PLMD::PlumedMain::passMap

Generic map string -> double intended to pass information across Actions.

◆ passtools

std::unique_ptr<DataPassingTools> PLMD::PlumedMain::passtools
private

These are tools to pass data to PLUMED.

◆ pilots

std::vector<ActionPilot*> PLMD::PlumedMain::pilots
private

Set of Pilot actions.

These are the action the, if they are Pilot::onStep(), can trigger execution

◆ plumedDat

std::string PLMD::PlumedMain::plumedDat
private

Name of the input file.

◆ referenceCounter

std::atomic<unsigned> PLMD::PlumedMain::referenceCounter {}
private

◆ restart

bool PLMD::PlumedMain::restart =false
private

Flag for restart.

◆ step

long long int PLMD::PlumedMain::step =0
private

Present step number.

◆ stopFlag

TypesafePtr& PLMD::PlumedMain::stopFlag =*stopFlag_fwd

Stuff to make plumed stop the MD code cleanly.

◆ stopFlag_fwd

ForwardDecl<TypesafePtr> PLMD::PlumedMain::stopFlag_fwd
private

Forward declaration.

◆ stopNow

bool PLMD::PlumedMain::stopNow =false

◆ stopwatch

Stopwatch& PLMD::PlumedMain::stopwatch =*stopwatch_fwd
private

◆ stopwatch_fwd

ForwardDecl<Stopwatch> PLMD::PlumedMain::stopwatch_fwd
private

Forward declaration.

Should be placed after log since its constructor takes a log reference as an argument.

◆ suffix

std::string PLMD::PlumedMain::suffix
private

Suffix string for file opening, useful for multiple simulations in the same directory.

◆ updateFlags

std::stack<bool> PLMD::PlumedMain::updateFlags

Stack for update flags.

Store information used in class generic::UpdateIf

◆ work

double PLMD::PlumedMain::work =0.0
private

The total work.

This computed by accumulating the change in external potentials.


The documentation for this class was generated from the following files: