ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/applications/nanoRodBuilder/nanorodBuilder.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/applications/nanoRodBuilder/nanorodBuilder.cpp (file contents):
Revision 2196 by chuckv, Thu Apr 14 16:10:57 2005 UTC vs.
Revision 2218 by chuckv, Tue May 3 17:55:28 2005 UTC

# Line 1 | Line 1
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
# Line 103 | Line 103 | int main(int argc, char *argv []) {
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
# Line 111 | Line 110 | int main(int argc, char *argv []) {
110      exit(1);
111    
112    
113 <        // Check for lib CGAL, if we don't have it, we should exit....
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);
116 >  std::cerr << "nanoRodBuilder requires libCGAL to function, please rebuild OOPSE with libCGAL."
117 >            << std::endl;
118 >  exit(1);
119   #endif
120          
121          
# Line 185 | Line 184 | int main(int argc, char *argv []) {
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    
# Line 204 | Line 208 | int main(int argc, char *argv []) {
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    /*
# Line 215 | Line 234 | int main(int argc, char *argv []) {
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    
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  */
244    
240  
241  
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          
# Line 254 | Line 256 | int main(int argc, char *argv []) {
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;
# Line 287 | Line 291 | int main(int argc, char *argv []) {
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;
# Line 341 | Line 344 | int main(int argc, char *argv []) {
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines