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 1136 by tim, Tue Apr 27 16:26:44 2004 UTC

# Line 42 | Line 42 | void Molecule::initialize( molInit &theInit ){
42  
43  
44   void Molecule::initialize( molInit &theInit ){
45 <
45 >  double totMass;
46 >  
47    nAtoms = theInit.nAtoms;
48    nMembers = nAtoms;
49    nBonds = theInit.nBonds;
# Line 61 | Line 62 | void Molecule::initialize( molInit &theInit ){
62  
63    for (int i = 0; i < myRigidBodies.size(); i++)
64        myRigidBodies[i]->calcRefCoords();
65 <    
65 >
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);  
72   }
73  
74   void Molecule::calcForces( void ){
75    
76    int i;
77 +  double com[3];
78  
79    for(i=0; i<myRigidBodies.size(); i++) {
80      myRigidBodies[i]->updateAtoms();
81    }
82  
83 +  //calculate the center of mass of the molecule
84 +  getCOM(com);  
85 +  for(int i = 0; i < nAtoms; i ++)
86 +    myAtoms[i]->setRc(com);  
87 +  
88 +
89    for(i=0; i<nBonds; i++){
90      myBonds[i]->calc_forces();
91    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines