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 1109 by gezelter, Wed Apr 14 16:32:15 2004 UTC vs.
Revision 1113 by tim, Thu Apr 15 16:18:26 2004 UTC

# Line 58 | Line 58 | void Molecule::initialize( molInit &theInit ){
58    myRigidBodies = theInit.myRigidBodies;
59  
60    myIntegrableObjects = theInit.myIntegrableObjects;
61 +
62 +  for (int i = 0; i < myRigidBodies.size(); i++)
63 +      myRigidBodies[i]->calcRefCoords();
64      
65   }
66  
# Line 132 | Line 135 | void Molecule::moveCOM(double delta[3]){
135    double aPos[3];
136    int i, j;
137  
138 <  for(i=0; i<nAtoms; i++) {
139 <    if(myAtoms[i] != NULL ) {
138 >  for(i=0; i<myIntegrableObjects.size(); i++) {
139 >    if(myIntegrableObjects[i] != NULL ) {
140        
141 <      myAtoms[i]->getPos( aPos );
141 >      myIntegrableObjects[i]->getPos( aPos );
142        
143        for (j=0; j< 3; j++)
144          aPos[j] += delta[j];
145  
146 <      myAtoms[i]->setPos( aPos );
146 >      myIntegrableObjects[i]->setPos( aPos );
147      }
148    }
149  
# Line 173 | Line 176 | void Molecule::getCOM( double COM[3] ) {
176  
177    mtot   = 0.0;
178  
179 <  for (i=0; i < nAtoms; i++) {
180 <    if (myAtoms[i] != NULL) {
179 >  for (i=0; i < myIntegrableObjects.size(); i++) {
180 >    if (myIntegrableObjects[i] != NULL) {
181  
182 <      mass = myAtoms[i]->getMass();
182 >      mass = myIntegrableObjects[i]->getMass();
183        mtot   += mass;
184        
185 <      myAtoms[i]->getPos( aPos );
185 >      myIntegrableObjects[i]->getPos( aPos );
186  
187        for( j = 0; j < 3; j++)
188          COM[j] += aPos[j] * mass;
# Line 203 | Line 206 | double Molecule::getCOMvel( double COMvel[3] ) {
206  
207    mtot   = 0.0;
208  
209 <  for (i=0; i < nAtoms; i++) {
210 <    if (myAtoms[i] != NULL) {
209 >  for (i=0; i < myIntegrableObjects.size(); i++) {
210 >    if (myIntegrableObjects[i] != NULL) {
211  
212 <      mass = myAtoms[i]->getMass();
212 >      mass = myIntegrableObjects[i]->getMass();
213        mtot   += mass;
214  
215 <      myAtoms[i]->getVel(aVel);
215 >      myIntegrableObjects[i]->getVel(aVel);
216  
217        for (j=0; j<3; j++)
218          COMvel[j] += aVel[j]*mass;
# Line 226 | Line 229 | double Molecule::getTotalMass()
229  
230   double Molecule::getTotalMass()
231   {
232 <  int natoms;
230 <  Atom** atoms;
232 >
233    double totalMass;
234    
233  natoms = getNAtoms();
234  atoms = getMyAtoms();
235    totalMass = 0;
236 <  for(int i =0; i < natoms; i++){
237 <    totalMass += atoms[i]->getMass();
236 >  for(int i =0; i < myIntegrableObjects.size(); i++){
237 >    totalMass += myIntegrableObjects[i]->getMass();
238    }
239  
240    return totalMass;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines