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 725 by tim, Tue Aug 26 20:29:26 2003 UTC vs.
Revision 782 by mmeineke, Tue Sep 23 20:34:31 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 153 | Line 152 | template<typename T> void Integrator<T>::integrate(voi
152    double sampleTime = info->sampleTime;
153    double statusTime = info->statusTime;
154    double thermalTime = info->thermalTime;
155 +  double resetTime = info->resetTime;
156  
157 +
158    double currSample;
159    double currThermal;
160    double currStatus;
161 <
161 >  double currReset;
162 >  
163    int calcPot, calcStress;
164    int isError;
165  
# Line 174 | Line 176 | template<typename T> void Integrator<T>::integrate(voi
176    // initialize the forces before the first step
177  
178    calcForce(1, 1);
177  // myFF->doForces(1,1);
179  
180 +  if (nConstrained){
181 +    preMove();
182 +    constrainA();
183 +    calcForce(1, 1);    
184 +    constrainB();
185 +  }
186 +  
187    if (info->setTemp){
188      thermalize();
189    }
190  
183  calcPot = 0;
184  calcStress = 0;
185  currSample = sampleTime;
186  currThermal = thermalTime;
187  currStatus = statusTime;
188  
191    calcPot     = 0;
192    calcStress  = 0;
193    currSample  = sampleTime + info->getTime();
194    currThermal = thermalTime+ info->getTime();
195    currStatus  = statusTime + info->getTime();
196 < >>>>>>> 1.18
196 >  currReset   = resetTime  + info->getTime();
197  
198    dumpOut->writeDump(info->getTime());
199    statOut->writeStat(info->getTime());
# Line 232 | Line 234 | template<typename T> void Integrator<T>::integrate(voi
234        currStatus += statusTime;
235      }
236  
237 +    if (info->resetIntegrator){
238 +      if (info->getTime() >= currReset){
239 +        this->resetIntegrator();
240 +        currReset += resetTime;
241 +      }
242 +    }
243 +
244   #ifdef IS_MPI
245      strcpy(checkPointMsg, "successfully took a time step.");
246      MPIcheckPoint();
# Line 251 | Line 260 | template<typename T> void Integrator<T>::integrateStep
260  
261    moveA();
262  
254  if (nConstrained){
255    constrainA();
256  }
263  
264  
265 +
266   #ifdef IS_MPI
267    strcpy(checkPointMsg, "Succesful moveA\n");
268    MPIcheckPoint();
# Line 276 | Line 283 | template<typename T> void Integrator<T>::integrateStep
283  
284    moveB();
285  
279  if (nConstrained){
280    constrainB();
281  }
286  
287 +
288   #ifdef IS_MPI
289    strcpy(checkPointMsg, "Succesful moveB\n");
290    MPIcheckPoint();
# Line 291 | Line 296 | template<typename T> void Integrator<T>::moveA(void){
296    int i, j;
297    DirectionalAtom* dAtom;
298    double Tb[3], ji[3];
294  double A[3][3], I[3][3];
295  double angle;
299    double vel[3], pos[3], frc[3];
300    double mass;
301  
# Line 328 | Line 331 | template<typename T> void Integrator<T>::moveA(void){
331        for (j = 0; j < 3; j++)
332          ji[j] += (dt2 * Tb[j]) * eConvert;
333  
334 <      // use the angular velocities to propagate the rotation matrix a
332 <      // full time step
334 >      this->rotationPropagation( dAtom, ji );
335  
336 <      dAtom->getA(A);
337 <      dAtom->getI(I);
338 <
337 <      // rotate about the x-axis      
338 <      angle = dt2 * ji[0] / I[0][0];
339 <      this->rotate(1, 2, angle, ji, A);
340 <
341 <      // rotate about the y-axis
342 <      angle = dt2 * ji[1] / I[1][1];
343 <      this->rotate(2, 0, angle, ji, A);
344 <
345 <      // rotate about the z-axis
346 <      angle = dt * ji[2] / I[2][2];
347 <      this->rotate(0, 1, angle, ji, A);
336 >      dAtom->setJ(ji);
337 >    }
338 >  }
339  
340 <      // rotate about the y-axis
341 <      angle = dt2 * ji[1] / I[1][1];
351 <      this->rotate(2, 0, angle, ji, A);
352 <
353 <      // rotate about the x-axis
354 <      angle = dt2 * ji[0] / I[0][0];
355 <      this->rotate(1, 2, angle, ji, A);
356 <
357 <
358 <      dAtom->setJ(ji);
359 <      dAtom->setA(A);
360 <    }
340 >  if (nConstrained){
341 >    constrainA();
342    }
343   }
344  
# Line 400 | Line 381 | template<typename T> void Integrator<T>::moveB(void){
381        dAtom->setJ(ji);
382      }
383    }
384 +
385 +  if (nConstrained){
386 +    constrainB();
387 +  }
388   }
389  
390   template<typename T> void Integrator<T>::preMove(void){
# Line 558 | Line 543 | template<typename T> void Integrator<T>::constrainA(){
543      painCave.isFatal = 1;
544      simError();
545    }
546 +
547   }
548  
549   template<typename T> void Integrator<T>::constrainB(void){
# Line 660 | Line 646 | template<typename T> void Integrator<T>::constrainB(vo
646      simError();
647    }
648   }
649 +
650 + template<typename T> void Integrator<T>::rotationPropagation
651 + ( DirectionalAtom* dAtom, double ji[3] ){
652  
653 +  double angle;
654 +  double A[3][3], I[3][3];
655 +
656 +  // use the angular velocities to propagate the rotation matrix a
657 +  // full time step
658 +
659 +  dAtom->getA(A);
660 +  dAtom->getI(I);
661 +  
662 +  // rotate about the x-axis      
663 +  angle = dt2 * ji[0] / I[0][0];
664 +  this->rotate( 1, 2, angle, ji, A );
665 +  
666 +  // rotate about the y-axis
667 +  angle = dt2 * ji[1] / I[1][1];
668 +  this->rotate( 2, 0, angle, ji, A );
669 +  
670 +  // rotate about the z-axis
671 +  angle = dt * ji[2] / I[2][2];
672 +  this->rotate( 0, 1, angle, ji, A);
673 +  
674 +  // rotate about the y-axis
675 +  angle = dt2 * ji[1] / I[1][1];
676 +  this->rotate( 2, 0, angle, ji, A );
677 +  
678 +  // rotate about the x-axis
679 +  angle = dt2 * ji[0] / I[0][0];
680 +  this->rotate( 1, 2, angle, ji, A );
681 +  
682 +  dAtom->setA( A  );    
683 + }
684 +
685   template<typename T> void Integrator<T>::rotate(int axes1, int axes2,
686                                                  double angle, double ji[3],
687                                                  double A[3][3]){
# Line 751 | Line 772 | template<typename T> void Integrator<T>::thermalize(){
772   template<typename T> void Integrator<T>::thermalize(){
773    tStats->velocitize();
774   }
775 +
776 + template<typename T> double Integrator<T>::getConservedQuantity(void){
777 +  return tStats->getTotalE();
778 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines