this->bJ=1.0;
FILE* input;
- input = fopen(FILENAME.c_str(),"r");
+ input = fopen(FILENAME.c_str(),"r"); // <paramfile>.j
+ if (input == NULL) { perror((std::string("ERROR: ") + FILENAME).c_str()); exit(1); }
typedef std::vector<int> Key;
std::map<Key,double> JIndex;
this->bJ=1.0;
FILE* input;
- input = fopen(FILENAME.c_str(),"r");
+ input = fopen(FILENAME.c_str(),"r"); // <paramfile>.j
+ if (input == NULL) { perror((std::string("ERROR: ") + FILENAME).c_str()); exit(1); }
typedef std::vector<int> Key;
std::map<Key,double> JIndex;
FILE* input;
input = fopen(FILENAME.c_str(),"r");
+ if (input == NULL) { perror((std::string("ERROR: ") + FILENAME).c_str()); exit(1); }
typedef std::vector<int> Key;
std::map<Key,double> JIndex;
r.setFiles();
FILE *popout=fopen(r.trajectoryOutfile.c_str(),"w"); // <outfile>.dat
FILE *supout=r.useTwoSite ? NULL : fopen(r.supplementaryOutfile.c_str(),"w"); // <outfile>.sum
+ if (popout == NULL) { perror("File error"); exit(1); }
+ if (r.useTwoSite && supout == NULL) { perror("File error"); exit(1); }
if (r.importState) importState(r); // <infile>.st
for (i=0; i<r.g; ++i) {
P.next_generation(H, rnd, r.useRelative, r.useVerbose);
- P.write_population(popout,i);
+
+ if ((i+1) % r.write_mod == 0) {
+ P.write_population(popout,i+1);
+ }
if (r.runUntilEscape && P.escaped(H)) break;
void importState(RunParameters &r) {
- FILE *input=fopen(r.stateInfile.c_str(),"r");
+ FILE *input=fopen(r.stateInfile.c_str(),"r"); // <infile>.st
+ if (input == NULL) { perror((std::string("ERROR in importState: ") + r.stateInfile).c_str()); exit(1); }
char o;
double frac;
else if (strcmp(argv[i],"-write_mod")==0) { if (++i==argc) break; else r.write_mod=(unsigned int)strtodouble(argv[i]); }
- else if (strcmp(argv[i],"-h")==0) { usage(); return 0; }
+ else if (strcmp(argv[i],"-h")==0 || strcmp(argv[i],"--help")==0) { usage(); return 0; }
else printf("Unrecognized command! '%s'\n",argv[i]);