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(); |
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(); |
284 |
|
|
285 |
|
moveB(); |
286 |
|
|
282 |
– |
if (nConstrained){ |
283 |
– |
constrainB(); |
284 |
– |
} |
287 |
|
|
288 |
+ |
|
289 |
|
#ifdef IS_MPI |
290 |
|
strcpy(checkPointMsg, "Succesful moveB\n"); |
291 |
|
MPIcheckPoint(); |
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 |
|
|
332 |
|
for (j = 0; j < 3; j++) |
333 |
|
ji[j] += (dt2 * Tb[j]) * eConvert; |
334 |
|
|
335 |
< |
// use the angular velocities to propagate the rotation matrix a |
335 |
< |
// full time step |
336 |
< |
|
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); |
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 |
– |
|
337 |
|
dAtom->setJ(ji); |
361 |
– |
dAtom->setA(A); |
338 |
|
} |
339 |
+ |
} |
340 |
+ |
|
341 |
+ |
if (nConstrained){ |
342 |
+ |
constrainA(); |
343 |
|
} |
344 |
|
} |
345 |
|
|
382 |
|
dAtom->setJ(ji); |
383 |
|
} |
384 |
|
} |
385 |
+ |
|
386 |
+ |
if (nConstrained){ |
387 |
+ |
constrainB(); |
388 |
+ |
} |
389 |
|
} |
390 |
|
|
391 |
|
template<typename T> void Integrator<T>::preMove(void){ |
544 |
|
painCave.isFatal = 1; |
545 |
|
simError(); |
546 |
|
} |
547 |
+ |
|
548 |
|
} |
549 |
|
|
550 |
|
template<typename T> void Integrator<T>::constrainB(void){ |
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, |
776 |
|
|
777 |
|
template<typename T> double Integrator<T>::getConservedQuantity(void){ |
778 |
|
return tStats->getTotalE(); |
779 |
< |
} |
779 |
> |
} |