ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/RigidBody.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/RigidBody.cpp (file contents):
Revision 1113 by tim, Thu Apr 15 16:18:26 2004 UTC vs.
Revision 1174 by gezelter, Wed May 12 20:54:10 2004 UTC

# Line 6 | Line 6 | RigidBody::RigidBody() : StuntDouble() {
6  
7   RigidBody::RigidBody() : StuntDouble() {
8    objType = OT_RIGIDBODY;
9 +  is_linear = false;
10 +  linear_axis =  -1;
11 +  momIntTol = 1e-6;
12   }
13  
14   RigidBody::~RigidBody() {
# Line 261 | Line 264 | void RigidBody::calcRefCoords( ) {
264  
265   void RigidBody::calcRefCoords( ) {
266  
267 <  int i,j,k, it;
267 >  int i,j,k, it, n_linear_coords;
268    double mtmp;
269    vec3 apos;
270    double refCOM[3];
# Line 328 | Line 331 | void RigidBody::calcRefCoords( ) {
331    
332    // zero out I and then fill the diagonals with the moments of inertia:
333  
334 +  n_linear_coords = 0;
335 +
336    for (i = 0; i < 3; i++) {
337      for (j = 0; j < 3; j++) {
338        I[i][j] = 0.0;  
339      }
340      I[i][i] = evals[i];
341 +
342 +    if (fabs(evals[i]) < momIntTol) {
343 +      is_linear = true;
344 +      n_linear_coords++;
345 +      linear_axis = i;
346 +    }
347    }
348 +
349 +  if (n_linear_coords > 1) {
350 +          sprintf( painCave.errMsg,
351 +               "RigidBody error.\n"
352 +               "\tOOPSE found more than one axis in this rigid body with a vanishing \n"
353 +               "\tmoment of inertia.  This can happen in one of three ways:\n"
354 +               "\t 1) Only one atom was specified, or \n"
355 +               "\t 2) All atoms were specified at the same location, or\n"
356 +               "\t 3) The programmers did something stupid.\n"
357 +               "\tIt is silly to use a rigid body to describe this situation.  Be smarter.\n"
358 +               );
359 +      painCave.isFatal = 1;
360 +      simError();
361 +  }
362    
363    // renormalize column vectors:
364    
# Line 601 | Line 626 | void RigidBody::findCOM() {
626    }
627  
628   }
629 +
630 + void RigidBody::accept(BaseVisitor* v){
631 +  vector<Atom*>::iterator atomIter;
632 +  v->visit(this);
633 +
634 +  //for(atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter)
635 +  //  (*atomIter)->accept(v);
636 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines