--- trunk/OOPSE-1.0/utils/sysbuilder/simpleBuilder.cpp 2004/07/29 18:16:16 1435 +++ trunk/OOPSE-1.0/utils/sysbuilder/simpleBuilder.cpp 2004/07/29 19:12:00 1436 @@ -29,6 +29,7 @@ int main( int argc, char* argv[]){ string inputFileName; string outPrefix; string outMdFileName; + string outInitFileName; SimInfo* oldInfo; SimSetup* oldSimSetup; BaseLattice* simpleLat; @@ -50,24 +51,9 @@ int main( int argc, char* argv[]){ // parse command line arguments if (cmdline_parser (argc, argv, &args_info) != 0) exit(1) ; + + density = args_info.density_arg; - //process density - if(!args_info.density_given && !args_info.ndensity_given){ - cerr << "SimpleBuilder Error: density or number density must be given" << endl; - cmdline_parser_print_help(); - exit(1); - } - else if(args_info.density_given){ - if( args_info.ndensity_given) - cerr << "SimpleBuilder Warning: both of density and number density are given, use density" << endl; - - density = args_info.density_arg; - } - else if(args_info.ndensity_given){ - //convert number density to density - } - - //get lattice type latticeType = UpperCase(args_info.latticetype_arg); if(!LatticeFactory::getInstance()->hasLatticeCreator(latticeType)){ @@ -104,16 +90,7 @@ int main( int argc, char* argv[]){ exit(1); } - //determine the output file names - if (args_info.output_given){ - outPrefix = args_info.output_arg; - } - else - outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; - - outMdFileName = outPrefix + ".md"; - //parse md file and set up the system oldInfo = new SimInfo; if(oldInfo == NULL){ @@ -161,13 +138,24 @@ int main( int argc, char* argv[]){ numMol = nx * ny * nz * numMolPerCell; if (oldInfo->n_mol != numMol){ - //creat new .md file on fly which corrects the number of molecule + + outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; + outMdFileName = outPrefix + ".md"; + + //creat new .md file on fly which corrects the number of molecule createMdFile(inputFileName, outMdFileName, numMol); cerr << "SimpleBuilder Error: the number of molecule and the density are not matched" <getConfiguration()->createArrays(oldInfo->n_atoms); for (int i = 0; i < oldInfo->n_atoms; i++) @@ -214,13 +202,14 @@ int main( int argc, char* argv[]){ } //create dumpwriter and write out the coordinates + oldInfo->finalName = outInitFileName; writer = new DumpWriter( oldInfo ); if(writer == NULL){ cerr << "error in creating DumpWriter" << endl; exit(1); } writer->writeFinal(0); - + cout << "new initial configuration file: " << outInitFileName <<" is generated." << endl; //delete objects //delete oldInfo and oldSimSetup