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

Merge branch 'v2.0'

parents 6dfa27af 2ff611f3
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ In addition, it is now much easier to contribute new functionality to the code b
- A modular structure
- Developer and user documentation
After release, we will document here fixes and additions on the 2.0.x series.
Version 2.0.1:
- Several small fixes in documentation and log file
- Added message when "plumed simpled" is used on a non-existing file
*/
......@@ -190,6 +190,10 @@ read_input(double& temperature,
void read_natoms(const string & inputfile,int & natoms){
// read the number of atoms in file "input.xyz"
FILE* fp=fopen(inputfile.c_str(),"r");
if(!fp){
fprintf(stderr,"ERROR: file %s not found\n",inputfile.c_str());
exit(1);
}
fscanf(fp,"%1000d",&natoms);
fclose(fp);
}
......@@ -198,6 +202,10 @@ void read_positions(const string& inputfile,int natoms,vector<Vector>& positions
// read positions and cell from a file called inputfile
// natoms (input variable) and number of atoms in the file should be consistent
FILE* fp=fopen(inputfile.c_str(),"r");
if(!fp){
fprintf(stderr,"ERROR: file %s not found\n",inputfile.c_str());
exit(1);
}
char buffer[256];
char atomname[256];
fgets(buffer,256,fp);
......
......@@ -157,7 +157,13 @@ bool CLTool::readInputFile( int argc, char**argv, FILE* in, FILE*out ){
}
FILE* mystdin=in;
if(argc==2) mystdin=fopen(argv[1],"r");
if(argc==2){
mystdin=fopen(argv[1],"r");
if(!mystdin){
fprintf(stderr,"ERROR: cannot open file %s\n",argv[1]);
return false;
}
}
char buffer[256]; std::string line; line.resize(256);
while(fgets(buffer,256,mystdin)){
......
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