ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-1.0/utils/sysbuilder/simpleBuilder.cpp
(Generate patch)

Comparing trunk/OOPSE-1.0/utils/sysbuilder/simpleBuilder.cpp (file contents):
Revision 1424 by tim, Wed Jul 28 04:59:35 2004 UTC vs.
Revision 1427 by tim, Wed Jul 28 18:42:59 2004 UTC

# Line 14 | Line 14
14   #include "simpleBuilderCmd.hpp"
15   #include "StringUtils.hpp"
16   #include "LatticeFactory.hpp"
17 + #include "Vector3d.hpp"
18  
19   using namespace std;
20  
# Line 33 | Line 34 | int main( int argc, char* argv[]){
34    BaseLattice* simpleLat;
35    int numMol;
36    double latticeConstant;
37 +  vector lc;
38    double mass;
39    double density;
40    int nx, ny, nz;
41    double Hmat[3][3];
42    MoLocator *locator;
43 <  double* posX;
44 <  double* posY;
43 <  double* posZ;
43 >  vector<Vector3d> latticePos;
44 >  vector<Vector3d> latticeOrt;
45    int numMolPerCell;
46    int curMolIndex;
47    DumpWriter* writer;
# Line 125 | Line 126 | int main( int argc, char* argv[]){
126    }
127  
128    //creat lattice
129 <        simpleLat = LatticeFactory::getInstance()       ->createLattice(latticeType);
129 >        simpleLat = LatticeFactory::getInstance()->createLattice(latticeType);
130          if(simpleLat == NULL){
131                  cerr << "Error in creating lattice" << endl;
132                  exit(1);
# Line 137 | Line 138 | int main( int argc, char* argv[]){
138    latticeConstant = pow(numMolPerCell * mass /density, 1.0/3.0);
139    
140    //set lattice constant
141 <  simpleLat->setLatticeConstant(latticeConstant);
141 >  lc.push_back(latticeConstant);
142 >  simpleLat->setLatticeConstant(lc);
143    
144    //calculate the total
145    numMol = args_info.nx_arg * args_info.ny_arg * args_info.nz_arg * numMolPerCell;
# Line 175 | Line 177 | int main( int argc, char* argv[]){
177    newSimSetup->parseFile(&outMdFileName[0] );
178    newSimSetup->createSim();
179  
180 <  //set Hamt
180 >  //set Hmat
181    newInfo->setBoxM(Hmat);
182  
183    //allocat memory for storing pos, vel and etc
# Line 184 | Line 186 | int main( int argc, char* argv[]){
186      newInfo.atoms[i]->setCoords();  
187  
188    //creat Molocator
189 <  locator = new MoLocator(newInfo->compStamps[0]);
188 <
189 <  //allocate memory for posX, posY, posZ
190 <
191 <  posX = new doule[numMolPerCell];
192 <  if(posX == NULL){
193 <    cerr << "memory allocation error" << endl;
194 <    exit(1);
195 <  }
196 <
197 <  posY = new doule[numMolPerCell];
198 <  if(posX == NULL){
199 <    cerr << "memory allocation error" << endl;
200 <    exit(1);
201 <  }
189 >  locator = new MoLocator(newInfo->compStamps[0], newSimSetup->the_ff);
190  
203  posZ = new doule[numMolPerCell];
204  if(posX == NULL){
205    cerr << "memory allocation error" << endl;
206    exit(1);
207  }
208
191    //place the molecules
192  
193    curMolIndex = 0;
194 +
195 +  //get the orientation of the cell sites
196 +  //for the same type of molecule in same lattice, it will not change
197 +  latticeOrt = simpleLat->getLatticePointsOrt();
198 +
199    for(int i =0; i < nx; i++){
200      for(int j=0; j < ny; j++){
201         for(int k = 0; k < nz; k++){
215        
216          simpleLat->getLatticePoints(&posX, &posY, &posZ, i, j, k);
202  
203 +          //get the position of the cell sites
204 +          simpleLat->getLatticePointsPos(latticePos, i, j, k);
205 +
206            for(int l = 0; l < numMolPerCell; l++)
207 <            locator->placeMol(posX[l], posY[l], posZ[l], newInfo->molecules[curMolIndex++]);
207 >            locator->placeMol(latticePos[l], latticeOrt[l], newInfo->molecules[curMolIndex++]);
208         }
209      }
210    }
# Line 243 | Line 231 | int main( int argc, char* argv[]){
231    if(!newSimSetup)
232       delete newSimSetup;
233  
246  if (posX)
247     delete[] posX;
248
249  if (posY)
250     delete[] posY;
251
252  if (posZ)
253   delete[] posZ;
254
234    if (writer != NULL)
235      delete writer;
236    return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines