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

Comparing trunk/OOPSE-4/src/applications/nanoRodBuilder/nanorodBuilder.cpp (file contents):
Revision 2215 by chuckv, Thu Apr 28 00:24:11 2005 UTC vs.
Revision 2252 by chuckv, Mon May 30 14:01:52 2005 UTC

# Line 54 | Line 54
54   #ifdef HAVE_CGAL
55   #include "GeometryBuilder.hpp"
56   #endif
57 + #include "GeometryFactory.hpp"
58 + #include "Geometry.hpp"
59   #include "lattice/LatticeFactory.hpp"
60   #include "utils/MoLocator.hpp"
61   #include "lattice/Lattice.hpp"
# Line 103 | Line 105 | int main(int argc, char *argv []) {
105    std::vector<Vector3d> latticePos;
106    std::vector<Vector3d> latticeOrt;
107    int numMolPerCell;
106  int curMolIndex;
108    DumpWriter *writer;
109    
110    // parse command line arguments
# Line 123 | Line 124 | int main(int argc, char *argv []) {
124          
125    //get lattice type
126    latticeType = UpperCase(args_info.latticetype_arg);
127 <  
127 <  
128 <  simpleLat = LatticeFactory::getInstance()->createLattice(latticeType);
129 <  if (simpleLat == NULL) {
130 <    sprintf(painCave.errMsg, "Lattice Factory can not create %s lattice\n",
131 <            latticeType.c_str());
132 <    painCave.isFatal = 1;
133 <    simError();
134 <  }        
135 <  
127 >    
128    //get input file name
129    if (args_info.inputs_num)
130      inputFileName = args_info.inputs[0];
# Line 209 | Line 201 | int main(int argc, char *argv []) {
201    
202    // Create geometry for nanocrystal
203   #ifdef HAVE_CGAL
204 <  GeometryBuilder myGeometry(rodLength,rodDiameter);
204 >  GeometryBuilder *myGeometry;
205 >  // GeometryBuilder myGeometry(rodLength,rodDiameter);
206 >  if (args_info.twinnedCrystal_flag){
207 >     myGeometry = new GeometryBuilder(rodLength,rodDiameter);
208 >  }
209 >  else{
210 >     myGeometry = new GeometryBuilder(rodLength,rodDiameter);
211 >  }
212 >  
213    if (args_info.genGeomview_given){
214       if (args_info.genGeomview_flag){
215          outGeomFileName = getPrefix(inputFileName.c_str()) + ".off";
216 <        myGeometry.dumpGeometry(outGeomFileName);
216 >        myGeometry->dumpGeometry(outGeomFileName);
217       }
218    }
219 <
219 >  
220   #endif
221    
222    /*
# Line 227 | Line 227 | int main(int argc, char *argv []) {
227    
228    //place the molecules
229    
230 <  curMolIndex = 0;
230 >
231    
232    //get the orientation of the cell sites
233    //for the same type of molecule in same lattice, it will not change
234    latticeOrt = simpleLat->getLatticePointsOrt();
235  
236  
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  */
235    
236    
237    
254  
238    numMol = 0;
239    for(int i = -nx; i < nx; i++) {    
240      for(int j = -ny; j < ny; j++) {      
# Line 266 | Line 249 | int main(int argc, char *argv []) {
249          for(int l = 0; l < numMolPerCell; l++) {
250  
251   #ifdef HAVE_CGAL
252 <          if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
252 >          if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
253              numMol++;
254            }
255 + #else
256 +           numMol++;
257   #endif
258          }
259        }
260      }
261    }
262 <  std::cerr << "numMol before is " << numMol << std::endl;
262 >
263    
264    // needed for writing out new md file.
265    
# Line 299 | Line 284 | int main(int argc, char *argv []) {
284    Molecule* mol;
285    SimInfo::MoleculeIterator mi;
286    mol = NewInfo->beginMolecule(mi);
287 <  numMol = 0;
288 <  int countMol = 0;
287 >
288 >
289    for(int i = -nx; i < nx; i++) {
290       for(int j = -ny; j < ny; j++) {
291          for(int k = -nz; k < nz; k++) {
# Line 309 | Line 294 | int main(int argc, char *argv []) {
294             simpleLat->getLatticePointsPos(latticePos, i, j, k);
295            
296             for(int l = 0; l < numMolPerCell; l++) {
297 <              if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
298 <                 countMol++;              
297 > #ifdef HAVE_CGAL              
298 >              if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
299 > #endif                              
300                   if (mol != NULL) {
301                      locator->placeMol(latticePos[l], latticeOrt[l], mol);
316                    numMol++;
302                   } else {
303 <                    std::cerr<<"Error in placing molecule " << countMol << std::endl;                    
303 >                    std::cerr<<"Error in placing molecule " << std::endl;                    
304                   }
305                   mol = NewInfo->nextMolecule(mi);
306 + #ifdef HAVE_CGAL                
307                }
308 <              
308 > #endif              
309             }
310          }
311       }
312    }
313    
314 <  std::cerr << "numMol after is " << numMol << std::endl;
314 >
315    
316    //fill Hmat
317    hmat(0, 0)= nx * latticeConstant;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines