60 |
|
latticeType = UpperCase(args_info.latticetype_arg); |
61 |
|
|
62 |
|
if (!LatticeFactory::getInstance()->hasLatticeCreator(latticeType)) { |
63 |
< |
cerr << latticeType << " is an invalid lattice type" << endl; |
64 |
< |
cerr << LatticeFactory::getInstance()->toString() << endl; |
63 |
> |
std::cerr << latticeType << " is an invalid lattice type" << std::endl; |
64 |
> |
std::cerr << LatticeFactory::getInstance()->toString() << std::endl; |
65 |
|
exit(1); |
66 |
|
} |
67 |
|
|
69 |
|
nx = args_info.nx_arg; |
70 |
|
|
71 |
|
if (nx <= 0) { |
72 |
< |
cerr << "The number of unit cell in h direction must be greater than 0" |
73 |
< |
<< endl; |
72 |
> |
std::cerr << "The number of unit cell in h direction must be greater than 0" |
73 |
> |
<< std::endl; |
74 |
|
exit(1); |
75 |
|
} |
76 |
|
|
77 |
|
ny = args_info.ny_arg; |
78 |
|
|
79 |
|
if (ny <= 0) { |
80 |
< |
cerr << "The number of unit cell in l direction must be greater than 0" |
81 |
< |
<< endl; |
80 |
> |
std::cerr << "The number of unit cell in l direction must be greater than 0" |
81 |
> |
<< std::endl; |
82 |
|
exit(1); |
83 |
|
} |
84 |
|
|
85 |
|
nz = args_info.nz_arg; |
86 |
|
|
87 |
|
if (nz <= 0) { |
88 |
< |
cerr << "The number of unit cell in k direction must be greater than 0" |
89 |
< |
<< endl; |
88 |
> |
std::cerr << "The number of unit cell in k direction must be greater than 0" |
89 |
> |
<< std::endl; |
90 |
|
exit(1); |
91 |
|
} |
92 |
|
|
94 |
|
if (args_info.inputs_num) |
95 |
|
inputFileName = args_info.inputs[0]; |
96 |
|
else { |
97 |
< |
cerr << "You must specify a input file name.\n" << endl; |
97 |
> |
std::cerr << "You must specify a input file name.\n" << std::endl; |
98 |
|
cmdline_parser_print_help(); |
99 |
|
exit(1); |
100 |
|
} |
103 |
|
oldInfo = new SimInfo; |
104 |
|
|
105 |
|
if (oldInfo == NULL) { |
106 |
< |
cerr << "error in creating SimInfo" << endl; |
106 |
> |
std::cerr << "error in creating SimInfo" << std::endl; |
107 |
|
exit(1); |
108 |
|
} |
109 |
|
|
110 |
|
oldSimSetup = new SimSetup(); |
111 |
|
|
112 |
|
if (oldSimSetup == NULL) { |
113 |
< |
cerr << "error in creating SimSetup" << endl; |
113 |
> |
std::cerr << "error in creating SimSetup" << std::endl; |
114 |
|
exit(1); |
115 |
|
} |
116 |
|
|
120 |
|
oldSimSetup->createSim(); |
121 |
|
|
122 |
|
if (oldInfo->nComponents >= 2) { |
123 |
< |
cerr << "can not build the system with more than two components" |
124 |
< |
<< endl; |
123 |
> |
std::cerr << "can not build the system with more than two components" |
124 |
> |
<< std::endl; |
125 |
|
exit(1); |
126 |
|
} |
127 |
|
|
133 |
|
simpleLat = LatticeFactory::getInstance()->createLattice(latticeType); |
134 |
|
|
135 |
|
if (simpleLat == NULL) { |
136 |
< |
cerr << "Error in creating lattice" << endl; |
136 |
> |
std::cerr << "Error in creating lattice" << std::endl; |
137 |
|
exit(1); |
138 |
|
} |
139 |
|
|
156 |
|
|
157 |
|
//creat new .md file on fly which corrects the number of molecule |
158 |
|
createMdFile(inputFileName, outMdFileName, numMol); |
159 |
< |
cerr |
159 |
> |
std::cerr |
160 |
|
<< "SimpleBuilder Error: the number of molecule and the density are not matched" |
161 |
< |
<< endl; |
162 |
< |
cerr << "A new .md file: " << outMdFileName |
163 |
< |
<< " is generated, use it to rerun the simpleBuilder" << endl; |
161 |
> |
<< std::endl; |
162 |
> |
std::cerr << "A new .md file: " << outMdFileName |
163 |
> |
<< " is generated, use it to rerun the simpleBuilder" << std::endl; |
164 |
|
exit(1); |
165 |
|
} |
166 |
|
|
223 |
|
writer = new DumpWriter(oldInfo); |
224 |
|
|
225 |
|
if (writer == NULL) { |
226 |
< |
cerr << "error in creating DumpWriter" << endl; |
226 |
> |
std::cerr << "error in creating DumpWriter" << std::endl; |
227 |
|
exit(1); |
228 |
|
} |
229 |
|
|
230 |
|
writer->writeFinal(0); |
231 |
|
cout << "new initial configuration file: " << outInitFileName |
232 |
< |
<< " is generated." << endl; |
232 |
> |
<< " is generated." << std::endl; |
233 |
|
|
234 |
|
//delete objects |
235 |
|
|
264 |
|
//correct molecule number |
265 |
|
if (strstr(buffer, "nMol") != NULL) { |
266 |
|
sprintf(buffer, "\t\tnMol = %d;", numMol); |
267 |
< |
newMdFile << buffer << endl; |
267 |
> |
newMdFile << buffer << std::endl; |
268 |
|
} else |
269 |
< |
newMdFile << buffer << endl; |
269 |
> |
newMdFile << buffer << std::endl; |
270 |
|
|
271 |
|
oldMdFile.getline(buffer, MAXLEN); |
272 |
|
} |