103 |
|
std::vector<Vector3d> latticePos; |
104 |
|
std::vector<Vector3d> latticeOrt; |
105 |
|
int numMolPerCell; |
106 |
– |
int curMolIndex; |
106 |
|
DumpWriter *writer; |
107 |
|
|
108 |
|
// parse command line arguments |
122 |
|
|
123 |
|
//get lattice type |
124 |
|
latticeType = UpperCase(args_info.latticetype_arg); |
125 |
< |
|
127 |
< |
|
128 |
< |
simpleLat = LatticeFactory::getInstance()->createLattice(latticeType); |
129 |
< |
if (simpleLat == NULL) { |
130 |
< |
sprintf(painCave.errMsg, "Lattice Factory can not create %s lattice\n", |
131 |
< |
latticeType.c_str()); |
132 |
< |
painCave.isFatal = 1; |
133 |
< |
simError(); |
134 |
< |
} |
135 |
< |
|
125 |
> |
|
126 |
|
//get input file name |
127 |
|
if (args_info.inputs_num) |
128 |
|
inputFileName = args_info.inputs[0]; |
199 |
|
|
200 |
|
// Create geometry for nanocrystal |
201 |
|
#ifdef HAVE_CGAL |
202 |
< |
GeometryBuilder myGeometry(rodLength,rodDiameter); |
202 |
> |
GeometryBuilder *myGeometry; |
203 |
> |
// GeometryBuilder myGeometry(rodLength,rodDiameter); |
204 |
> |
if (args_info.twinnedCrystal_flag){ |
205 |
> |
myGeometry = new GeometryBuilder(rodLength,rodDiameter); |
206 |
> |
} |
207 |
> |
else{ |
208 |
> |
myGeometry = new GeometryBuilder(rodLength,rodDiameter); |
209 |
> |
} |
210 |
> |
|
211 |
|
if (args_info.genGeomview_given){ |
212 |
|
if (args_info.genGeomview_flag){ |
213 |
|
outGeomFileName = getPrefix(inputFileName.c_str()) + ".off"; |
214 |
< |
myGeometry.dumpGeometry(outGeomFileName); |
214 |
> |
myGeometry->dumpGeometry(outGeomFileName); |
215 |
|
} |
216 |
|
} |
217 |
< |
|
217 |
> |
|
218 |
|
#endif |
219 |
|
|
220 |
|
/* |
225 |
|
|
226 |
|
//place the molecules |
227 |
|
|
228 |
< |
curMolIndex = 0; |
228 |
> |
|
229 |
|
|
230 |
|
//get the orientation of the cell sites |
231 |
|
//for the same type of molecule in same lattice, it will not change |
232 |
|
latticeOrt = simpleLat->getLatticePointsOrt(); |
235 |
– |
|
236 |
– |
|
237 |
– |
/* |
238 |
– |
void BaseLattice::getLatticePointsPos(std::vector<Vector3d>& |
239 |
– |
latticePos, int nx, int ny, int nz){ |
240 |
– |
|
241 |
– |
latticePos.resize(nCellSites); |
242 |
– |
|
243 |
– |
for( int i=0;i < nCellSites;i++){ |
244 |
– |
|
245 |
– |
latticePos[i][0] = origin[0] + cellSitesPos[i][0] + cellLen[0] * (double(nx) - 0.5); |
246 |
– |
latticePos[i][1] = origin[1] + cellSitesPos[i][1] + cellLen[1] * (double(ny) - 0.5); |
247 |
– |
latticePos[i][2] = origin[2] + cellSitesPos[i][2] + cellLen[2] * (double(nz) - 0.5); |
248 |
– |
} |
249 |
– |
|
250 |
– |
*/ |
233 |
|
|
234 |
|
|
235 |
|
|
254 |
– |
|
236 |
|
numMol = 0; |
237 |
|
for(int i = -nx; i < nx; i++) { |
238 |
|
for(int j = -ny; j < ny; j++) { |
247 |
|
for(int l = 0; l < numMolPerCell; l++) { |
248 |
|
|
249 |
|
#ifdef HAVE_CGAL |
250 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
250 |
> |
if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
251 |
|
numMol++; |
252 |
|
} |
253 |
+ |
#else |
254 |
+ |
numMol++; |
255 |
|
#endif |
256 |
|
} |
257 |
|
} |
258 |
|
} |
259 |
|
} |
260 |
< |
std::cerr << "numMol before is " << numMol << std::endl; |
260 |
> |
|
261 |
|
|
262 |
|
// needed for writing out new md file. |
263 |
|
|
282 |
|
Molecule* mol; |
283 |
|
SimInfo::MoleculeIterator mi; |
284 |
|
mol = NewInfo->beginMolecule(mi); |
285 |
< |
numMol = 0; |
286 |
< |
int countMol = 0; |
285 |
> |
|
286 |
> |
|
287 |
|
for(int i = -nx; i < nx; i++) { |
288 |
|
for(int j = -ny; j < ny; j++) { |
289 |
|
for(int k = -nz; k < nz; k++) { |
292 |
|
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
293 |
|
|
294 |
|
for(int l = 0; l < numMolPerCell; l++) { |
295 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
296 |
< |
countMol++; |
295 |
> |
#ifdef HAVE_CGAL |
296 |
> |
if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
297 |
> |
#endif |
298 |
|
if (mol != NULL) { |
299 |
|
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
316 |
– |
numMol++; |
300 |
|
} else { |
301 |
< |
std::cerr<<"Error in placing molecule " << countMol << std::endl; |
301 |
> |
std::cerr<<"Error in placing molecule " << std::endl; |
302 |
|
} |
303 |
|
mol = NewInfo->nextMolecule(mi); |
304 |
+ |
#ifdef HAVE_CGAL |
305 |
|
} |
306 |
< |
|
306 |
> |
#endif |
307 |
|
} |
308 |
|
} |
309 |
|
} |
310 |
|
} |
311 |
|
|
312 |
< |
std::cerr << "numMol after is " << numMol << std::endl; |
312 |
> |
|
313 |
|
|
314 |
|
//fill Hmat |
315 |
|
hmat(0, 0)= nx * latticeConstant; |
337 |
|
exit(1); |
338 |
|
} |
339 |
|
|
340 |
< |
writer->writeDump(); |
340 |
> |
writer->writeEor(); |
341 |
|
std::cout << "new initial configuration file: " << outInitFileName |
342 |
|
<< " is generated." << std::endl; |
343 |
|
|