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 |
111 |
|
exit(1); |
112 |
|
|
113 |
|
|
114 |
< |
// Check for lib CGAL, if we don't have it, we should exit.... |
114 |
> |
// Check for lib CGAL, if we don't have it, we should exit.... |
115 |
|
|
116 |
|
#ifndef HAVE_CGAL |
117 |
< |
std::cerr << "nanoRodBuilder requires libCGAL to function, please rebuild OOPSE with libCGAL." |
118 |
< |
<< std::endl; |
119 |
< |
exit(1); |
117 |
> |
std::cerr << "nanoRodBuilder requires libCGAL to function, please rebuild OOPSE with libCGAL." |
118 |
> |
<< std::endl; |
119 |
> |
exit(1); |
120 |
|
#endif |
121 |
|
|
122 |
|
|
185 |
|
else |
186 |
|
outInitFileName = getPrefix(inputFileName.c_str()) + ".in"; |
187 |
|
|
188 |
+ |
|
189 |
+ |
|
190 |
+ |
|
191 |
+ |
|
192 |
+ |
|
193 |
|
//creat Molocator |
194 |
|
locator = new MoLocator(oldInfo->getMoleculeStamp(0), oldInfo->getForceField()); |
195 |
|
|
210 |
|
// Create geometry for nanocrystal |
211 |
|
#ifdef HAVE_CGAL |
212 |
|
GeometryBuilder myGeometry(rodLength,rodDiameter); |
213 |
+ |
if (args_info.genGeomview_given){ |
214 |
+ |
if (args_info.genGeomview_flag){ |
215 |
+ |
outGeomFileName = getPrefix(inputFileName.c_str()) + ".off"; |
216 |
+ |
myGeometry.dumpGeometry(outGeomFileName); |
217 |
+ |
} |
218 |
+ |
} |
219 |
+ |
|
220 |
|
#endif |
221 |
|
|
222 |
|
/* |
253 |
|
|
254 |
|
|
255 |
|
numMol = 0; |
256 |
< |
for(int i = 0; i < nx; i++) { |
257 |
< |
for(int j = 0; j < ny; j++) { |
258 |
< |
for(int k = 0; k < nz; k++) { |
256 |
> |
for(int i = -nx; i < nx; i++) { |
257 |
> |
for(int j = -ny; j < ny; j++) { |
258 |
> |
for(int k = -nz; k < nz; k++) { |
259 |
|
//if (oldInfo->getNGlobalMolecules() != numMol) { |
260 |
|
|
261 |
|
|
274 |
|
} |
275 |
|
} |
276 |
|
} |
277 |
+ |
std::cerr << "numMol before is " << numMol << std::endl; |
278 |
|
|
266 |
– |
|
279 |
|
// needed for writing out new md file. |
280 |
|
|
281 |
|
outPrefix = getPrefix(inputFileName.c_str()) + "_" + latticeType; |
299 |
|
Molecule* mol; |
300 |
|
SimInfo::MoleculeIterator mi; |
301 |
|
mol = NewInfo->beginMolecule(mi); |
302 |
< |
|
303 |
< |
for(int i = 0; i < nx; i++) { |
304 |
< |
for(int j = 0; j < ny; j++) { |
305 |
< |
for(int k = 0; k < nz; k++) { |
306 |
< |
|
307 |
< |
//get the position of the cell sites |
308 |
< |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
309 |
< |
|
310 |
< |
for(int l = 0; l < numMolPerCell; l++) { |
311 |
< |
if (mol != NULL) { |
312 |
< |
|
313 |
< |
#ifdef HAVE_GCAL |
314 |
< |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
315 |
< |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
316 |
< |
} |
317 |
< |
#else |
318 |
< |
|
319 |
< |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
320 |
< |
#endif |
321 |
< |
} else { |
322 |
< |
std::cerr << std::endl; |
323 |
< |
} |
312 |
< |
mol = NewInfo->nextMolecule(mi); |
302 |
> |
numMol = 0; |
303 |
> |
int countMol = 0; |
304 |
> |
for(int i = -nx; i < nx; i++) { |
305 |
> |
for(int j = -ny; j < ny; j++) { |
306 |
> |
for(int k = -nz; k < nz; k++) { |
307 |
> |
|
308 |
> |
//get the position of the cell sites |
309 |
> |
simpleLat->getLatticePointsPos(latticePos, i, j, k); |
310 |
> |
|
311 |
> |
for(int l = 0; l < numMolPerCell; l++) { |
312 |
> |
if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){ |
313 |
> |
countMol++; |
314 |
> |
if (mol != NULL) { |
315 |
> |
locator->placeMol(latticePos[l], latticeOrt[l], mol); |
316 |
> |
numMol++; |
317 |
> |
} else { |
318 |
> |
std::cerr<<"Error in placing molecule " << countMol << std::endl; |
319 |
> |
} |
320 |
> |
mol = NewInfo->nextMolecule(mi); |
321 |
> |
} |
322 |
> |
|
323 |
> |
} |
324 |
|
} |
325 |
< |
} |
315 |
< |
} |
325 |
> |
} |
326 |
|
} |
327 |
|
|
328 |
+ |
std::cerr << "numMol after is " << numMol << std::endl; |
329 |
|
|
319 |
– |
|
330 |
|
//fill Hmat |
331 |
|
hmat(0, 0)= nx * latticeConstant; |
332 |
|
hmat(0, 1) = 0.0; |
351 |
|
if (writer == NULL) { |
352 |
|
std::cerr << "error in creating DumpWriter" << std::endl; |
353 |
|
exit(1); |
354 |
< |
} |
354 |
> |
} |
355 |
|
|
356 |
|
writer->writeDump(); |
357 |
|
std::cout << "new initial configuration file: " << outInitFileName |