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 |
184 |
|
else |
185 |
|
outInitFileName = getPrefix(inputFileName.c_str()) + ".in"; |
186 |
|
|
187 |
+ |
|
188 |
+ |
|
189 |
+ |
|
190 |
+ |
|
191 |
+ |
|
192 |
|
//creat Molocator |
193 |
|
locator = new MoLocator(oldInfo->getMoleculeStamp(0), oldInfo->getForceField()); |
194 |
|
|
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); |
224 |
> |
} |
225 |
> |
} |
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(); |
223 |
– |
|
224 |
– |
|
225 |
– |
/* |
226 |
– |
void BaseLattice::getLatticePointsPos(std::vector<Vector3d>& |
227 |
– |
latticePos, int nx, int ny, int nz){ |
228 |
– |
|
229 |
– |
latticePos.resize(nCellSites); |
230 |
– |
|
231 |
– |
for( int i=0;i < nCellSites;i++){ |
232 |
– |
|
233 |
– |
latticePos[i][0] = origin[0] + cellSitesPos[i][0] + cellLen[0] * (double(nx) - 0.5); |
234 |
– |
latticePos[i][1] = origin[1] + cellSitesPos[i][1] + cellLen[1] * (double(ny) - 0.5); |
235 |
– |
latticePos[i][2] = origin[2] + cellSitesPos[i][2] + cellLen[2] * (double(nz) - 0.5); |
236 |
– |
} |
237 |
– |
|
238 |
– |
*/ |
242 |
|
|
243 |
|
|
244 |
|
|
242 |
– |
|
245 |
|
numMol = 0; |
246 |
< |
for(int i = 0; i < nx; i++) { |
247 |
< |
for(int j = 0; j < ny; j++) { |
248 |
< |
for(int k = 0; k < nz; k++) { |
246 |
> |
for(int i = -nx; i < nx; i++) { |
247 |
> |
for(int j = -ny; j < ny; j++) { |
248 |
> |
for(int k = -nz; k < nz; k++) { |
249 |
|
//if (oldInfo->getNGlobalMolecules() != numMol) { |
250 |
|
|
251 |
|
|
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 |
+ |
|
270 |
|
|
266 |
– |
|
271 |
|
// needed for writing out new md file. |
272 |
|
|
273 |
|
outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; |
291 |
|
Molecule* mol; |
292 |
|
SimInfo::MoleculeIterator mi; |
293 |
|
mol = NewInfo->beginMolecule(mi); |
290 |
– |
|
291 |
– |
for(int i = 0; i < nx; i++) { |
292 |
– |
for(int j = 0; j < ny; j++) { |
293 |
– |
for(int k = 0; k < nz; k++) { |
294 |
– |
|
295 |
– |
//get the position of the cell sites |
296 |
– |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
297 |
– |
|
298 |
– |
for(int l = 0; l < numMolPerCell; l++) { |
299 |
– |
if (mol != NULL) { |
294 |
|
|
295 |
< |
#ifdef HAVE_GCAL |
296 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
297 |
< |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
298 |
< |
} |
299 |
< |
#else |
300 |
< |
|
301 |
< |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
302 |
< |
#endif |
303 |
< |
} else { |
304 |
< |
std::cerr << std::endl; |
305 |
< |
} |
306 |
< |
mol = NewInfo->nextMolecule(mi); |
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++) { |
299 |
> |
|
300 |
> |
//get the position of the cell sites |
301 |
> |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
302 |
> |
|
303 |
> |
for(int l = 0; l < numMolPerCell; l++) { |
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); |
309 |
> |
} else { |
310 |
> |
std::cerr<<"Error in placing molecule " << std::endl; |
311 |
> |
} |
312 |
> |
mol = NewInfo->nextMolecule(mi); |
313 |
> |
#ifdef HAVE_CGAL |
314 |
> |
} |
315 |
> |
#endif |
316 |
> |
} |
317 |
|
} |
318 |
< |
} |
315 |
< |
} |
318 |
> |
} |
319 |
|
} |
320 |
|
|
321 |
+ |
|
322 |
|
|
319 |
– |
|
323 |
|
//fill Hmat |
324 |
|
hmat(0, 0)= nx * latticeConstant; |
325 |
|
hmat(0, 1) = 0.0; |