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

Comparing trunk/OOPSE/libmdtools/Integrator.cpp (file contents):
Revision 746 by mmeineke, Thu Sep 4 21:48:35 2003 UTC vs.
Revision 781 by tim, Mon Sep 22 23:07:57 2003 UTC

# Line 177 | Line 177 | template<typename T> void Integrator<T>::integrate(voi
177    // initialize the forces before the first step
178  
179    calcForce(1, 1);
180 +
181 +  if (nConstrained){
182 +    preMove();
183 +    constrainA();
184 +    calcForce(1, 1);    
185 +    constrainB();
186 +  }
187    
188    if (info->setTemp){
189      thermalize();
# Line 254 | Line 261 | template<typename T> void Integrator<T>::integrateStep
261  
262    moveA();
263  
257  if (nConstrained){
258    constrainA();
259  }
264  
265  
266 +
267   #ifdef IS_MPI
268    strcpy(checkPointMsg, "Succesful moveA\n");
269    MPIcheckPoint();
# Line 279 | Line 284 | template<typename T> void Integrator<T>::integrateStep
284  
285    moveB();
286  
282  if (nConstrained){
283    constrainB();
284  }
287  
288 +
289   #ifdef IS_MPI
290    strcpy(checkPointMsg, "Succesful moveB\n");
291    MPIcheckPoint();
# Line 294 | Line 297 | template<typename T> void Integrator<T>::moveA(void){
297    int i, j;
298    DirectionalAtom* dAtom;
299    double Tb[3], ji[3];
297  double A[3][3], I[3][3];
298  double angle;
300    double vel[3], pos[3], frc[3];
301    double mass;
302  
# Line 330 | Line 331 | template<typename T> void Integrator<T>::moveA(void){
331  
332        for (j = 0; j < 3; j++)
333          ji[j] += (dt2 * Tb[j]) * eConvert;
333
334      // use the angular velocities to propagate the rotation matrix a
335      // full time step
336
337      dAtom->getA(A);
338      dAtom->getI(I);
334  
335 <      // rotate about the x-axis      
341 <      angle = dt2 * ji[0] / I[0][0];
342 <      this->rotate(1, 2, angle, ji, A);
335 >      this->rotationPropagation( dAtom, ji );
336  
344      // rotate about the y-axis
345      angle = dt2 * ji[1] / I[1][1];
346      this->rotate(2, 0, angle, ji, A);
347
348      // rotate about the z-axis
349      angle = dt * ji[2] / I[2][2];
350      this->rotate(0, 1, angle, ji, A);
351
352      // rotate about the y-axis
353      angle = dt2 * ji[1] / I[1][1];
354      this->rotate(2, 0, angle, ji, A);
355
356      // rotate about the x-axis
357      angle = dt2 * ji[0] / I[0][0];
358      this->rotate(1, 2, angle, ji, A);
359
360
337        dAtom->setJ(ji);
362      dAtom->setA(A);
338      }
339    }
340 +
341 +  if (nConstrained){
342 +    constrainA();
343 +  }
344   }
345  
346  
# Line 403 | Line 382 | template<typename T> void Integrator<T>::moveB(void){
382        dAtom->setJ(ji);
383      }
384    }
385 +
386 +  if (nConstrained){
387 +    constrainB();
388 +  }
389   }
390  
391   template<typename T> void Integrator<T>::preMove(void){
# Line 561 | Line 544 | template<typename T> void Integrator<T>::constrainA(){
544      painCave.isFatal = 1;
545      simError();
546    }
547 +
548   }
549  
550   template<typename T> void Integrator<T>::constrainB(void){
# Line 662 | Line 646 | template<typename T> void Integrator<T>::constrainB(vo
646      painCave.isFatal = 1;
647      simError();
648    }
649 + }
650 +
651 + template<typename T> void Integrator<T>::rotationPropagation
652 + ( DirectionalAtom* dAtom, double ji[3] ){
653 +
654 +  double angle;
655 +  double A[3][3], I[3][3];
656 +
657 +  // use the angular velocities to propagate the rotation matrix a
658 +  // full time step
659 +
660 +  dAtom->getA(A);
661 +  dAtom->getI(I);
662 +  
663 +  // rotate about the x-axis      
664 +  angle = dt2 * ji[0] / I[0][0];
665 +  this->rotate( 1, 2, angle, ji, A );
666 +  
667 +  // rotate about the y-axis
668 +  angle = dt2 * ji[1] / I[1][1];
669 +  this->rotate( 2, 0, angle, ji, A );
670 +  
671 +  // rotate about the z-axis
672 +  angle = dt * ji[2] / I[2][2];
673 +  this->rotate( 0, 1, angle, ji, A);
674 +  
675 +  // rotate about the y-axis
676 +  angle = dt2 * ji[1] / I[1][1];
677 +  this->rotate( 2, 0, angle, ji, A );
678 +  
679 +  // rotate about the x-axis
680 +  angle = dt2 * ji[0] / I[0][0];
681 +  this->rotate( 1, 2, angle, ji, A );
682 +  
683 +  dAtom->setA( A  );    
684   }
685  
686   template<typename T> void Integrator<T>::rotate(int axes1, int axes2,
# Line 754 | Line 773 | template<typename T> void Integrator<T>::thermalize(){
773   template<typename T> void Integrator<T>::thermalize(){
774    tStats->velocitize();
775   }
776 +
777 + template<typename T> double Integrator<T>::getConservedQuantity(void){
778 +  return tStats->getTotalE();
779 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines