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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines