| 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); | 
| 179 | 
  | 
  if (nConstrained){ | 
| 180 | 
  | 
    preMove(); | 
| 181 | 
  | 
    constrainA(); | 
| 182 | 
< | 
    calcForce(1, 1);     | 
| 182 | 
> | 
    calcForce(1, 1); | 
| 183 | 
  | 
    constrainB(); | 
| 184 | 
  | 
  } | 
| 185 | 
  | 
   | 
| 198 | 
  | 
  statOut->writeStat(info->getTime()); | 
| 199 | 
  | 
 | 
| 200 | 
  | 
 | 
| 201 | 
– | 
 | 
| 201 | 
  | 
#ifdef IS_MPI | 
| 202 | 
  | 
  strcpy(checkPointMsg, "The integrator is ready to go."); | 
| 203 | 
  | 
  MPIcheckPoint(); | 
| 226 | 
  | 
    } | 
| 227 | 
  | 
 | 
| 228 | 
  | 
    if (info->getTime() >= currStatus){ | 
| 229 | 
< | 
      statOut->writeStat(info->getTime());  | 
| 230 | 
< | 
      calcPot = 0;  | 
| 229 | 
> | 
      statOut->writeStat(info->getTime()); | 
| 230 | 
> | 
      calcPot = 0; | 
| 231 | 
  | 
      calcStress = 0; | 
| 232 | 
  | 
      currStatus += statusTime; | 
| 233 | 
< | 
    }  | 
| 233 | 
> | 
    } | 
| 234 | 
  | 
 | 
| 235 | 
  | 
    if (info->resetIntegrator){ | 
| 236 | 
  | 
      if (info->getTime() >= currReset){ | 
| 245 | 
  | 
#endif // is_mpi | 
| 246 | 
  | 
  } | 
| 247 | 
  | 
 | 
| 249 | 
– | 
  dumpOut->writeFinal(info->getTime()); | 
| 248 | 
  | 
 | 
| 249 | 
+ | 
  // write the last frame | 
| 250 | 
+ | 
  dumpOut->writeDump(info->getTime()); | 
| 251 | 
+ | 
 | 
| 252 | 
  | 
  delete dumpOut; | 
| 253 | 
  | 
  delete statOut; | 
| 254 | 
  | 
} | 
| 365 | 
  | 
    if (atoms[i]->isDirectional()){ | 
| 366 | 
  | 
      dAtom = (DirectionalAtom *) atoms[i]; | 
| 367 | 
  | 
 | 
| 368 | 
< | 
      // get and convert the torque to body frame       | 
| 368 | 
> | 
      // get and convert the torque to body frame | 
| 369 | 
  | 
 | 
| 370 | 
  | 
      dAtom->getTrq(Tb); | 
| 371 | 
  | 
      dAtom->lab2Body(Tb); | 
| 657 | 
  | 
 | 
| 658 | 
  | 
  dAtom->getA(A); | 
| 659 | 
  | 
  dAtom->getI(I); | 
| 660 | 
< | 
   | 
| 661 | 
< | 
  // rotate about the x-axis       | 
| 660 | 
> | 
 | 
| 661 | 
> | 
  // rotate about the x-axis | 
| 662 | 
  | 
  angle = dt2 * ji[0] / I[0][0]; | 
| 663 | 
< | 
  this->rotate( 1, 2, angle, ji, A );  | 
| 664 | 
< | 
   | 
| 663 | 
> | 
  this->rotate( 1, 2, angle, ji, A ); | 
| 664 | 
> | 
 | 
| 665 | 
  | 
  // rotate about the y-axis | 
| 666 | 
  | 
  angle = dt2 * ji[1] / I[1][1]; | 
| 667 | 
  | 
  this->rotate( 2, 0, angle, ji, A ); | 
| 668 | 
< | 
   | 
| 668 | 
> | 
 | 
| 669 | 
  | 
  // rotate about the z-axis | 
| 670 | 
  | 
  angle = dt * ji[2] / I[2][2]; | 
| 671 | 
  | 
  this->rotate( 0, 1, angle, ji, A); | 
| 672 | 
< | 
   | 
| 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 x-axis | 
| 678 | 
  | 
  angle = dt2 * ji[0] / I[0][0]; | 
| 679 | 
  | 
  this->rotate( 1, 2, angle, ji, A ); | 
| 680 | 
< | 
   | 
| 681 | 
< | 
  dAtom->setA( A  );     | 
| 680 | 
> | 
 | 
| 681 | 
> | 
  dAtom->setA( A  ); | 
| 682 | 
  | 
} | 
| 683 | 
  | 
 | 
| 684 | 
  | 
template<typename T> void Integrator<T>::rotate(int axes1, int axes2, | 
| 746 | 
  | 
    } | 
| 747 | 
  | 
  } | 
| 748 | 
  | 
 | 
| 749 | 
< | 
  // rotate the Rotation matrix acording to:  | 
| 749 | 
> | 
  // rotate the Rotation matrix acording to: | 
| 750 | 
  | 
  //            A[][] = A[][] * transpose(rot[][]) | 
| 751 | 
  | 
 | 
| 752 | 
  | 
 | 
| 775 | 
  | 
template<typename T> double Integrator<T>::getConservedQuantity(void){ | 
| 776 | 
  | 
  return tStats->getTotalE(); | 
| 777 | 
  | 
} | 
| 778 | 
+ | 
template<typename T> string Integrator<T>::getAdditionalParameters(void){ | 
| 779 | 
+ | 
  //By default, return a null string | 
| 780 | 
+ | 
  //The reason we use string instead of char* is that if we use char*, we will | 
| 781 | 
+ | 
  //return a pointer point to local variable which might cause problem | 
| 782 | 
+ | 
  return string(); | 
| 783 | 
+ | 
} |