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

Fixed opening of Files

Removed explicit open mode, so that auto backup/auto restart is used also
for DUMPPROJECTIONS, DUMPDERIVATIVES and DUMPFORCES. Regtests has been added
with backup files.

I also removed some unnecessary c_str().
parent f6798ad8
No related branches found
No related tags found
No related merge requests found
fake file just to test backup
fake file just to test backup
fake file just to test backup
fake file just to test backup
fake file just to test backup
fake file just to test backup
......@@ -475,8 +475,7 @@ isFirstStep(true)
// open hills file for writing
hillsOfile_.link(*this);
if(plumed.getRestart()) hillsOfile_.open(ifilesnames[mw_id_],"aw");
else hillsOfile_.open(ifilesnames[mw_id_]);
hillsOfile_.open(ifilesnames[mw_id_]);
if(fmt.length()>0) hillsOfile_.fmtField(fmt);
hillsOfile_.addConstantField("multivariate");
hillsOfile_.setHeavyFlush();
......
......@@ -153,7 +153,7 @@ DumpAtoms::DumpAtoms(const ActionOptions&ao):
checkRead();
of.link(*this);
of.open(file.c_str());
of.open(file);
log.printf(" printing the following atoms in %s :", unitname.c_str() );
for(unsigned i=0;i<atoms.size();++i) log.printf(" %d",atoms[i].serial() );
log.printf("\n");
......
......@@ -91,7 +91,7 @@ fmt("%15.10f")
parse("FMT",fmt);
fmt=" "+fmt;
of.link(*this);
of.open(file,"wa");
of.open(file);
log.printf(" on file %s\n",file.c_str());
log.printf(" with format %s\n",fmt.c_str());
unsigned nargs=getNumberOfArguments();
......
......@@ -87,7 +87,7 @@ ActionWithArguments(ao)
parse("FILE",file);
if( file.length()==0 ) error("name of file was not specified");
of.link(*this);
of.open(file,"wa");
of.open(file);
log.printf(" on file %s\n",file.c_str());
if( getNumberOfArguments()==0 ) error("no arguments have been specified");
checkRead();
......
......@@ -75,7 +75,7 @@ fmt("%15.10f")
if( file.length()==0 ) error("filename not specified");
parse("FMT",fmt);
fmt=" "+fmt;
of.open(file.c_str(),"wa");
of.open(file);
log.printf(" on file %s\n",file.c_str());
log.printf(" with format %s\n",fmt.c_str());
checkRead();
......
......@@ -101,7 +101,7 @@ rotate(0)
ofile.link(*this);
parse("FILE",file);
if(file.length()>0){
ofile.open(file.c_str());
ofile.open(file);
log.printf(" on file %s\n",file.c_str());
} else {
log.printf(" on plumed log file\n");
......
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