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 1187 by chrisfen, Sat May 22 18:16:18 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 259 | Line 262 | void RigidBody::body2Lab( double r[3] ){
262  
263   }
264  
265 + double RigidBody::getZangle( ){
266 +    return zAngle;
267 + }
268 +
269 + void RigidBody::setZangle( double zAng ){
270 +    zAngle = zAng;
271 + }
272 +
273 + void RigidBody::addZangle( double zAng ){
274 +    zAngle += zAng;
275 + }
276 +
277   void RigidBody::calcRefCoords( ) {
278  
279 <  int i,j,k, it;
279 >  int i,j,k, it, n_linear_coords;
280    double mtmp;
281    vec3 apos;
282    double refCOM[3];
# Line 328 | Line 343 | void RigidBody::calcRefCoords( ) {
343    
344    // zero out I and then fill the diagonals with the moments of inertia:
345  
346 +  n_linear_coords = 0;
347 +
348    for (i = 0; i < 3; i++) {
349      for (j = 0; j < 3; j++) {
350        I[i][j] = 0.0;  
351      }
352      I[i][i] = evals[i];
353 +
354 +    if (fabs(evals[i]) < momIntTol) {
355 +      is_linear = true;
356 +      n_linear_coords++;
357 +      linear_axis = i;
358 +    }
359    }
360 +
361 +  if (n_linear_coords > 1) {
362 +          sprintf( painCave.errMsg,
363 +               "RigidBody error.\n"
364 +               "\tOOPSE found more than one axis in this rigid body with a vanishing \n"
365 +               "\tmoment of inertia.  This can happen in one of three ways:\n"
366 +               "\t 1) Only one atom was specified, or \n"
367 +               "\t 2) All atoms were specified at the same location, or\n"
368 +               "\t 3) The programmers did something stupid.\n"
369 +               "\tIt is silly to use a rigid body to describe this situation.  Be smarter.\n"
370 +               );
371 +      painCave.isFatal = 1;
372 +      simError();
373 +  }
374    
375    // renormalize column vectors:
376    
# Line 601 | Line 638 | void RigidBody::findCOM() {
638    }
639  
640   }
641 +
642 + void RigidBody::accept(BaseVisitor* v){
643 +  vector<Atom*>::iterator atomIter;
644 +  v->visit(this);
645 +
646 +  //for(atomIter = myAtoms.begin(); atomIter != myAtoms.end(); ++atomIter)
647 +  //  (*atomIter)->accept(v);
648 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines