1 |
< |
/* |
1 |
> |
/* |
2 |
|
* Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
|
* |
4 |
|
* The University of Notre Dame grants you ("Licensee") a |
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 |
110 |
|
exit(1); |
111 |
|
|
112 |
|
|
113 |
< |
|
113 |
> |
// Check for lib CGAL, if we don't have it, we should exit.... |
114 |
> |
|
115 |
> |
#ifndef HAVE_CGAL |
116 |
> |
std::cerr << "nanoRodBuilder requires libCGAL to function, please rebuild OOPSE with libCGAL." |
117 |
> |
<< std::endl; |
118 |
> |
exit(1); |
119 |
> |
#endif |
120 |
> |
|
121 |
> |
|
122 |
> |
|
123 |
|
//get lattice type |
124 |
|
latticeType = UpperCase(args_info.latticetype_arg); |
125 |
|
|
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 |
|
|
207 |
|
|
208 |
|
|
209 |
|
// Create geometry for nanocrystal |
210 |
< |
#ifdef HAVE_GCAL |
211 |
< |
GeometryBuilder myGeometry(rodLength,rodDiameter); |
210 |
> |
#ifdef HAVE_CGAL |
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(); |
242 |
|
|
243 |
|
|
216 |
– |
/* |
217 |
– |
void BaseLattice::getLatticePointsPos(std::vector<Vector3d>& |
218 |
– |
latticePos, int nx, int ny, int nz){ |
219 |
– |
|
220 |
– |
latticePos.resize(nCellSites); |
221 |
– |
|
222 |
– |
for( int i=0;i < nCellSites;i++){ |
223 |
– |
|
224 |
– |
latticePos[i][0] = origin[0] + cellSitesPos[i][0] + cellLen[0] * (double(nx) - 0.5); |
225 |
– |
latticePos[i][1] = origin[1] + cellSitesPos[i][1] + cellLen[1] * (double(ny) - 0.5); |
226 |
– |
latticePos[i][2] = origin[2] + cellSitesPos[i][2] + cellLen[2] * (double(nz) - 0.5); |
227 |
– |
} |
228 |
– |
|
229 |
– |
*/ |
244 |
|
|
231 |
– |
|
232 |
– |
|
233 |
– |
|
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 |
|
|
255 |
|
|
256 |
|
for(int l = 0; l < numMolPerCell; l++) { |
257 |
|
|
258 |
< |
#ifdef HAVE_GCAL |
259 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
258 |
> |
#ifdef HAVE_CGAL |
259 |
> |
if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
260 |
|
numMol++; |
261 |
|
} |
262 |
|
#else |
263 |
< |
numMol++; |
263 |
> |
numMol++; |
264 |
|
#endif |
265 |
|
} |
266 |
|
} |
267 |
|
} |
268 |
|
} |
269 |
+ |
|
270 |
|
|
259 |
– |
|
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); |
283 |
– |
|
284 |
– |
for(int i = 0; i < nx; i++) { |
285 |
– |
for(int j = 0; j < ny; j++) { |
286 |
– |
for(int k = 0; k < nz; k++) { |
287 |
– |
|
288 |
– |
//get the position of the cell sites |
289 |
– |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
290 |
– |
|
291 |
– |
for(int l = 0; l < numMolPerCell; l++) { |
292 |
– |
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 |
< |
} |
308 |
< |
} |
318 |
> |
} |
319 |
|
} |
320 |
|
|
321 |
+ |
|
322 |
|
|
312 |
– |
|
323 |
|
//fill Hmat |
324 |
|
hmat(0, 0)= nx * latticeConstant; |
325 |
|
hmat(0, 1) = 0.0; |
344 |
|
if (writer == NULL) { |
345 |
|
std::cerr << "error in creating DumpWriter" << std::endl; |
346 |
|
exit(1); |
347 |
< |
} |
347 |
> |
} |
348 |
|
|
349 |
|
writer->writeDump(); |
350 |
|
std::cout << "new initial configuration file: " << outInitFileName |