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 2759 by tim, Wed May 17 21:51:42 2006 UTC

# Line 88 | Line 88 | int main(int argc, char *argv []) {
88    
89    Lattice *simpleLat;
90    int numMol;
91 <  double latticeConstant;
92 <  std::vector<double> lc;
93 <  double mass;
94 <  const double rhoConvertConst = 1.661;
95 <  double density;
96 <  double rodLength;
97 <  double rodDiameter;
91 >  RealType latticeConstant;
92 >  std::vector<RealType> lc;
93 >  RealType mass;
94 >  const RealType rhoConvertConst = 1.661;
95 >  RealType density;
96 >  RealType rodLength;
97 >  RealType rodDiameter;
98    
99    
100    int nx, ny, nz;
# 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 123 | Line 122 | int main(int argc, char *argv []) {
122          
123    //get lattice type
124    latticeType = UpperCase(args_info.latticetype_arg);
125 <  
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 <  
125 >    
126    //get input file name
127    if (args_info.inputs_num)
128      inputFileName = args_info.inputs[0];
# Line 209 | Line 199 | int main(int argc, char *argv []) {
199    
200    // Create geometry for nanocrystal
201   #ifdef HAVE_CGAL
202 <  GeometryBuilder myGeometry(rodLength,rodDiameter);
202 >  GeometryBuilder *myGeometry;
203 >  // GeometryBuilder myGeometry(rodLength,rodDiameter);
204 >  if (args_info.twinnedCrystal_flag){
205 >     myGeometry = new GeometryBuilder(rodLength,rodDiameter);
206 >  }
207 >  else{
208 >     myGeometry = new GeometryBuilder(rodLength,rodDiameter);
209 >  }
210 >  
211    if (args_info.genGeomview_given){
212       if (args_info.genGeomview_flag){
213          outGeomFileName = getPrefix(inputFileName.c_str()) + ".off";
214 <        myGeometry.dumpGeometry(outGeomFileName);
214 >        myGeometry->dumpGeometry(outGeomFileName);
215       }
216    }
217 <
217 >  
218   #endif
219    
220    /*
# Line 227 | Line 225 | int main(int argc, char *argv []) {
225    
226    //place the molecules
227    
228 <  curMolIndex = 0;
228 >
229    
230    //get the orientation of the cell sites
231    //for the same type of molecule in same lattice, it will not change
232    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  */
233    
234    
235    
254  
236    numMol = 0;
237    for(int i = -nx; i < nx; i++) {    
238      for(int j = -ny; j < ny; j++) {      
# Line 266 | Line 247 | int main(int argc, char *argv []) {
247          for(int l = 0; l < numMolPerCell; l++) {
248  
249   #ifdef HAVE_CGAL
250 <          if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
250 >          if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
251              numMol++;
252            }
253 + #else
254 +           numMol++;
255   #endif
256          }
257        }
258      }
259    }
260 <  std::cerr << "numMol before is " << numMol << std::endl;
260 >
261    
262    // needed for writing out new md file.
263    
# Line 299 | Line 282 | int main(int argc, char *argv []) {
282    Molecule* mol;
283    SimInfo::MoleculeIterator mi;
284    mol = NewInfo->beginMolecule(mi);
285 <  numMol = 0;
286 <  int countMol = 0;
285 >
286 >
287    for(int i = -nx; i < nx; i++) {
288       for(int j = -ny; j < ny; j++) {
289          for(int k = -nz; k < nz; k++) {
# Line 309 | Line 292 | int main(int argc, char *argv []) {
292             simpleLat->getLatticePointsPos(latticePos, i, j, k);
293            
294             for(int l = 0; l < numMolPerCell; l++) {
295 <              if (myGeometry.isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
296 <                 countMol++;              
295 > #ifdef HAVE_CGAL              
296 >              if (myGeometry->isInsidePolyhedron(latticePos[l][0],latticePos[l][1],latticePos[l][2])){
297 > #endif                              
298                   if (mol != NULL) {
299                      locator->placeMol(latticePos[l], latticeOrt[l], mol);
316                    numMol++;
300                   } else {
301 <                    std::cerr<<"Error in placing molecule " << countMol << std::endl;                    
301 >                    std::cerr<<"Error in placing molecule " << std::endl;                    
302                   }
303                   mol = NewInfo->nextMolecule(mi);
304 + #ifdef HAVE_CGAL                
305                }
306 <              
306 > #endif              
307             }
308          }
309       }
310    }
311    
312 <  std::cerr << "numMol after is " << numMol << std::endl;
312 >
313    
314    //fill Hmat
315    hmat(0, 0)= nx * latticeConstant;
# Line 353 | Line 337 | int main(int argc, char *argv []) {
337      exit(1);
338    }
339    
340 <  writer->writeDump();
340 >  writer->writeEor();
341    std::cout << "new initial configuration file: " << outInitFileName
342              << " is generated." << std::endl;
343    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines