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 1136 by tim, Tue Apr 27 16:26:44 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 42 | Line 42 | void Molecule::initialize( molInit &theInit ){
42  
43  
44   void Molecule::initialize( molInit &theInit ){
45 <  double totMass;
46 <  
45 >
46    nAtoms = theInit.nAtoms;
47    nMembers = nAtoms;
48    nBonds = theInit.nBonds;
# Line 63 | Line 62 | void Molecule::initialize( molInit &theInit ){
62    for (int i = 0; i < myRigidBodies.size(); i++)
63        myRigidBodies[i]->calcRefCoords();
64  
66
67  //the mass ratio will never change during the simulation. Thus, we could
68  //just calculate it at the begining of the simulation
69  totMass = getTotalMass();
70  for(int i = 0; i < nAtoms; i ++)
71    myAtoms[i]->setMassRatio(myAtoms[i]->getMass()/totMass);  
65   }
66  
67   void Molecule::calcForces( void ){
# Line 80 | Line 73 | void Molecule::calcForces( void ){
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 ++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines