diff --git a/CHANGES/v2.0.txt b/CHANGES/v2.0.txt index 4ca22f4d261790d14b618b49bacea7afc6fcb6b3..ca6e4277ed84d477e091c4fd90e8444722f058e9 100644 --- a/CHANGES/v2.0.txt +++ b/CHANGES/v2.0.txt @@ -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 */ diff --git a/src/cltools/SimpleMD.cpp b/src/cltools/SimpleMD.cpp index 62fb7f9807ac8cc91b206fbb1d86f0c556ab6d5d..22413465654f563cd324131401e8fa10f90ea2f6 100644 --- a/src/cltools/SimpleMD.cpp +++ b/src/cltools/SimpleMD.cpp @@ -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); diff --git a/src/core/CLTool.cpp b/src/core/CLTool.cpp index 30e2d776c26cab84f97ed2ca4e545d7a7a6e3e34..1b871643d649fd651795a7a36b8d0170cb8b6e3e 100644 --- a/src/core/CLTool.cpp +++ b/src/core/CLTool.cpp @@ -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)){