diff --git a/src/tools/IFile.cpp b/src/tools/IFile.cpp index 7259eec5ad385846fffa8a5887cd7289b0610ae2..085c4ab925ca22d1e875c1e435c619698e7e0e28 100644 --- a/src/tools/IFile.cpp +++ b/src/tools/IFile.cpp @@ -48,7 +48,7 @@ size_t IFile::llread(char*ptr,size_t s) { if(rr<0) err=true; r=rr; #else - plumed_merror("trying to use a gz file without zlib being linked"); + plumed_merror("file " + getPath() + ": trying to use a gz file without zlib being linked"); #endif } else { r=fread(ptr,1,s,fp); @@ -94,7 +94,7 @@ IFile& IFile::advanceField() { } done=true; } else if( !words.empty() ) { - plumed_merror(getPath() + " mismatch between number of fields in file and expected number"); + plumed_merror("file " + getPath() + ": mismatch between number of fields in file and expected number"); } } } @@ -115,7 +115,7 @@ IFile& IFile::open(const std::string&path) { #ifdef __PLUMED_HAS_ZLIB gzfp=(void*)gzopen(const_cast<char*>(this->path.c_str()),"r"); #else - plumed_merror("trying to use a gz file without zlib being linked"); + plumed_merror("file " + getPath() + ": trying to use a gz file without zlib being linked"); #endif } if(plumed) plumed->insertFile(*this); @@ -230,7 +230,9 @@ IFile& IFile::getline(std::string &str) { unsigned IFile::findField(const std::string&name)const { unsigned i; for(i=0; i<fields.size(); i++) if(fields[i].name==name) break; - if(i>=fields.size()) plumed_merror(name); + if(i>=fields.size()) { + plumed_merror("file " + getPath() + ": field " + name + " cannot be found"); + } return i; } diff --git a/src/tools/OFile.cpp b/src/tools/OFile.cpp index 0681444d103dc3d13a504a3284e65b44dd2df637..2bb7a025b09ee18d26b95e37eedc787c9a5c7855 100644 --- a/src/tools/OFile.cpp +++ b/src/tools/OFile.cpp @@ -49,7 +49,7 @@ size_t OFile::llwrite(const char*ptr,size_t s) { #ifdef __PLUMED_HAS_ZLIB r=gzwrite(gzFile(gzfp),ptr,s); #else - plumed_merror("trying to use a gz file without zlib being linked"); + plumed_merror("file " + getPath() + ": trying to use a gz file without zlib being linked"); #endif } else { r=fwrite(ptr,1,s,fp); @@ -301,7 +301,7 @@ OFile& OFile::open(const std::string&path) { #ifdef __PLUMED_HAS_ZLIB gzfp=(void*)gzopen(const_cast<char*>(this->path.c_str()),"a9"); #else - plumed_merror("trying to use a gz file without zlib being linked"); + plumed_merror("file " + getPath() + ": trying to use a gz file without zlib being linked"); #endif } } else { @@ -313,7 +313,7 @@ OFile& OFile::open(const std::string&path) { #ifdef __PLUMED_HAS_ZLIB gzfp=(void*)gzopen(const_cast<char*>(this->path.c_str()),"w9"); #else - plumed_merror("trying to use a gz file without zlib being linked"); + plumed_merror("file " + getPath() + ": trying to use a gz file without zlib being linked"); #endif } }