Skip to content
Snippets Groups Projects
Commit afd1b872 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added interface to Gromacs-like Replica EXchange

I am starting to merge my GREX branch, which should be
general enough to be used in any REX framework where
coordinates are swapped (a-la-gromacs). Since GREX
significantly modifies the MD-PLUMED interface through
the addition of several new cmd(), I tried to encapsulate
it as a separate objects with a cmd()-like interface.
Commands from MD starting with GREX are automatically
forwarded to that object. E.g.
plumed_cmd(plumed,"GREX init",NULL);
or so should initialize the GREX object, etc.

Up to this point I just upload the interface, later
on I will add the real GREX object, for which I still
have to do some cleaning.
parent c1049ce1
No related branches found
No related tags found
No related merge requests found
......@@ -73,13 +73,17 @@ static class PlumedMainInitializer{
PlumedMain::PlumedMain():
initialized(false),
grex(NULL),
log(comm),
step(0),
active(false),
atoms(*this),
actionSet((*this)),
novirial(false)
{
{}
PlumedMain::~PlumedMain(){
if(grex) delete grex;
}
/////////////////////////////////////////////////////////////
......@@ -259,6 +263,9 @@ void PlumedMain::cmd(const std::string & word,void*val){
int check=0;
if(actionRegister().check(words[1])) check=1;
*(static_cast<int*>(val))=check;
} else if(nw==2 && words[0]=="GREX"){
assert(grex);
grex->cmd(words[1],val);
} else{
// error
fprintf(stderr,"+++ PLUMED ERROR\n");
......
......@@ -47,6 +47,7 @@ public:
PlumedCommunicator comm;
private:
WithCmd* grex;
/// Flag to avoid double initialization
bool initialized;
/// Name of MD engine
......@@ -91,7 +92,7 @@ public:
/// and an MD engine, this is the right place
/// Notice that this interface should always keep retro-compatibility
void cmd(const std::string&key,void*val=NULL);
~PlumedMain(){};
~PlumedMain();
/// Read an input file.
/// \param str name of the file
void readInputFile(std::string str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment