32 |
|
|
33 |
|
nAtoms = info->n_atoms; |
34 |
|
integrableObjects = info->integrableObjects; |
35 |
< |
|
35 |
> |
|
36 |
|
// check for constraints |
37 |
|
|
38 |
|
constrainedA = NULL; |
45 |
|
nConstrained = 0; |
46 |
|
|
47 |
|
checkConstraints(); |
48 |
+ |
|
49 |
+ |
for (i=0; i<nMols; i++) |
50 |
+ |
zAngle[i] = 0.0; |
51 |
|
} |
52 |
|
|
53 |
|
template<typename T> Integrator<T>::~Integrator(){ |
163 |
|
double thermalTime = info->thermalTime; |
164 |
|
double resetTime = info->resetTime; |
165 |
|
|
166 |
< |
|
166 |
> |
double difference; |
167 |
|
double currSample; |
168 |
|
double currThermal; |
169 |
|
double currStatus; |
182 |
|
|
183 |
|
readyCheck(); |
184 |
|
|
185 |
+ |
// remove center of mass drift velocity (in case we passed in a configuration |
186 |
+ |
// that was drifting |
187 |
+ |
tStats->removeCOMdrift(); |
188 |
+ |
|
189 |
+ |
// initialize the retraints if necessary |
190 |
+ |
if (info->useThermInt) { |
191 |
+ |
myFF->initRestraints(); |
192 |
+ |
} |
193 |
+ |
|
194 |
|
// initialize the forces before the first step |
195 |
|
|
196 |
|
calcForce(1, 1); |
185 |
– |
|
186 |
– |
//temp test |
187 |
– |
tStats->getPotential(); |
197 |
|
|
198 |
|
if (nConstrained){ |
199 |
|
preMove(); |
222 |
|
MPIcheckPoint(); |
223 |
|
#endif // is_mpi |
224 |
|
|
225 |
< |
while (info->getTime() < runTime){ |
226 |
< |
if ((info->getTime() + dt) >= currStatus){ |
225 |
> |
while (info->getTime() < runTime && !stopIntegrator()){ |
226 |
> |
difference = info->getTime() + dt - currStatus; |
227 |
> |
if (difference > 0 || fabs(difference) < 1e-4 ){ |
228 |
|
calcPot = 1; |
229 |
|
calcStress = 1; |
230 |
|
} |
257 |
|
|
258 |
|
if (info->getTime() >= currStatus){ |
259 |
|
statOut->writeStat(info->getTime()); |
260 |
+ |
statOut->writeRaw(info->getTime()); |
261 |
|
calcPot = 0; |
262 |
|
calcStress = 0; |
263 |
|
currStatus += statusTime; |
279 |
|
MPIcheckPoint(); |
280 |
|
#endif // is_mpi |
281 |
|
} |
282 |
+ |
|
283 |
+ |
// dump out a file containing the omega values for the final configuration |
284 |
+ |
if (info->useThermInt) |
285 |
+ |
myFF->dumpzAngle(); |
286 |
+ |
|
287 |
|
|
288 |
|
delete dumpOut; |
289 |
|
delete statOut; |
706 |
|
|
707 |
|
double angle; |
708 |
|
double A[3][3], I[3][3]; |
709 |
+ |
int i, j, k; |
710 |
|
|
711 |
|
// use the angular velocities to propagate the rotation matrix a |
712 |
|
// full time step |
713 |
|
|
714 |
|
sd->getA(A); |
715 |
|
sd->getI(I); |
699 |
– |
|
700 |
– |
// rotate about the x-axis |
701 |
– |
angle = dt2 * ji[0] / I[0][0]; |
702 |
– |
this->rotate( 1, 2, angle, ji, A ); |
716 |
|
|
717 |
< |
// rotate about the y-axis |
718 |
< |
angle = dt2 * ji[1] / I[1][1]; |
719 |
< |
this->rotate( 2, 0, angle, ji, A ); |
720 |
< |
|
721 |
< |
// rotate about the z-axis |
722 |
< |
angle = dt * ji[2] / I[2][2]; |
723 |
< |
this->rotate( 0, 1, angle, ji, A); |
717 |
> |
if (sd->isLinear()) { |
718 |
> |
i = sd->linearAxis(); |
719 |
> |
j = (i+1)%3; |
720 |
> |
k = (i+2)%3; |
721 |
> |
|
722 |
> |
angle = dt2 * ji[j] / I[j][j]; |
723 |
> |
this->rotate( k, i, angle, ji, A ); |
724 |
|
|
725 |
< |
// rotate about the y-axis |
726 |
< |
angle = dt2 * ji[1] / I[1][1]; |
714 |
< |
this->rotate( 2, 0, angle, ji, A ); |
725 |
> |
angle = dt * ji[k] / I[k][k]; |
726 |
> |
this->rotate( i, j, angle, ji, A); |
727 |
|
|
728 |
< |
// rotate about the x-axis |
729 |
< |
angle = dt2 * ji[0] / I[0][0]; |
718 |
< |
this->rotate( 1, 2, angle, ji, A ); |
728 |
> |
angle = dt2 * ji[j] / I[j][j]; |
729 |
> |
this->rotate( k, i, angle, ji, A ); |
730 |
|
|
731 |
+ |
} else { |
732 |
+ |
// rotate about the x-axis |
733 |
+ |
angle = dt2 * ji[0] / I[0][0]; |
734 |
+ |
this->rotate( 1, 2, angle, ji, A ); |
735 |
+ |
|
736 |
+ |
// rotate about the y-axis |
737 |
+ |
angle = dt2 * ji[1] / I[1][1]; |
738 |
+ |
this->rotate( 2, 0, angle, ji, A ); |
739 |
+ |
|
740 |
+ |
// rotate about the z-axis |
741 |
+ |
angle = dt * ji[2] / I[2][2]; |
742 |
+ |
this->rotate( 0, 1, angle, ji, A); |
743 |
+ |
|
744 |
+ |
// rotate about the y-axis |
745 |
+ |
angle = dt2 * ji[1] / I[1][1]; |
746 |
+ |
this->rotate( 2, 0, angle, ji, A ); |
747 |
+ |
|
748 |
+ |
// rotate about the x-axis |
749 |
+ |
angle = dt2 * ji[0] / I[0][0]; |
750 |
+ |
this->rotate( 1, 2, angle, ji, A ); |
751 |
+ |
|
752 |
+ |
} |
753 |
|
sd->setA( A ); |
754 |
|
} |
755 |
|
|