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 755 by mmeineke, Tue Sep 9 20:35:25 2003 UTC vs.
Revision 784 by mmeineke, Wed Sep 24 19:34:39 2003 UTC

# Line 25 | Line 25 | template<typename T> Integrator<T>::Integrator(SimInfo
25    if (info->the_integrator != NULL){
26      delete info->the_integrator;
27    }
28 <  info->the_integrator = this;
29 <
28 >  
29    nAtoms = info->n_atoms;
30  
31    // check for constraints
# Line 174 | Line 173 | template<typename T> void Integrator<T>::integrate(voi
173    dt = info->dt;
174    dt2 = 0.5 * dt;
175  
176 +  readyCheck();
177 +
178    // initialize the forces before the first step
179  
180    calcForce(1, 1);
181 +
182 +  if (nConstrained){
183 +    preMove();
184 +    constrainA();
185 +    calcForce(1, 1);    
186 +    constrainB();
187 +  }
188    
189    if (info->setTemp){
190      thermalize();
# Line 192 | Line 200 | template<typename T> void Integrator<T>::integrate(voi
200    dumpOut->writeDump(info->getTime());
201    statOut->writeStat(info->getTime());
202  
195  readyCheck();
203  
204 +
205   #ifdef IS_MPI
206    strcpy(checkPointMsg, "The integrator is ready to go.");
207    MPIcheckPoint();
# Line 254 | Line 262 | template<typename T> void Integrator<T>::integrateStep
262  
263    moveA();
264  
257  if (nConstrained){
258    constrainA();
259  }
265  
266  
267 +
268   #ifdef IS_MPI
269    strcpy(checkPointMsg, "Succesful moveA\n");
270    MPIcheckPoint();
# Line 279 | Line 285 | template<typename T> void Integrator<T>::integrateStep
285  
286    moveB();
287  
282  if (nConstrained){
283    constrainB();
284  }
288  
289 +
290   #ifdef IS_MPI
291    strcpy(checkPointMsg, "Succesful moveB\n");
292    MPIcheckPoint();
# Line 294 | Line 298 | template<typename T> void Integrator<T>::moveA(void){
298    int i, j;
299    DirectionalAtom* dAtom;
300    double Tb[3], ji[3];
297  double A[3][3], I[3][3];
298  double angle;
301    double vel[3], pos[3], frc[3];
302    double mass;
303  
# Line 331 | Line 333 | template<typename T> void Integrator<T>::moveA(void){
333        for (j = 0; j < 3; j++)
334          ji[j] += (dt2 * Tb[j]) * eConvert;
335  
336 <      // use the angular velocities to propagate the rotation matrix a
335 <      // full time step
336 >      this->rotationPropagation( dAtom, ji );
337  
337      dAtom->getA(A);
338      dAtom->getI(I);
339
340      // rotate about the x-axis      
341      angle = dt2 * ji[0] / I[0][0];
342      this->rotate(1, 2, angle, ji, A);
343
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
338        dAtom->setJ(ji);
361      dAtom->setA(A);
339      }
340    }
341 +
342 +  if (nConstrained){
343 +    constrainA();
344 +  }
345   }
346  
347  
# Line 401 | Line 382 | template<typename T> void Integrator<T>::moveB(void){
382  
383        dAtom->setJ(ji);
384      }
385 +  }
386 +
387 +  if (nConstrained){
388 +    constrainB();
389    }
390   }
391  
# Line 560 | Line 545 | template<typename T> void Integrator<T>::constrainA(){
545      painCave.isFatal = 1;
546      simError();
547    }
548 +
549   }
550  
551   template<typename T> void Integrator<T>::constrainB(void){
# Line 661 | Line 647 | template<typename T> void Integrator<T>::constrainB(vo
647      painCave.isFatal = 1;
648      simError();
649    }
650 + }
651 +
652 + template<typename T> void Integrator<T>::rotationPropagation
653 + ( DirectionalAtom* dAtom, double ji[3] ){
654 +
655 +  double angle;
656 +  double A[3][3], I[3][3];
657 +
658 +  // use the angular velocities to propagate the rotation matrix a
659 +  // full time step
660 +
661 +  dAtom->getA(A);
662 +  dAtom->getI(I);
663 +  
664 +  // rotate about the x-axis      
665 +  angle = dt2 * ji[0] / I[0][0];
666 +  this->rotate( 1, 2, angle, ji, A );
667 +  
668 +  // rotate about the y-axis
669 +  angle = dt2 * ji[1] / I[1][1];
670 +  this->rotate( 2, 0, angle, ji, A );
671 +  
672 +  // rotate about the z-axis
673 +  angle = dt * ji[2] / I[2][2];
674 +  this->rotate( 0, 1, angle, ji, A);
675 +  
676 +  // rotate about the y-axis
677 +  angle = dt2 * ji[1] / I[1][1];
678 +  this->rotate( 2, 0, angle, ji, A );
679 +  
680 +  // rotate about the x-axis
681 +  angle = dt2 * ji[0] / I[0][0];
682 +  this->rotate( 1, 2, angle, ji, A );
683 +  
684 +  dAtom->setA( A  );    
685   }
686  
687   template<typename T> void Integrator<T>::rotate(int axes1, int axes2,
# Line 753 | Line 774 | template<typename T> void Integrator<T>::thermalize(){
774   template<typename T> void Integrator<T>::thermalize(){
775    tStats->velocitize();
776   }
777 +
778 + template<typename T> double Integrator<T>::getConservedQuantity(void){
779 +  return tStats->getTotalE();
780 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines