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 610 by gezelter, Tue Jul 15 15:50:55 2003 UTC vs.
Revision 1104 by gezelter, Tue Apr 13 16:26:03 2004 UTC

# Line 1 | Line 1
1 < #include <cstdlib>
1 > #include <stdlib.h>
2  
3  
4   #include "Molecule.hpp"
# Line 15 | Line 15 | Molecule::Molecule( void ){
15  
16   }
17  
18
19
18   Molecule::~Molecule( void ){
19    int i;
20    
# Line 40 | Line 38 | Molecule::~Molecule( void ){
38      delete[] myTorsions;
39    }
40  
43  if( myExcludes != NULL ){
44    for(i=0; i<nExcludes; i++) if(myExcludes[i] != NULL ) delete myExcludes[i];
45    delete[] myExcludes;
46  }
41   }
42  
43  
# Line 54 | Line 48 | void Molecule::initialize( molInit &theInit ){
48    nBonds = theInit.nBonds;
49    nBends = theInit.nBends;
50    nTorsions = theInit.nTorsions;
51 <  nExcludes = theInit.nExcludes;
51 >  nRigidBodies = theInit.nRigidBodies;
52    nOriented = theInit.nOriented;
53  
54    myAtoms = theInit.myAtoms;
55    myBonds = theInit.myBonds;
56    myBends = theInit.myBends;
57    myTorsions = theInit.myTorsions;
58 <  myExcludes = theInit.myExcludes;
58 >  myRigidBodies = theInit.myRigidBodies;
59 >
60 >  myIntegrableObjects = theInit.myIntegrableObjects;
61      
62   }
63  
# Line 69 | Line 65 | void Molecule::calcForces( void ){
65    
66    int i;
67  
68 +  for(i=0; i<myRigidBodies.size(); i++) {
69 +    myRigidBodies[i]->updateAtoms();
70 +  }
71 +
72    for(i=0; i<nBonds; i++){
73      myBonds[i]->calc_forces();
74    }
# Line 80 | Line 80 | void Molecule::calcForces( void ){
80    for(i=0; i<nTorsions; i++){
81      myTorsions[i]->calc_forces();
82    }
83 +
84 +  // Rigid Body forces and torques are done after the fortran force loop
85 +
86   }
87  
88  
# Line 118 | Line 121 | void Molecule::printMe( void ){
121    for(i=0; i<nTorsions; i++){
122      myTorsions[i]->printMe();
123    }
124 +
125   }
126  
127   void Molecule::moveCOM(double delta[3]){
# Line 135 | Line 139 | void Molecule::moveCOM(double delta[3]){
139        myAtoms[i]->setPos( aPos );
140      }
141    }
142 +
143 +  for(i=0; i<myRigidBodies.size(); i++) {
144 +
145 +      myRigidBodies[i]->getPos( aPos );
146 +
147 +      for (j=0; j< 3; j++)
148 +        aPos[j] += delta[j];
149 +      
150 +      myRigidBodies[i]->setPos( aPos );
151 +    }
152   }
153  
154 + void Molecule::atoms2rigidBodies( void ) {
155 +  int i;
156 +  for (i = 0; i < myRigidBodies.size(); i++) {
157 +    myRigidBodies[i]->calcForcesAndTorques();  
158 +  }
159 + }
160 +
161   void Molecule::getCOM( double COM[3] ) {
162  
163    double mass, mtot;
# Line 198 | Line 219 | double Molecule::getCOMvel( double COMvel[3] ) {
219    return mtot;
220  
221   }
222 +
223 + double Molecule::getTotalMass()
224 + {
225 +  int natoms;
226 +  Atom** atoms;
227 +  double totalMass;
228 +  
229 +  natoms = getNAtoms();
230 +  atoms = getMyAtoms();
231 +  totalMass = 0;
232 +  for(int i =0; i < natoms; i++){
233 +    totalMass += atoms[i]->getMass();
234 +  }
235 +
236 +  return totalMass;
237 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines