| 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" | 
| 7 | 
  | 
#include <unistd.h> | 
| 8 | 
  | 
#endif //is_mpi | 
| 9 | 
  | 
 | 
| 10 | 
+ | 
#ifdef PROFILE | 
| 11 | 
+ | 
#include "mdProfile.hpp" | 
| 12 | 
+ | 
#endif // profile | 
| 13 | 
+ | 
 | 
| 14 | 
  | 
#include "Integrator.hpp" | 
| 15 | 
  | 
#include "simError.h" | 
| 16 | 
  | 
 | 
| 29 | 
  | 
  if (info->the_integrator != NULL){ | 
| 30 | 
  | 
    delete info->the_integrator; | 
| 31 | 
  | 
  } | 
| 28 | 
– | 
  info->the_integrator = this; | 
| 32 | 
  | 
 | 
| 33 | 
  | 
  nAtoms = info->n_atoms; | 
| 34 | 
+ | 
  integrableObjects = info->integrableObjects; | 
| 35 | 
  | 
 | 
| 36 | 
  | 
  // check for constraints | 
| 37 | 
  | 
 | 
| 69 | 
  | 
 | 
| 70 | 
  | 
  SRI** theArray; | 
| 71 | 
  | 
  for (int i = 0; i < nMols; i++){ | 
| 72 | 
< | 
    theArray = (SRI * *) molecules[i].getMyBonds(); | 
| 72 | 
> | 
 | 
| 73 | 
> | 
          theArray = (SRI * *) molecules[i].getMyBonds(); | 
| 74 | 
  | 
    for (int j = 0; j < molecules[i].getNBonds(); j++){ | 
| 75 | 
  | 
      constrained = theArray[j]->is_constrained(); | 
| 76 | 
  | 
 | 
| 116 | 
  | 
    } | 
| 117 | 
  | 
  } | 
| 118 | 
  | 
 | 
| 119 | 
+ | 
 | 
| 120 | 
  | 
  if (nConstrained > 0){ | 
| 121 | 
  | 
    isConstrained = 1; | 
| 122 | 
  | 
 | 
| 138 | 
  | 
    } | 
| 139 | 
  | 
 | 
| 140 | 
  | 
 | 
| 141 | 
< | 
    // save oldAtoms to check for lode balanceing later on. | 
| 141 | 
> | 
    // save oldAtoms to check for lode balancing later on. | 
| 142 | 
  | 
 | 
| 143 | 
  | 
    oldAtoms = nAtoms; | 
| 144 | 
  | 
 | 
| 153 | 
  | 
 | 
| 154 | 
  | 
 | 
| 155 | 
  | 
template<typename T> void Integrator<T>::integrate(void){ | 
| 150 | 
– | 
  int i, j;                         // loop counters | 
| 156 | 
  | 
 | 
| 157 | 
  | 
  double runTime = info->run_time; | 
| 158 | 
  | 
  double sampleTime = info->sampleTime; | 
| 165 | 
  | 
  double currThermal; | 
| 166 | 
  | 
  double currStatus; | 
| 167 | 
  | 
  double currReset; | 
| 168 | 
< | 
   | 
| 168 | 
> | 
 | 
| 169 | 
  | 
  int calcPot, calcStress; | 
| 165 | 
– | 
  int isError; | 
| 170 | 
  | 
 | 
| 171 | 
  | 
  tStats = new Thermo(info); | 
| 172 | 
  | 
  statOut = new StatWriter(info); | 
| 173 | 
  | 
  dumpOut = new DumpWriter(info); | 
| 174 | 
  | 
 | 
| 175 | 
  | 
  atoms = info->atoms; | 
| 172 | 
– | 
  DirectionalAtom* dAtom; | 
| 176 | 
  | 
 | 
| 177 | 
  | 
  dt = info->dt; | 
| 178 | 
  | 
  dt2 = 0.5 * dt; | 
| 179 | 
  | 
 | 
| 180 | 
+ | 
  readyCheck(); | 
| 181 | 
+ | 
 | 
| 182 | 
  | 
  // initialize the forces before the first step | 
| 183 | 
  | 
 | 
| 184 | 
  | 
  calcForce(1, 1); | 
| 185 | 
  | 
   | 
| 186 | 
+ | 
  if (nConstrained){ | 
| 187 | 
+ | 
    preMove(); | 
| 188 | 
+ | 
    constrainA(); | 
| 189 | 
+ | 
    calcForce(1, 1); | 
| 190 | 
+ | 
    constrainB(); | 
| 191 | 
+ | 
  } | 
| 192 | 
+ | 
   | 
| 193 | 
  | 
  if (info->setTemp){ | 
| 194 | 
  | 
    thermalize(); | 
| 195 | 
  | 
  } | 
| 204 | 
  | 
  dumpOut->writeDump(info->getTime()); | 
| 205 | 
  | 
  statOut->writeStat(info->getTime()); | 
| 206 | 
  | 
 | 
| 195 | 
– | 
  readyCheck(); | 
| 207 | 
  | 
 | 
| 208 | 
  | 
#ifdef IS_MPI | 
| 209 | 
  | 
  strcpy(checkPointMsg, "The integrator is ready to go."); | 
| 210 | 
  | 
  MPIcheckPoint(); | 
| 211 | 
  | 
#endif // is_mpi | 
| 212 | 
  | 
 | 
| 213 | 
< | 
  while (info->getTime() < runTime){ | 
| 213 | 
> | 
  while (info->getTime() < runTime && !stopIntegrator()){ | 
| 214 | 
  | 
    if ((info->getTime() + dt) >= currStatus){ | 
| 215 | 
  | 
      calcPot = 1; | 
| 216 | 
  | 
      calcStress = 1; | 
| 217 | 
  | 
    } | 
| 218 | 
  | 
 | 
| 219 | 
+ | 
#ifdef PROFILE | 
| 220 | 
+ | 
    startProfile( pro1 ); | 
| 221 | 
+ | 
#endif | 
| 222 | 
+ | 
     | 
| 223 | 
  | 
    integrateStep(calcPot, calcStress); | 
| 224 | 
  | 
 | 
| 225 | 
+ | 
#ifdef PROFILE | 
| 226 | 
+ | 
    endProfile( pro1 ); | 
| 227 | 
+ | 
 | 
| 228 | 
+ | 
    startProfile( pro2 ); | 
| 229 | 
+ | 
#endif // profile | 
| 230 | 
+ | 
 | 
| 231 | 
  | 
    info->incrTime(dt); | 
| 232 | 
  | 
 | 
| 233 | 
  | 
    if (info->setTemp){ | 
| 243 | 
  | 
    } | 
| 244 | 
  | 
 | 
| 245 | 
  | 
    if (info->getTime() >= currStatus){ | 
| 246 | 
< | 
      statOut->writeStat(info->getTime());  | 
| 247 | 
< | 
      calcPot = 0;  | 
| 246 | 
> | 
      statOut->writeStat(info->getTime()); | 
| 247 | 
> | 
      calcPot = 0; | 
| 248 | 
  | 
      calcStress = 0; | 
| 249 | 
  | 
      currStatus += statusTime; | 
| 250 | 
< | 
    }  | 
| 250 | 
> | 
    } | 
| 251 | 
  | 
 | 
| 252 | 
  | 
    if (info->resetIntegrator){ | 
| 253 | 
  | 
      if (info->getTime() >= currReset){ | 
| 255 | 
  | 
        currReset += resetTime; | 
| 256 | 
  | 
      } | 
| 257 | 
  | 
    } | 
| 258 | 
+ | 
     | 
| 259 | 
+ | 
#ifdef PROFILE | 
| 260 | 
+ | 
    endProfile( pro2 ); | 
| 261 | 
+ | 
#endif //profile | 
| 262 | 
  | 
 | 
| 263 | 
  | 
#ifdef IS_MPI | 
| 264 | 
  | 
    strcpy(checkPointMsg, "successfully took a time step."); | 
| 266 | 
  | 
#endif // is_mpi | 
| 267 | 
  | 
  } | 
| 268 | 
  | 
 | 
| 244 | 
– | 
  dumpOut->writeFinal(info->getTime()); | 
| 245 | 
– | 
 | 
| 269 | 
  | 
  delete dumpOut; | 
| 270 | 
  | 
  delete statOut; | 
| 271 | 
  | 
} | 
| 273 | 
  | 
template<typename T> void Integrator<T>::integrateStep(int calcPot, | 
| 274 | 
  | 
                                                       int calcStress){ | 
| 275 | 
  | 
  // Position full step, and velocity half step | 
| 276 | 
+ | 
 | 
| 277 | 
+ | 
#ifdef PROFILE | 
| 278 | 
+ | 
  startProfile(pro3); | 
| 279 | 
+ | 
#endif //profile | 
| 280 | 
+ | 
 | 
| 281 | 
  | 
  preMove(); | 
| 282 | 
+ | 
 | 
| 283 | 
+ | 
#ifdef PROFILE | 
| 284 | 
+ | 
  endProfile(pro3); | 
| 285 | 
+ | 
 | 
| 286 | 
+ | 
  startProfile(pro4); | 
| 287 | 
+ | 
#endif // profile | 
| 288 | 
  | 
 | 
| 289 | 
  | 
  moveA(); | 
| 290 | 
  | 
 | 
| 291 | 
< | 
  if (nConstrained){ | 
| 292 | 
< | 
    constrainA(); | 
| 293 | 
< | 
  } | 
| 291 | 
> | 
#ifdef PROFILE | 
| 292 | 
> | 
  endProfile(pro4); | 
| 293 | 
> | 
   | 
| 294 | 
> | 
  startProfile(pro5); | 
| 295 | 
> | 
#endif//profile | 
| 296 | 
  | 
 | 
| 297 | 
  | 
 | 
| 298 | 
  | 
#ifdef IS_MPI | 
| 310 | 
  | 
  MPIcheckPoint(); | 
| 311 | 
  | 
#endif // is_mpi | 
| 312 | 
  | 
 | 
| 313 | 
+ | 
#ifdef PROFILE | 
| 314 | 
+ | 
  endProfile( pro5 ); | 
| 315 | 
  | 
 | 
| 316 | 
+ | 
  startProfile( pro6 ); | 
| 317 | 
+ | 
#endif //profile | 
| 318 | 
+ | 
 | 
| 319 | 
  | 
  // finish the velocity  half step | 
| 320 | 
  | 
 | 
| 321 | 
  | 
  moveB(); | 
| 322 | 
  | 
 | 
| 323 | 
< | 
  if (nConstrained){ | 
| 324 | 
< | 
    constrainB(); | 
| 325 | 
< | 
  } | 
| 323 | 
> | 
#ifdef PROFILE | 
| 324 | 
> | 
  endProfile(pro6); | 
| 325 | 
> | 
#endif // profile | 
| 326 | 
  | 
 | 
| 327 | 
  | 
#ifdef IS_MPI | 
| 328 | 
  | 
  strcpy(checkPointMsg, "Succesful moveB\n"); | 
| 332 | 
  | 
 | 
| 333 | 
  | 
 | 
| 334 | 
  | 
template<typename T> void Integrator<T>::moveA(void){ | 
| 335 | 
< | 
  int i, j; | 
| 335 | 
> | 
  size_t i, j; | 
| 336 | 
  | 
  DirectionalAtom* dAtom; | 
| 337 | 
  | 
  double Tb[3], ji[3]; | 
| 297 | 
– | 
  double A[3][3], I[3][3]; | 
| 298 | 
– | 
  double angle; | 
| 338 | 
  | 
  double vel[3], pos[3], frc[3]; | 
| 339 | 
  | 
  double mass; | 
| 340 | 
+ | 
  | 
| 341 | 
+ | 
  for (i = 0; i < integrableObjects.size() ; i++){ | 
| 342 | 
+ | 
    integrableObjects[i]->getVel(vel); | 
| 343 | 
+ | 
    integrableObjects[i]->getPos(pos); | 
| 344 | 
+ | 
    integrableObjects[i]->getFrc(frc); | 
| 345 | 
+ | 
     | 
| 346 | 
+ | 
    mass = integrableObjects[i]->getMass(); | 
| 347 | 
  | 
 | 
| 302 | 
– | 
  for (i = 0; i < nAtoms; i++){ | 
| 303 | 
– | 
    atoms[i]->getVel(vel); | 
| 304 | 
– | 
    atoms[i]->getPos(pos); | 
| 305 | 
– | 
    atoms[i]->getFrc(frc); | 
| 306 | 
– | 
 | 
| 307 | 
– | 
    mass = atoms[i]->getMass(); | 
| 308 | 
– | 
 | 
| 348 | 
  | 
    for (j = 0; j < 3; j++){ | 
| 349 | 
  | 
      // velocity half step | 
| 350 | 
  | 
      vel[j] += (dt2 * frc[j] / mass) * eConvert; | 
| 352 | 
  | 
      pos[j] += dt * vel[j]; | 
| 353 | 
  | 
    } | 
| 354 | 
  | 
 | 
| 355 | 
< | 
    atoms[i]->setVel(vel); | 
| 356 | 
< | 
    atoms[i]->setPos(pos); | 
| 355 | 
> | 
    integrableObjects[i]->setVel(vel); | 
| 356 | 
> | 
    integrableObjects[i]->setPos(pos); | 
| 357 | 
  | 
 | 
| 358 | 
< | 
    if (atoms[i]->isDirectional()){ | 
| 320 | 
< | 
      dAtom = (DirectionalAtom *) atoms[i]; | 
| 358 | 
> | 
    if (integrableObjects[i]->isDirectional()){ | 
| 359 | 
  | 
 | 
| 360 | 
  | 
      // get and convert the torque to body frame | 
| 361 | 
  | 
 | 
| 362 | 
< | 
      dAtom->getTrq(Tb); | 
| 363 | 
< | 
      dAtom->lab2Body(Tb); | 
| 362 | 
> | 
      integrableObjects[i]->getTrq(Tb); | 
| 363 | 
> | 
      integrableObjects[i]->lab2Body(Tb); | 
| 364 | 
  | 
 | 
| 365 | 
  | 
      // get the angular momentum, and propagate a half step | 
| 366 | 
  | 
 | 
| 367 | 
< | 
      dAtom->getJ(ji); | 
| 367 | 
> | 
      integrableObjects[i]->getJ(ji); | 
| 368 | 
  | 
 | 
| 369 | 
  | 
      for (j = 0; j < 3; j++) | 
| 370 | 
  | 
        ji[j] += (dt2 * Tb[j]) * eConvert; | 
| 371 | 
  | 
 | 
| 372 | 
< | 
      // use the angular velocities to propagate the rotation matrix a | 
| 335 | 
< | 
      // full time step | 
| 372 | 
> | 
      this->rotationPropagation( integrableObjects[i], ji ); | 
| 373 | 
  | 
 | 
| 374 | 
< | 
      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 | 
< | 
      dAtom->setJ(ji); | 
| 361 | 
< | 
      dAtom->setA(A); | 
| 374 | 
> | 
      integrableObjects[i]->setJ(ji); | 
| 375 | 
  | 
    } | 
| 376 | 
  | 
  } | 
| 377 | 
+ | 
 | 
| 378 | 
+ | 
  if (nConstrained){ | 
| 379 | 
+ | 
    constrainA(); | 
| 380 | 
+ | 
  } | 
| 381 | 
  | 
} | 
| 382 | 
  | 
 | 
| 383 | 
  | 
 | 
| 384 | 
  | 
template<typename T> void Integrator<T>::moveB(void){ | 
| 385 | 
  | 
  int i, j; | 
| 369 | 
– | 
  DirectionalAtom* dAtom; | 
| 386 | 
  | 
  double Tb[3], ji[3]; | 
| 387 | 
  | 
  double vel[3], frc[3]; | 
| 388 | 
  | 
  double mass; | 
| 389 | 
  | 
 | 
| 390 | 
< | 
  for (i = 0; i < nAtoms; i++){ | 
| 391 | 
< | 
    atoms[i]->getVel(vel); | 
| 392 | 
< | 
    atoms[i]->getFrc(frc); | 
| 390 | 
> | 
  for (i = 0; i < integrableObjects.size(); i++){ | 
| 391 | 
> | 
    integrableObjects[i]->getVel(vel); | 
| 392 | 
> | 
    integrableObjects[i]->getFrc(frc); | 
| 393 | 
  | 
 | 
| 394 | 
< | 
    mass = atoms[i]->getMass(); | 
| 394 | 
> | 
    mass = integrableObjects[i]->getMass(); | 
| 395 | 
  | 
 | 
| 396 | 
  | 
    // velocity half step | 
| 397 | 
  | 
    for (j = 0; j < 3; j++) | 
| 398 | 
  | 
      vel[j] += (dt2 * frc[j] / mass) * eConvert; | 
| 399 | 
  | 
 | 
| 400 | 
< | 
    atoms[i]->setVel(vel); | 
| 385 | 
< | 
 | 
| 386 | 
< | 
    if (atoms[i]->isDirectional()){ | 
| 387 | 
< | 
      dAtom = (DirectionalAtom *) atoms[i]; | 
| 400 | 
> | 
    integrableObjects[i]->setVel(vel); | 
| 401 | 
  | 
 | 
| 402 | 
< | 
      // get and convert the torque to body frame       | 
| 402 | 
> | 
    if (integrableObjects[i]->isDirectional()){ | 
| 403 | 
  | 
 | 
| 404 | 
< | 
      dAtom->getTrq(Tb); | 
| 392 | 
< | 
      dAtom->lab2Body(Tb); | 
| 404 | 
> | 
      // get and convert the torque to body frame | 
| 405 | 
  | 
 | 
| 406 | 
+ | 
      integrableObjects[i]->getTrq(Tb); | 
| 407 | 
+ | 
      integrableObjects[i]->lab2Body(Tb); | 
| 408 | 
+ | 
 | 
| 409 | 
  | 
      // get the angular momentum, and propagate a half step | 
| 410 | 
  | 
 | 
| 411 | 
< | 
      dAtom->getJ(ji); | 
| 411 | 
> | 
      integrableObjects[i]->getJ(ji); | 
| 412 | 
  | 
 | 
| 413 | 
  | 
      for (j = 0; j < 3; j++) | 
| 414 | 
  | 
        ji[j] += (dt2 * Tb[j]) * eConvert; | 
| 415 | 
  | 
 | 
| 416 | 
  | 
 | 
| 417 | 
< | 
      dAtom->setJ(ji); | 
| 417 | 
> | 
      integrableObjects[i]->setJ(ji); | 
| 418 | 
  | 
    } | 
| 419 | 
+ | 
  } | 
| 420 | 
+ | 
 | 
| 421 | 
+ | 
  if (nConstrained){ | 
| 422 | 
+ | 
    constrainB(); | 
| 423 | 
  | 
  } | 
| 424 | 
  | 
} | 
| 425 | 
  | 
 | 
| 439 | 
  | 
} | 
| 440 | 
  | 
 | 
| 441 | 
  | 
template<typename T> void Integrator<T>::constrainA(){ | 
| 442 | 
< | 
  int i, j, k; | 
| 442 | 
> | 
  int i, j; | 
| 443 | 
  | 
  int done; | 
| 444 | 
  | 
  double posA[3], posB[3]; | 
| 445 | 
  | 
  double velA[3], velB[3]; | 
| 579 | 
  | 
    painCave.isFatal = 1; | 
| 580 | 
  | 
    simError(); | 
| 581 | 
  | 
  } | 
| 582 | 
+ | 
 | 
| 583 | 
  | 
} | 
| 584 | 
  | 
 | 
| 585 | 
  | 
template<typename T> void Integrator<T>::constrainB(void){ | 
| 586 | 
< | 
  int i, j, k; | 
| 586 | 
> | 
  int i, j; | 
| 587 | 
  | 
  int done; | 
| 588 | 
  | 
  double posA[3], posB[3]; | 
| 589 | 
  | 
  double velA[3], velB[3]; | 
| 592 | 
  | 
  int a, b, ax, ay, az, bx, by, bz; | 
| 593 | 
  | 
  double rma, rmb; | 
| 594 | 
  | 
  double dx, dy, dz; | 
| 595 | 
< | 
  double rabsq, pabsq, rvab; | 
| 576 | 
< | 
  double diffsq; | 
| 595 | 
> | 
  double rvab; | 
| 596 | 
  | 
  double gab; | 
| 597 | 
  | 
  int iteration; | 
| 598 | 
  | 
 | 
| 679 | 
  | 
            iteration); | 
| 680 | 
  | 
    painCave.isFatal = 1; | 
| 681 | 
  | 
    simError(); | 
| 682 | 
+ | 
  } | 
| 683 | 
+ | 
} | 
| 684 | 
+ | 
 | 
| 685 | 
+ | 
template<typename T> void Integrator<T>::rotationPropagation | 
| 686 | 
+ | 
( StuntDouble* sd, double ji[3] ){ | 
| 687 | 
+ | 
 | 
| 688 | 
+ | 
  double angle; | 
| 689 | 
+ | 
  double A[3][3], I[3][3]; | 
| 690 | 
+ | 
  int i, j, k; | 
| 691 | 
+ | 
 | 
| 692 | 
+ | 
  // use the angular velocities to propagate the rotation matrix a | 
| 693 | 
+ | 
  // full time step | 
| 694 | 
+ | 
 | 
| 695 | 
+ | 
  sd->getA(A); | 
| 696 | 
+ | 
  sd->getI(I); | 
| 697 | 
+ | 
 | 
| 698 | 
+ | 
  if (sd->isLinear()) { | 
| 699 | 
+ | 
    i = sd->linearAxis(); | 
| 700 | 
+ | 
    j = (i+1)%3; | 
| 701 | 
+ | 
    k = (i+2)%3; | 
| 702 | 
+ | 
     | 
| 703 | 
+ | 
    angle = dt2 * ji[j] / I[j][j]; | 
| 704 | 
+ | 
    this->rotate( k, i, angle, ji, A ); | 
| 705 | 
+ | 
 | 
| 706 | 
+ | 
    angle = dt * ji[k] / I[k][k]; | 
| 707 | 
+ | 
    this->rotate( i, j, angle, ji, A); | 
| 708 | 
+ | 
 | 
| 709 | 
+ | 
    angle = dt2 * ji[j] / I[j][j]; | 
| 710 | 
+ | 
    this->rotate( k, i, angle, ji, A ); | 
| 711 | 
+ | 
 | 
| 712 | 
+ | 
  } else { | 
| 713 | 
+ | 
  // rotate about the x-axis | 
| 714 | 
+ | 
  angle = dt2 * ji[0] / I[0][0]; | 
| 715 | 
+ | 
  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); | 
| 724 | 
+ | 
 | 
| 725 | 
+ | 
  // rotate about the y-axis | 
| 726 | 
+ | 
  angle = dt2 * ji[1] / I[1][1]; | 
| 727 | 
+ | 
  this->rotate( 2, 0, angle, ji, A ); | 
| 728 | 
+ | 
 | 
| 729 | 
+ | 
  // rotate about the x-axis | 
| 730 | 
+ | 
  angle = dt2 * ji[0] / I[0][0]; | 
| 731 | 
+ | 
  this->rotate( 1, 2, angle, ji, A ); | 
| 732 | 
+ | 
 | 
| 733 | 
  | 
  } | 
| 734 | 
+ | 
  sd->setA( A  ); | 
| 735 | 
  | 
} | 
| 736 | 
  | 
 | 
| 737 | 
  | 
template<typename T> void Integrator<T>::rotate(int axes1, int axes2, | 
| 799 | 
  | 
    } | 
| 800 | 
  | 
  } | 
| 801 | 
  | 
 | 
| 802 | 
< | 
  // rotate the Rotation matrix acording to:  | 
| 802 | 
> | 
  // rotate the Rotation matrix acording to: | 
| 803 | 
  | 
  //            A[][] = A[][] * transpose(rot[][]) | 
| 804 | 
  | 
 | 
| 805 | 
  | 
 | 
| 827 | 
  | 
 | 
| 828 | 
  | 
template<typename T> double Integrator<T>::getConservedQuantity(void){ | 
| 829 | 
  | 
  return tStats->getTotalE(); | 
| 830 | 
< | 
} | 
| 830 | 
> | 
} | 
| 831 | 
> | 
template<typename T> string Integrator<T>::getAdditionalParameters(void){ | 
| 832 | 
> | 
  //By default, return a null string | 
| 833 | 
> | 
  //The reason we use string instead of char* is that if we use char*, we will | 
| 834 | 
> | 
  //return a pointer point to local variable which might cause problem | 
| 835 | 
> | 
  return string(); | 
| 836 | 
> | 
} |