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

forgot this

parent 3c1dd169
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ DEBUG logRequestedAtoms STRIDE=2
class Debug:
public ActionPilot
{
OFile ofile;
bool logActivity;
bool logRequestedAtoms;
bool novirial;
......@@ -71,6 +72,7 @@ void Debug::registerKeywords( Keywords& keys ){
keys.addFlag("logRequestedAtoms",false,"write in the log which atoms have been requested at a given time");
keys.addFlag("NOVIRIAL",false,"switch off the virial contribution for the entirity of the simulation");
keys.addFlag("DETAILED_TIMERS",false,"switch on detailed timers");
keys.add("optional","FILE","the name of the file on which to output these quantities");
}
Debug::Debug(const ActionOptions&ao):
......@@ -89,6 +91,16 @@ novirial(false){
parseFlag("DETAILED_TIMERS",detailedTimers);
if(detailedTimers) log.printf(" Detailed timing on\n");
plumed.detailedTimers=true;
ofile.link(*this);
std::string file;
parse("FILE",file);
if(file.length()>0){
ofile.open(file);
log.printf(" on file %s\n",file.c_str());
} else {
log.printf(" on plumed log file\n");
ofile.link(log);
}
checkRead();
}
......@@ -101,23 +113,23 @@ void Debug::apply(){
if((*p)->isActive()) a++;
};
if(a>0){
log.printf("activity at step %i: ",getStep());
ofile.printf("activity at step %i: ",getStep());
for(ActionSet::const_iterator p=actionSet.begin();p!=actionSet.end();++p){
if(dynamic_cast<Debug*>(*p))continue;
if((*p)->isActive()) log.printf("+");
else log.printf("-");
if((*p)->isActive()) ofile.printf("+");
else ofile.printf("-");
};
log.printf("\n");
ofile.printf("\n");
};
};
if(logRequestedAtoms){
log.printf("requested atoms at step %i: ",getStep());
ofile.printf("requested atoms at step %i: ",getStep());
int* l;
int n;
plumed.cmd("createFullList",&n);
plumed.cmd("getFullList",&l);
for(int i=0;i<n;i++) log.printf(" %d",l[i]);
log.printf("\n");
for(int i=0;i<n;i++) ofile.printf(" %d",l[i]);
ofile.printf("\n");
plumed.cmd("clearFullList");
}
......
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