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 1113 by tim, Thu Apr 15 16:18:26 2004 UTC vs.
Revision 1140 by tim, Wed Apr 28 22:34:02 2004 UTC

# Line 12 | Line 12 | Molecule::Molecule( void ){
12    myBonds = NULL;
13    myBends = NULL;
14    myTorsions = NULL;
15 <
15 >  hasMassRatio = false;
16   }
17  
18   Molecule::~Molecule( void ){
# Line 61 | Line 61 | void Molecule::initialize( molInit &theInit ){
61  
62    for (int i = 0; i < myRigidBodies.size(); i++)
63        myRigidBodies[i]->calcRefCoords();
64 <    
64 >
65   }
66  
67   void Molecule::calcForces( void ){
68    
69    int i;
70 +  double com[3];
71  
72    for(i=0; i<myRigidBodies.size(); i++) {
73      myRigidBodies[i]->updateAtoms();
74    }
75  
76 +  //the mass ratio will never change during the simulation. Thus, we could
77 +  //just calculate it at the begining of the simulation
78 +  if (!hasMassRatio){
79 +    double totMass = getTotalMass();
80 +    for(int i = 0; i < nAtoms; i ++)
81 +      myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass);  
82 +    hasMassRatio =  true;
83 +  }
84 +
85 +  //calculate the center of mass of the molecule
86 +  getCOM(com);  
87 +  for(int i = 0; i < nAtoms; i ++)
88 +    myAtoms[i]->setRc(com);  
89 +  
90 +
91    for(i=0; i<nBonds; i++){
92      myBonds[i]->calc_forces();
93    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines