1 |
|
#include <iostream> |
2 |
< |
#include <cstdlib> |
3 |
< |
#include <cmath> |
2 |
> |
#include <stdlib.h> |
3 |
> |
#include <math.h> |
4 |
|
|
5 |
|
#ifdef IS_MPI |
6 |
|
#include "mpiSimulation.hpp" |
25 |
|
if (info->the_integrator != NULL){ |
26 |
|
delete info->the_integrator; |
27 |
|
} |
28 |
< |
|
28 |
> |
|
29 |
|
nAtoms = info->n_atoms; |
30 |
|
|
31 |
|
// check for constraints |
158 |
|
double currThermal; |
159 |
|
double currStatus; |
160 |
|
double currReset; |
161 |
< |
|
161 |
> |
|
162 |
|
int calcPot, calcStress; |
163 |
|
|
164 |
|
tStats = new Thermo(info); |
174 |
|
|
175 |
|
// initialize the forces before the first step |
176 |
|
|
177 |
+ |
std::cerr << "Before initial Force calc\n"; |
178 |
+ |
|
179 |
|
calcForce(1, 1); |
180 |
|
|
181 |
|
if (nConstrained){ |
182 |
|
preMove(); |
183 |
|
constrainA(); |
184 |
< |
calcForce(1, 1); |
184 |
> |
calcForce(1, 1); |
185 |
|
constrainB(); |
186 |
+ |
std::cerr << "premove done\n"; |
187 |
|
} |
188 |
< |
|
188 |
> |
|
189 |
> |
|
190 |
> |
|
191 |
|
if (info->setTemp){ |
192 |
|
thermalize(); |
193 |
|
} |
232 |
|
} |
233 |
|
|
234 |
|
if (info->getTime() >= currStatus){ |
235 |
< |
statOut->writeStat(info->getTime()); |
236 |
< |
calcPot = 0; |
235 |
> |
statOut->writeStat(info->getTime()); |
236 |
> |
calcPot = 0; |
237 |
|
calcStress = 0; |
238 |
|
currStatus += statusTime; |
239 |
< |
} |
239 |
> |
} |
240 |
|
|
241 |
|
if (info->resetIntegrator){ |
242 |
|
if (info->getTime() >= currReset){ |
244 |
|
currReset += resetTime; |
245 |
|
} |
246 |
|
} |
247 |
+ |
|
248 |
+ |
std::cerr << "done with time = " << info->getTime() << "\n"; |
249 |
|
|
250 |
|
#ifdef IS_MPI |
251 |
|
strcpy(checkPointMsg, "successfully took a time step."); |
373 |
|
if (atoms[i]->isDirectional()){ |
374 |
|
dAtom = (DirectionalAtom *) atoms[i]; |
375 |
|
|
376 |
< |
// get and convert the torque to body frame |
376 |
> |
// get and convert the torque to body frame |
377 |
|
|
378 |
|
dAtom->getTrq(Tb); |
379 |
|
dAtom->lab2Body(Tb); |
665 |
|
|
666 |
|
dAtom->getA(A); |
667 |
|
dAtom->getI(I); |
668 |
< |
|
669 |
< |
// rotate about the x-axis |
668 |
> |
|
669 |
> |
// rotate about the x-axis |
670 |
|
angle = dt2 * ji[0] / I[0][0]; |
671 |
< |
this->rotate( 1, 2, angle, ji, A ); |
672 |
< |
|
671 |
> |
this->rotate( 1, 2, angle, ji, A ); |
672 |
> |
|
673 |
|
// rotate about the y-axis |
674 |
|
angle = dt2 * ji[1] / I[1][1]; |
675 |
|
this->rotate( 2, 0, angle, ji, A ); |
676 |
< |
|
676 |
> |
|
677 |
|
// rotate about the z-axis |
678 |
|
angle = dt * ji[2] / I[2][2]; |
679 |
|
this->rotate( 0, 1, angle, ji, A); |
680 |
< |
|
680 |
> |
|
681 |
|
// rotate about the y-axis |
682 |
|
angle = dt2 * ji[1] / I[1][1]; |
683 |
|
this->rotate( 2, 0, angle, ji, A ); |
684 |
< |
|
684 |
> |
|
685 |
|
// rotate about the x-axis |
686 |
|
angle = dt2 * ji[0] / I[0][0]; |
687 |
|
this->rotate( 1, 2, angle, ji, A ); |
688 |
< |
|
689 |
< |
dAtom->setA( A ); |
688 |
> |
|
689 |
> |
dAtom->setA( A ); |
690 |
|
} |
691 |
|
|
692 |
|
template<typename T> void Integrator<T>::rotate(int axes1, int axes2, |
754 |
|
} |
755 |
|
} |
756 |
|
|
757 |
< |
// rotate the Rotation matrix acording to: |
757 |
> |
// rotate the Rotation matrix acording to: |
758 |
|
// A[][] = A[][] * transpose(rot[][]) |
759 |
|
|
760 |
|
|
783 |
|
template<typename T> double Integrator<T>::getConservedQuantity(void){ |
784 |
|
return tStats->getTotalE(); |
785 |
|
} |
786 |
+ |
template<typename T> string Integrator<T>::getAdditionalParameters(void){ |
787 |
+ |
//By default, return a null string |
788 |
+ |
//The reason we use string instead of char* is that if we use char*, we will |
789 |
+ |
//return a pointer point to local variable which might cause problem |
790 |
+ |
return string(); |
791 |
+ |
} |