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 |
208 |
|
|
209 |
|
// Create geometry for nanocrystal |
210 |
|
#ifdef HAVE_CGAL |
211 |
< |
GeometryBuilder myGeometry(rodLength,rodDiameter); |
211 |
> |
GeometryBuilder *myGeometry; |
212 |
> |
// GeometryBuilder myGeometry(rodLength,rodDiameter); |
213 |
> |
if (args_info.twinnedCrystal_flag){ |
214 |
> |
myGeometry = new GeometryBuilder(rodLength,rodDiameter); |
215 |
> |
} |
216 |
> |
else{ |
217 |
> |
myGeometry = new GeometryBuilder(rodLength,rodDiameter); |
218 |
> |
} |
219 |
> |
|
220 |
|
if (args_info.genGeomview_given){ |
221 |
|
if (args_info.genGeomview_flag){ |
222 |
|
outGeomFileName = getPrefix(inputFileName.c_str()) + ".off"; |
223 |
< |
myGeometry.dumpGeometry(outGeomFileName); |
223 |
> |
myGeometry->dumpGeometry(outGeomFileName); |
224 |
|
} |
225 |
|
} |
226 |
< |
|
226 |
> |
|
227 |
|
#endif |
228 |
|
|
229 |
|
/* |
234 |
|
|
235 |
|
//place the molecules |
236 |
|
|
237 |
< |
curMolIndex = 0; |
237 |
> |
|
238 |
|
|
239 |
|
//get the orientation of the cell sites |
240 |
|
//for the same type of molecule in same lattice, it will not change |
241 |
|
latticeOrt = simpleLat->getLatticePointsOrt(); |
242 |
|
|
243 |
|
|
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 |
– |
*/ |
244 |
|
|
252 |
– |
|
253 |
– |
|
254 |
– |
|
245 |
|
numMol = 0; |
246 |
|
for(int i = -nx; i < nx; i++) { |
247 |
|
for(int j = -ny; j < ny; j++) { |
256 |
|
for(int l = 0; l < numMolPerCell; l++) { |
257 |
|
|
258 |
|
#ifdef HAVE_CGAL |
259 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
259 |
> |
if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
260 |
|
numMol++; |
261 |
|
} |
262 |
+ |
#else |
263 |
+ |
numMol++; |
264 |
|
#endif |
265 |
|
} |
266 |
|
} |
267 |
|
} |
268 |
|
} |
269 |
< |
std::cerr << "numMol before is " << numMol << std::endl; |
269 |
> |
|
270 |
|
|
271 |
|
// needed for writing out new md file. |
272 |
|
|
291 |
|
Molecule* mol; |
292 |
|
SimInfo::MoleculeIterator mi; |
293 |
|
mol = NewInfo->beginMolecule(mi); |
294 |
< |
numMol = 0; |
295 |
< |
int countMol = 0; |
294 |
> |
|
295 |
> |
|
296 |
|
for(int i = -nx; i < nx; i++) { |
297 |
|
for(int j = -ny; j < ny; j++) { |
298 |
|
for(int k = -nz; k < nz; k++) { |
301 |
|
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
302 |
|
|
303 |
|
for(int l = 0; l < numMolPerCell; l++) { |
304 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
305 |
< |
countMol++; |
304 |
> |
#ifdef HAVE_CGAL |
305 |
> |
if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
306 |
> |
#endif |
307 |
|
if (mol != NULL) { |
308 |
|
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
316 |
– |
numMol++; |
309 |
|
} else { |
310 |
< |
std::cerr<<"Error in placing molecule " << countMol << std::endl; |
310 |
> |
std::cerr<<"Error in placing molecule " << std::endl; |
311 |
|
} |
312 |
|
mol = NewInfo->nextMolecule(mi); |
313 |
+ |
#ifdef HAVE_CGAL |
314 |
|
} |
315 |
< |
|
315 |
> |
#endif |
316 |
|
} |
317 |
|
} |
318 |
|
} |
319 |
|
} |
320 |
|
|
321 |
< |
std::cerr << "numMol after is " << numMol << std::endl; |
321 |
> |
|
322 |
|
|
323 |
|
//fill Hmat |
324 |
|
hmat(0, 0)= nx * latticeConstant; |