ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Molecule.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Molecule.cpp (file contents):
Revision 1157 by tim, Tue May 11 20:33:41 2004 UTC vs.
Revision 1452 by tim, Mon Aug 23 15:11:36 2004 UTC

# Line 16 | Line 16 | Molecule::~Molecule( void ){
16  
17   Molecule::~Molecule( void ){
18    int i;
19 +  CutoffGroup* cg;
20 +  vector<CutoffGroup*>::iterator iter;
21    
22    if( myAtoms != NULL ){
23      for(i=0; i<nAtoms; i++) if(myAtoms[i] != NULL ) delete myAtoms[i];
# Line 37 | Line 39 | Molecule::~Molecule( void ){
39      delete[] myTorsions;
40    }
41  
42 +  for(cg = beginCutoffGroup(iter);  cg != NULL; cg = nextCutoffGroup(iter))
43 +    delete cg;
44 +  myCutoffGroups.clear();
45 +  
46   }
47  
48  
# Line 47 | Line 53 | void Molecule::initialize( molInit &theInit ){
53    Atom* cutoffAtom;
54    vector<Atom*>::iterator iterAtom;
55    int atomIndex;
56 +  GenericData* gdata;
57 +  ConsRbData* rbData;
58 +  RigidBody* oldRb;
59    
60    nAtoms = theInit.nAtoms;
61    nMembers = nAtoms;
# Line 55 | Line 64 | void Molecule::initialize( molInit &theInit ){
64    nTorsions = theInit.nTorsions;
65    nRigidBodies = theInit.nRigidBodies;
66    nOriented = theInit.nOriented;
58  nCutoffGroups = theInit.nCutoffGroups;
67  
68    myAtoms = theInit.myAtoms;
69    myBonds = theInit.myBonds;
# Line 65 | Line 73 | void Molecule::initialize( molInit &theInit ){
73  
74    myIntegrableObjects = theInit.myIntegrableObjects;
75  
76 <  for (int i = 0; i < myRigidBodies.size(); i++)
76 >  for (int i = 0; i < myRigidBodies.size(); i++){
77        myRigidBodies[i]->calcRefCoords();
78 +    //just a quick hack
79 +    
80 +    gdata = myRigidBodies[i]->getProperty("OldState");
81 +    if(gdata != NULL){
82 +      rbData = dynamic_cast<ConsRbData*>(gdata);
83 +      if(rbData ==NULL)
84 +        cerr << "dynamic_cast to ConsRbData Error in Molecule::initialize()" << endl;
85 +      else{
86 +        oldRb = rbData->getData();
87 +        oldRb->calcRefCoords();
88 +      }
89 +    }//end if(gata != NULL)
90 +    
91 +  }//end for(int i = 0; i < myRigidBodies.size(); i++)
92  
93    myCutoffGroups = theInit.myCutoffGroups;
94 +  nCutoffGroups = myCutoffGroups.size();
95  
96 <  //creat a global index set of atoms which belong to cutoff group.
74 <  //it will be use to speed up the query whether an atom belongs to cutoff group or not
75 <  cutoffAtomSet.clear();
76 <
77 <  for(curCutoffGroup = beginCutoffGroup(iterCutoff); curCutoffGroup != NULL;
78 <                                                  curCutoffGroup = nextCutoffGroup(iterCutoff)){
79 <
80 <      for(cutoffAtom = curCutoffGroup->beginAtom(iterAtom); cutoffAtom != NULL;
81 <                                           cutoffAtom = curCutoffGroup->beginAtom(iterAtom)){
82 < #ifdef IS_MPI
83 <        atomIndex = cutoffAtom->getGlobalIndex();
84 < #else
85 <        atomIndex = cutoffAtom->getIndex();
86 < #endif
87 <        cutoffAtomSet.insert(atomIndex);
88 <     }// end for(cutoffAtom)    
89 <  }//end for(curCutoffGroup)
96 >  myConstraintPairs = theInit.myConstraintPairs;
97    
98   }
99  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines