--- trunk/src/applications/simpleBuilder/simpleBuilder.cpp 2005/04/12 21:27:27 481 +++ trunk/src/applications/simpleBuilder/simpleBuilder.cpp 2005/04/12 22:42:13 488 @@ -69,6 +69,7 @@ int main(int argc, char *argv []) { //register force fields registerForceFields(); + registerLattice(); gengetopt_args_info args_info; std::string latticeType; @@ -76,7 +77,7 @@ int main(int argc, char *argv []) { std::string outPrefix; std::string outMdFileName; std::string outInitFileName; - BaseLattice *simpleLat; + Lattice *simpleLat; int numMol; double latticeConstant; std::vector lc; @@ -103,10 +104,13 @@ int main(int argc, char *argv []) { //get lattice type latticeType = UpperCase(args_info.latticetype_arg); - if (!LatticeFactory::getInstance()->hasLatticeCreator(latticeType)) { - std::cerr << latticeType << " is an invalid lattice type" << std::endl; - std::cerr << LatticeFactory::getInstance()->toString() << std::endl; - exit(1); + simpleLat = LatticeFactory::getInstance()->createLattice(latticeType); + + if (simpleLat == NULL) { + sprintf(painCave.errMsg, "Lattice Factory can not create %s lattice\n", + latticeType.c_str()); + painCave.isFatal = 1; + simError(); } //get the number of unit cell @@ -186,7 +190,7 @@ int main(int argc, char *argv []) { << std::endl; std::cerr << "A new .md file: " << outMdFileName << " is generated, use it to rerun the simpleBuilder" << std::endl; - exit(1); + exit(1); } //determine the output file names @@ -265,6 +269,8 @@ int main(int argc, char *argv []) { if (writer != NULL) delete writer; + + delete simpleLat; return 0; }