254 |
|
|
255 |
|
moveA(); |
256 |
|
|
257 |
– |
if (nConstrained){ |
258 |
– |
constrainA(); |
259 |
– |
} |
257 |
|
|
258 |
|
|
259 |
+ |
|
260 |
|
#ifdef IS_MPI |
261 |
|
strcpy(checkPointMsg, "Succesful moveA\n"); |
262 |
|
MPIcheckPoint(); |
277 |
|
|
278 |
|
moveB(); |
279 |
|
|
282 |
– |
if (nConstrained){ |
283 |
– |
constrainB(); |
284 |
– |
} |
280 |
|
|
281 |
+ |
|
282 |
|
#ifdef IS_MPI |
283 |
|
strcpy(checkPointMsg, "Succesful moveB\n"); |
284 |
|
MPIcheckPoint(); |
290 |
|
int i, j; |
291 |
|
DirectionalAtom* dAtom; |
292 |
|
double Tb[3], ji[3]; |
297 |
– |
double A[3][3], I[3][3]; |
298 |
– |
double angle; |
293 |
|
double vel[3], pos[3], frc[3]; |
294 |
|
double mass; |
295 |
|
|
325 |
|
for (j = 0; j < 3; j++) |
326 |
|
ji[j] += (dt2 * Tb[j]) * eConvert; |
327 |
|
|
328 |
< |
// use the angular velocities to propagate the rotation matrix a |
335 |
< |
// full time step |
328 |
> |
this->rotationPropagation( dAtom, ji ); |
329 |
|
|
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 |
– |
|
360 |
– |
|
330 |
|
dAtom->setJ(ji); |
362 |
– |
dAtom->setA(A); |
331 |
|
} |
332 |
|
} |
333 |
+ |
|
334 |
+ |
if (nConstrained){ |
335 |
+ |
constrainA(); |
336 |
+ |
} |
337 |
|
} |
338 |
|
|
339 |
|
|
374 |
|
|
375 |
|
dAtom->setJ(ji); |
376 |
|
} |
377 |
+ |
} |
378 |
+ |
|
379 |
+ |
if (nConstrained){ |
380 |
+ |
constrainB(); |
381 |
|
} |
382 |
|
} |
383 |
|
|
537 |
|
painCave.isFatal = 1; |
538 |
|
simError(); |
539 |
|
} |
540 |
+ |
|
541 |
|
} |
542 |
|
|
543 |
|
template<typename T> void Integrator<T>::constrainB(void){ |
639 |
|
painCave.isFatal = 1; |
640 |
|
simError(); |
641 |
|
} |
642 |
+ |
} |
643 |
+ |
|
644 |
+ |
template<typename T> void Integrator<T>::rotationPropagation |
645 |
+ |
( DirectionalAtom* dAtom, double ji[3] ){ |
646 |
+ |
|
647 |
+ |
double angle; |
648 |
+ |
double A[3][3], I[3][3]; |
649 |
+ |
|
650 |
+ |
// use the angular velocities to propagate the rotation matrix a |
651 |
+ |
// full time step |
652 |
+ |
|
653 |
+ |
dAtom->getA(A); |
654 |
+ |
dAtom->getI(I); |
655 |
+ |
|
656 |
+ |
// rotate about the x-axis |
657 |
+ |
angle = dt2 * ji[0] / I[0][0]; |
658 |
+ |
this->rotate( 1, 2, angle, ji, A ); |
659 |
+ |
|
660 |
+ |
// rotate about the y-axis |
661 |
+ |
angle = dt2 * ji[1] / I[1][1]; |
662 |
+ |
this->rotate( 2, 0, angle, ji, A ); |
663 |
+ |
|
664 |
+ |
// rotate about the z-axis |
665 |
+ |
angle = dt * ji[2] / I[2][2]; |
666 |
+ |
this->rotate( 0, 1, 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 x-axis |
673 |
+ |
angle = dt2 * ji[0] / I[0][0]; |
674 |
+ |
this->rotate( 1, 2, angle, ji, A ); |
675 |
+ |
|
676 |
+ |
dAtom->setA( A ); |
677 |
|
} |
678 |
|
|
679 |
|
template<typename T> void Integrator<T>::rotate(int axes1, int axes2, |
766 |
|
template<typename T> void Integrator<T>::thermalize(){ |
767 |
|
tStats->velocitize(); |
768 |
|
} |
769 |
+ |
|
770 |
+ |
template<typename T> double Integrator<T>::getConservedQuantity(void){ |
771 |
+ |
return tStats->getTotalE(); |
772 |
+ |
} |