49 |
|
#include <fstream> |
50 |
|
|
51 |
|
#include "applications/simpleBuilder/simpleBuilderCmd.h" |
52 |
< |
#include "applications/simpleBuilder/LatticeFactory.hpp" |
53 |
< |
#include "applications/simpleBuilder/MoLocator.hpp" |
54 |
< |
#include "applications/simpleBuilder/Lattice.hpp" |
52 |
> |
#include "lattice/LatticeFactory.hpp" |
53 |
> |
#include "utils/MoLocator.hpp" |
54 |
> |
#include "lattice/Lattice.hpp" |
55 |
|
#include "brains/Register.hpp" |
56 |
|
#include "brains/SimInfo.hpp" |
57 |
|
#include "brains/SimCreator.hpp" |
69 |
|
|
70 |
|
//register force fields |
71 |
|
registerForceFields(); |
72 |
+ |
registerLattice(); |
73 |
|
|
74 |
|
gengetopt_args_info args_info; |
75 |
|
std::string latticeType; |
77 |
|
std::string outPrefix; |
78 |
|
std::string outMdFileName; |
79 |
|
std::string outInitFileName; |
80 |
< |
BaseLattice *simpleLat; |
80 |
> |
Lattice *simpleLat; |
81 |
|
int numMol; |
82 |
|
double latticeConstant; |
83 |
|
std::vector<double> lc; |
104 |
|
//get lattice type |
105 |
|
latticeType = UpperCase(args_info.latticetype_arg); |
106 |
|
|
107 |
< |
if (!LatticeFactory::getInstance()->hasLatticeCreator(latticeType)) { |
108 |
< |
std::cerr << latticeType << " is an invalid lattice type" << std::endl; |
109 |
< |
std::cerr << LatticeFactory::getInstance()->toString() << std::endl; |
110 |
< |
exit(1); |
107 |
> |
simpleLat = LatticeFactory::getInstance()->createLattice(latticeType); |
108 |
> |
|
109 |
> |
if (simpleLat == NULL) { |
110 |
> |
sprintf(painCave.errMsg, "Lattice Factory can not create %s lattice\n", |
111 |
> |
latticeType.c_str()); |
112 |
> |
painCave.isFatal = 1; |
113 |
> |
simError(); |
114 |
|
} |
115 |
|
|
116 |
|
//get the number of unit cell |
190 |
|
<< std::endl; |
191 |
|
std::cerr << "A new .md file: " << outMdFileName |
192 |
|
<< " is generated, use it to rerun the simpleBuilder" << std::endl; |
193 |
< |
exit(1); |
193 |
> |
exit(1); |
194 |
|
} |
195 |
|
|
196 |
|
//determine the output file names |
250 |
|
|
251 |
|
//create dumpwriter and write out the coordinates |
252 |
|
oldInfo->setFinalConfigFileName(outInitFileName); |
253 |
< |
writer = new DumpWriter(oldInfo, oldInfo->getDumpFileName()); |
253 |
> |
writer = new DumpWriter(oldInfo); |
254 |
|
|
255 |
|
if (writer == NULL) { |
256 |
|
std::cerr << "error in creating DumpWriter" << std::endl; |
269 |
|
|
270 |
|
if (writer != NULL) |
271 |
|
delete writer; |
272 |
+ |
|
273 |
+ |
delete simpleLat; |
274 |
|
|
275 |
|
return 0; |
276 |
|
} |