--- trunk/OOPSE/libmdtools/Integrator.cpp 2003/07/17 21:50:01 637 +++ trunk/OOPSE/libmdtools/Integrator.cpp 2003/10/16 19:16:24 804 @@ -11,8 +11,8 @@ Integrator::Integrator( SimInfo *theInfo, ForceFields* #include "simError.h" -Integrator::Integrator( SimInfo *theInfo, ForceFields* the_ff ){ - +template Integrator::Integrator(SimInfo* theInfo, + ForceFields* the_ff){ info = theInfo; myFF = the_ff; isFirst = 1; @@ -21,29 +21,29 @@ Integrator::Integrator( SimInfo *theInfo, ForceFields* nMols = info->n_mol; // give a little love back to the SimInfo object - - if( info->the_integrator != NULL ) delete info->the_integrator; - info->the_integrator = this; + if (info->the_integrator != NULL){ + delete info->the_integrator; + } + nAtoms = info->n_atoms; // check for constraints - - constrainedA = NULL; - constrainedB = NULL; + + constrainedA = NULL; + constrainedB = NULL; constrainedDsqr = NULL; - moving = NULL; - moved = NULL; - oldPos = NULL; - + moving = NULL; + moved = NULL; + oldPos = NULL; + nConstrained = 0; checkConstraints(); } -Integrator::~Integrator() { - - if( nConstrained ){ +template Integrator::~Integrator(){ + if (nConstrained){ delete[] constrainedA; delete[] constrainedB; delete[] constrainedDsqr; @@ -51,393 +51,360 @@ Integrator::~Integrator() { delete[] moved; delete[] oldPos; } - } -void Integrator::checkConstraints( void ){ - - +template void Integrator::checkConstraints(void){ isConstrained = 0; - Constraint *temp_con; - Constraint *dummy_plug; + Constraint* temp_con; + Constraint* dummy_plug; temp_con = new Constraint[info->n_SRI]; nConstrained = 0; int constrained = 0; - + SRI** theArray; - for(int i = 0; i < nMols; i++){ - - theArray = (SRI**) molecules[i].getMyBonds(); - for(int j=0; jis_constrained(); - if(constrained){ + if (constrained){ + dummy_plug = theArray[j]->get_constraint(); + temp_con[nConstrained].set_a(dummy_plug->get_a()); + temp_con[nConstrained].set_b(dummy_plug->get_b()); + temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); - dummy_plug = theArray[j]->get_constraint(); - temp_con[nConstrained].set_a( dummy_plug->get_a() ); - temp_con[nConstrained].set_b( dummy_plug->get_b() ); - temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); - - nConstrained++; - constrained = 0; - } + nConstrained++; + constrained = 0; + } } - theArray = (SRI**) molecules[i].getMyBends(); - for(int j=0; jis_constrained(); - - if(constrained){ - - dummy_plug = theArray[j]->get_constraint(); - temp_con[nConstrained].set_a( dummy_plug->get_a() ); - temp_con[nConstrained].set_b( dummy_plug->get_b() ); - temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); - - nConstrained++; - constrained = 0; + + if (constrained){ + dummy_plug = theArray[j]->get_constraint(); + temp_con[nConstrained].set_a(dummy_plug->get_a()); + temp_con[nConstrained].set_b(dummy_plug->get_b()); + temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); + + nConstrained++; + constrained = 0; } } - theArray = (SRI**) molecules[i].getMyTorsions(); - for(int j=0; jis_constrained(); - - if(constrained){ - - dummy_plug = theArray[j]->get_constraint(); - temp_con[nConstrained].set_a( dummy_plug->get_a() ); - temp_con[nConstrained].set_b( dummy_plug->get_b() ); - temp_con[nConstrained].set_dsqr( dummy_plug->get_dsqr() ); - - nConstrained++; - constrained = 0; + + if (constrained){ + dummy_plug = theArray[j]->get_constraint(); + temp_con[nConstrained].set_a(dummy_plug->get_a()); + temp_con[nConstrained].set_b(dummy_plug->get_b()); + temp_con[nConstrained].set_dsqr(dummy_plug->get_dsqr()); + + nConstrained++; + constrained = 0; } } } - if(nConstrained > 0){ - + if (nConstrained > 0){ isConstrained = 1; - if(constrainedA != NULL ) delete[] constrainedA; - if(constrainedB != NULL ) delete[] constrainedB; - if(constrainedDsqr != NULL ) delete[] constrainedDsqr; + if (constrainedA != NULL) + delete[] constrainedA; + if (constrainedB != NULL) + delete[] constrainedB; + if (constrainedDsqr != NULL) + delete[] constrainedDsqr; - constrainedA = new int[nConstrained]; - constrainedB = new int[nConstrained]; + constrainedA = new int[nConstrained]; + constrainedB = new int[nConstrained]; constrainedDsqr = new double[nConstrained]; - - for( int i = 0; i < nConstrained; i++){ - + + for (int i = 0; i < nConstrained; i++){ constrainedA[i] = temp_con[i].get_a(); constrainedB[i] = temp_con[i].get_b(); constrainedDsqr[i] = temp_con[i].get_dsqr(); - } - + // save oldAtoms to check for lode balanceing later on. - + oldAtoms = nAtoms; - + moving = new int[nAtoms]; - moved = new int[nAtoms]; + moved = new int[nAtoms]; - oldPos = new double[nAtoms*3]; + oldPos = new double[nAtoms * 3]; } - + delete[] temp_con; } -void Integrator::integrate( void ){ +template void Integrator::integrate(void){ - int i, j; // loop counters - - double runTime = info->run_time; - double sampleTime = info->sampleTime; - double statusTime = info->statusTime; + double runTime = info->run_time; + double sampleTime = info->sampleTime; + double statusTime = info->statusTime; double thermalTime = info->thermalTime; + double resetTime = info->resetTime; + double currSample; double currThermal; double currStatus; - double currTime; - + double currReset; + int calcPot, calcStress; - int isError; - tStats = new Thermo( info ); - statOut = new StatWriter( info ); - dumpOut = new DumpWriter( info ); + tStats = new Thermo(info); + statOut = new StatWriter(info); + dumpOut = new DumpWriter(info); atoms = info->atoms; - DirectionalAtom* dAtom; dt = info->dt; dt2 = 0.5 * dt; + readyCheck(); + // initialize the forces before the first step - myFF->doForces(1,1); - - if( info->setTemp ){ - - tStats->velocitize(); + calcForce(1, 1); + + if (nConstrained){ + preMove(); + constrainA(); + calcForce(1, 1); + constrainB(); } - dumpOut->writeDump( 0.0 ); - statOut->writeStat( 0.0 ); - + if (info->setTemp){ + thermalize(); + } + calcPot = 0; calcStress = 0; - currSample = sampleTime; - currThermal = thermalTime; - currStatus = statusTime; - currTime = 0.0;; + currSample = sampleTime + info->getTime(); + currThermal = thermalTime+ info->getTime(); + currStatus = statusTime + info->getTime(); + currReset = resetTime + info->getTime(); + dumpOut->writeDump(info->getTime()); + statOut->writeStat(info->getTime()); - readyCheck(); + #ifdef IS_MPI - strcpy( checkPointMsg, - "The integrator is ready to go." ); + strcpy(checkPointMsg, "The integrator is ready to go."); MPIcheckPoint(); #endif // is_mpi - while( currTime < runTime ){ - - if( (currTime+dt) >= currStatus ){ + while (info->getTime() < runTime){ + if ((info->getTime() + dt) >= currStatus){ calcPot = 1; calcStress = 1; } - integrateStep( calcPot, calcStress ); - - currTime += dt; - info->setTime(currTime); + integrateStep(calcPot, calcStress); - if( info->setTemp ){ - if( currTime >= currThermal ){ - tStats->velocitize(); - currThermal += thermalTime; + info->incrTime(dt); + + if (info->setTemp){ + if (info->getTime() >= currThermal){ + thermalize(); + currThermal += thermalTime; } } - if( currTime >= currSample ){ - dumpOut->writeDump( currTime ); + if (info->getTime() >= currSample){ + dumpOut->writeDump(info->getTime()); currSample += sampleTime; } - if( currTime >= currStatus ){ - statOut->writeStat( currTime ); + if (info->getTime() >= currStatus){ + statOut->writeStat(info->getTime()); calcPot = 0; calcStress = 0; currStatus += statusTime; } + if (info->resetIntegrator){ + if (info->getTime() >= currReset){ + this->resetIntegrator(); + currReset += resetTime; + } + } + #ifdef IS_MPI - strcpy( checkPointMsg, - "successfully took a time step." ); + strcpy(checkPointMsg, "successfully took a time step."); MPIcheckPoint(); #endif // is_mpi - } - dumpOut->writeFinal(currTime); + // write the last frame + dumpOut->writeDump(info->getTime()); + delete dumpOut; delete statOut; } -void Integrator::integrateStep( int calcPot, int calcStress ){ - - - +template void Integrator::integrateStep(int calcPot, + int calcStress){ // Position full step, and velocity half step - preMove(); + moveA(); - if( nConstrained ) constrainA(); - + + + #ifdef IS_MPI - strcpy( checkPointMsg, "Succesful moveA\n" ); + strcpy(checkPointMsg, "Succesful moveA\n"); MPIcheckPoint(); #endif // is_mpi - + // calc forces - myFF->doForces(calcPot,calcStress); + calcForce(calcPot, calcStress); #ifdef IS_MPI - strcpy( checkPointMsg, "Succesful doForces\n" ); + strcpy(checkPointMsg, "Succesful doForces\n"); MPIcheckPoint(); #endif // is_mpi - + // finish the velocity half step - + moveB(); - if( nConstrained ) constrainB(); - + + + #ifdef IS_MPI - strcpy( checkPointMsg, "Succesful moveB\n" ); + strcpy(checkPointMsg, "Succesful moveB\n"); MPIcheckPoint(); #endif // is_mpi - - } -void Integrator::moveA( void ){ - +template void Integrator::moveA(void){ int i, j; DirectionalAtom* dAtom; double Tb[3], ji[3]; - double A[3][3], I[3][3]; - double angle; double vel[3], pos[3], frc[3]; double mass; - for( i=0; igetVel(vel); + atoms[i]->getPos(pos); + atoms[i]->getFrc(frc); - atoms[i]->getVel( vel ); - atoms[i]->getPos( pos ); - atoms[i]->getFrc( frc ); - mass = atoms[i]->getMass(); - for (j=0; j < 3; j++) { + for (j = 0; j < 3; j++){ // velocity half step - vel[j] += ( dt2 * frc[j] / mass ) * eConvert; + vel[j] += (dt2 * frc[j] / mass) * eConvert; // position whole step pos[j] += dt * vel[j]; } - atoms[i]->setVel( vel ); - atoms[i]->setPos( pos ); + atoms[i]->setVel(vel); + atoms[i]->setPos(pos); - if( atoms[i]->isDirectional() ){ + if (atoms[i]->isDirectional()){ + dAtom = (DirectionalAtom *) atoms[i]; - dAtom = (DirectionalAtom *)atoms[i]; - // get and convert the torque to body frame - - dAtom->getTrq( Tb ); - dAtom->lab2Body( Tb ); + dAtom->getTrq(Tb); + dAtom->lab2Body(Tb); + // get the angular momentum, and propagate a half step - dAtom->getJ( ji ); + dAtom->getJ(ji); - for (j=0; j < 3; j++) + for (j = 0; j < 3; j++) ji[j] += (dt2 * Tb[j]) * eConvert; - - // use the angular velocities to propagate the rotation matrix a - // full time step - dAtom->getA(A); - dAtom->getI(I); - - // rotate about the x-axis - angle = dt2 * ji[0] / I[0][0]; - this->rotate( 1, 2, angle, ji, A ); + this->rotationPropagation( dAtom, ji ); - // rotate about the y-axis - angle = dt2 * ji[1] / I[1][1]; - this->rotate( 2, 0, angle, ji, A ); - - // rotate about the z-axis - angle = dt * ji[2] / I[2][2]; - this->rotate( 0, 1, angle, ji, A); - - // rotate about the y-axis - angle = dt2 * ji[1] / I[1][1]; - this->rotate( 2, 0, angle, ji, A ); - - // rotate about the x-axis - angle = dt2 * ji[0] / I[0][0]; - this->rotate( 1, 2, angle, ji, A ); - + dAtom->setJ(ji); + } + } - dAtom->setJ( ji ); - dAtom->setA( A ); - - } + if (nConstrained){ + constrainA(); } } -void Integrator::moveB( void ){ +template void Integrator::moveB(void){ int i, j; DirectionalAtom* dAtom; double Tb[3], ji[3]; double vel[3], frc[3]; double mass; - for( i=0; igetVel( vel ); - atoms[i]->getFrc( frc ); + for (i = 0; i < nAtoms; i++){ + atoms[i]->getVel(vel); + atoms[i]->getFrc(frc); mass = atoms[i]->getMass(); // velocity half step - for (j=0; j < 3; j++) - vel[j] += ( dt2 * frc[j] / mass ) * eConvert; - - atoms[i]->setVel( vel ); - - if( atoms[i]->isDirectional() ){ + for (j = 0; j < 3; j++) + vel[j] += (dt2 * frc[j] / mass) * eConvert; - dAtom = (DirectionalAtom *)atoms[i]; + atoms[i]->setVel(vel); + if (atoms[i]->isDirectional()){ + dAtom = (DirectionalAtom *) atoms[i]; + // get and convert the torque to body frame - dAtom->getTrq( Tb ); - dAtom->lab2Body( Tb ); + dAtom->getTrq(Tb); + dAtom->lab2Body(Tb); // get the angular momentum, and propagate a half step - dAtom->getJ( ji ); + dAtom->getJ(ji); - for (j=0; j < 3; j++) + for (j = 0; j < 3; j++) ji[j] += (dt2 * Tb[j]) * eConvert; - - dAtom->setJ( ji ); + + dAtom->setJ(ji); } } + + if (nConstrained){ + constrainB(); + } } -void Integrator::preMove( void ){ +template void Integrator::preMove(void){ int i, j; double pos[3]; - if( nConstrained ){ + if (nConstrained){ + for (i = 0; i < nAtoms; i++){ + atoms[i]->getPos(pos); - for(i=0; i < nAtoms; i++) { - - atoms[i]->getPos( pos ); - - for (j = 0; j < 3; j++) { - oldPos[3*i + j] = pos[j]; + for (j = 0; j < 3; j++){ + oldPos[3 * i + j] = pos[j]; } - } - } + } } -void Integrator::constrainA(){ - - int i,j,k; +template void Integrator::constrainA(){ + int i, j; int done; double posA[3], posB[3]; double velA[3], velB[3]; @@ -452,122 +419,117 @@ void Integrator::constrainA(){ double gab; int iteration; - for( i=0; igetPos( posA ); - atoms[b]->getPos( posB ); - - for (j = 0; j < 3; j++ ) + bx = (b * 3) + 0; + by = (b * 3) + 1; + bz = (b * 3) + 2; + + if (moved[a] || moved[b]){ + atoms[a]->getPos(posA); + atoms[b]->getPos(posB); + + for (j = 0; j < 3; j++) pab[j] = posA[j] - posB[j]; - - //periodic boundary condition - info->wrapVector( pab ); + //periodic boundary condition - pabsq = pab[0] * pab[0] + pab[1] * pab[1] + pab[2] * pab[2]; + info->wrapVector(pab); - rabsq = constrainedDsqr[i]; - diffsq = rabsq - pabsq; + pabsq = pab[0] * pab[0] + pab[1] * pab[1] + pab[2] * pab[2]; - // the original rattle code from alan tidesley - if (fabs(diffsq) > (tol*rabsq*2)) { - rab[0] = oldPos[ax] - oldPos[bx]; - rab[1] = oldPos[ay] - oldPos[by]; - rab[2] = oldPos[az] - oldPos[bz]; + rabsq = constrainedDsqr[i]; + diffsq = rabsq - pabsq; - info->wrapVector( rab ); + // the original rattle code from alan tidesley + if (fabs(diffsq) > (tol * rabsq * 2)){ + rab[0] = oldPos[ax] - oldPos[bx]; + rab[1] = oldPos[ay] - oldPos[by]; + rab[2] = oldPos[az] - oldPos[bz]; - rpab = rab[0] * pab[0] + rab[1] * pab[1] + rab[2] * pab[2]; + info->wrapVector(rab); - rpabsq = rpab * rpab; + rpab = rab[0] * pab[0] + rab[1] * pab[1] + rab[2] * pab[2]; + rpabsq = rpab * rpab; - if (rpabsq < (rabsq * -diffsq)){ + if (rpabsq < (rabsq * -diffsq)){ #ifdef IS_MPI - a = atoms[a]->getGlobalIndex(); - b = atoms[b]->getGlobalIndex(); + a = atoms[a]->getGlobalIndex(); + b = atoms[b]->getGlobalIndex(); #endif //is_mpi - sprintf( painCave.errMsg, - "Constraint failure in constrainA at atom %d and %d.\n", - a, b ); - painCave.isFatal = 1; - simError(); - } + sprintf(painCave.errMsg, + "Constraint failure in constrainA at atom %d and %d.\n", a, + b); + painCave.isFatal = 1; + simError(); + } - rma = 1.0 / atoms[a]->getMass(); - rmb = 1.0 / atoms[b]->getMass(); + rma = 1.0 / atoms[a]->getMass(); + rmb = 1.0 / atoms[b]->getMass(); - gab = diffsq / ( 2.0 * ( rma + rmb ) * rpab ); + gab = diffsq / (2.0 * (rma + rmb) * rpab); dx = rab[0] * gab; dy = rab[1] * gab; dz = rab[2] * gab; - posA[0] += rma * dx; - posA[1] += rma * dy; - posA[2] += rma * dz; + posA[0] += rma * dx; + posA[1] += rma * dy; + posA[2] += rma * dz; - atoms[a]->setPos( posA ); + atoms[a]->setPos(posA); - posB[0] -= rmb * dx; - posB[1] -= rmb * dy; - posB[2] -= rmb * dz; + posB[0] -= rmb * dx; + posB[1] -= rmb * dy; + posB[2] -= rmb * dz; - atoms[b]->setPos( posB ); + atoms[b]->setPos(posB); dx = dx / dt; dy = dy / dt; dz = dz / dt; - atoms[a]->getVel( velA ); + atoms[a]->getVel(velA); - velA[0] += rma * dx; - velA[1] += rma * dy; - velA[2] += rma * dz; + velA[0] += rma * dx; + velA[1] += rma * dy; + velA[2] += rma * dz; - atoms[a]->setVel( velA ); + atoms[a]->setVel(velA); - atoms[b]->getVel( velB ); + atoms[b]->getVel(velB); - velB[0] -= rmb * dx; - velB[1] -= rmb * dy; - velB[2] -= rmb * dz; + velB[0] -= rmb * dx; + velB[1] -= rmb * dy; + velB[2] -= rmb * dz; - atoms[b]->setVel( velB ); + atoms[b]->setVel(velB); - moving[a] = 1; - moving[b] = 1; - done = 0; - } + moving[a] = 1; + moving[b] = 1; + done = 0; + } } } - - for(i=0; i void Integrator::constrainB(void){ + int i, j; int done; double posA[3], posB[3]; double velA[3], velB[3]; @@ -597,108 +557,135 @@ void Integrator::constrainB( void ){ int a, b, ax, ay, az, bx, by, bz; double rma, rmb; double dx, dy, dz; - double rabsq, pabsq, rvab; - double diffsq; + double rvab; double gab; int iteration; - for(i=0; igetVel(velA); + atoms[b]->getVel(velB); - atoms[a]->getVel( velA ); - atoms[b]->getVel( velB ); - - vxab = velA[0] - velB[0]; - vyab = velA[1] - velB[1]; - vzab = velA[2] - velB[2]; + vxab = velA[0] - velB[0]; + vyab = velA[1] - velB[1]; + vzab = velA[2] - velB[2]; - atoms[a]->getPos( posA ); - atoms[b]->getPos( posB ); + atoms[a]->getPos(posA); + atoms[b]->getPos(posB); - for (j = 0; j < 3; j++) + for (j = 0; j < 3; j++) rab[j] = posA[j] - posB[j]; - - info->wrapVector( rab ); - - rma = 1.0 / atoms[a]->getMass(); - rmb = 1.0 / atoms[b]->getMass(); - rvab = rab[0] * vxab + rab[1] * vyab + rab[2] * vzab; - - gab = -rvab / ( ( rma + rmb ) * constrainedDsqr[i] ); + info->wrapVector(rab); - if (fabs(gab) > tol) { - - dx = rab[0] * gab; - dy = rab[1] * gab; - dz = rab[2] * gab; - - velA[0] += rma * dx; - velA[1] += rma * dy; - velA[2] += rma * dz; + rma = 1.0 / atoms[a]->getMass(); + rmb = 1.0 / atoms[b]->getMass(); - atoms[a]->setVel( velA ); + rvab = rab[0] * vxab + rab[1] * vyab + rab[2] * vzab; - velB[0] -= rmb * dx; - velB[1] -= rmb * dy; - velB[2] -= rmb * dz; + gab = -rvab / ((rma + rmb) * constrainedDsqr[i]); - atoms[b]->setVel( velB ); - - moving[a] = 1; - moving[b] = 1; - done = 0; - } + if (fabs(gab) > tol){ + dx = rab[0] * gab; + dy = rab[1] * gab; + dz = rab[2] * gab; + + velA[0] += rma * dx; + velA[1] += rma * dy; + velA[2] += rma * dz; + + atoms[a]->setVel(velA); + + velB[0] -= rmb * dx; + velB[1] -= rmb * dy; + velB[2] -= rmb * dz; + + atoms[b]->setVel(velB); + + moving[a] = 1; + moving[b] = 1; + done = 0; + } } } - for(i=0; i void Integrator::rotationPropagation +( DirectionalAtom* dAtom, double ji[3] ){ - int i,j,k; + double angle; + double A[3][3], I[3][3]; + + // use the angular velocities to propagate the rotation matrix a + // full time step + + dAtom->getA(A); + dAtom->getI(I); + + // rotate about the x-axis + angle = dt2 * ji[0] / I[0][0]; + this->rotate( 1, 2, angle, ji, A ); + + // rotate about the y-axis + angle = dt2 * ji[1] / I[1][1]; + this->rotate( 2, 0, angle, ji, A ); + + // rotate about the z-axis + angle = dt * ji[2] / I[2][2]; + this->rotate( 0, 1, angle, ji, A); + + // rotate about the y-axis + angle = dt2 * ji[1] / I[1][1]; + this->rotate( 2, 0, angle, ji, A ); + + // rotate about the x-axis + angle = dt2 * ji[0] / I[0][0]; + this->rotate( 1, 2, angle, ji, A ); + + dAtom->setA( A ); +} + +template void Integrator::rotate(int axes1, int axes2, + double angle, double ji[3], + double A[3][3]){ + int i, j, k; double sinAngle; double cosAngle; double angleSqr; @@ -710,16 +697,17 @@ void Integrator::rotate( int axes1, int axes2, double // initialize the tempA - for(i=0; i<3; i++){ - for(j=0; j<3; j++){ + for (i = 0; i < 3; i++){ + for (j = 0; j < 3; j++){ tempA[j][i] = A[i][j]; } } // initialize the tempJ - for( i=0; i<3; i++) tempJ[i] = ji[i]; - + for (i = 0; i < 3; i++) + tempJ[i] = ji[i]; + // initalize rot as a unit matrix rot[0][0] = 1.0; @@ -729,14 +717,14 @@ void Integrator::rotate( int axes1, int axes2, double rot[1][0] = 0.0; rot[1][1] = 1.0; rot[1][2] = 0.0; - + rot[2][0] = 0.0; rot[2][1] = 0.0; rot[2][2] = 1.0; - + // use a small angle aproximation for sin and cosine - angleSqr = angle * angle; + angleSqr = angle * angle; angleSqrOver4 = angleSqr / 4.0; top = 1.0 - angleSqrOver4; bottom = 1.0 + angleSqrOver4; @@ -749,12 +737,12 @@ void Integrator::rotate( int axes1, int axes2, double rot[axes1][axes2] = sinAngle; rot[axes2][axes1] = -sinAngle; - + // rotate the momentum acoording to: ji[] = rot[][] * ji[] - - for(i=0; i<3; i++){ + + for (i = 0; i < 3; i++){ ji[i] = 0.0; - for(k=0; k<3; k++){ + for (k = 0; k < 3; k++){ ji[i] += rot[i][k] * tempJ[k]; } } @@ -767,12 +755,24 @@ void Integrator::rotate( int axes1, int axes2, double // calculation as: // transpose(A[][]) = transpose(A[][]) * transpose(rot[][]) - for(i=0; i<3; i++){ - for(j=0; j<3; j++){ + for (i = 0; i < 3; i++){ + for (j = 0; j < 3; j++){ A[j][i] = 0.0; - for(k=0; k<3; k++){ - A[j][i] += tempA[i][k] * rot[j][k]; + for (k = 0; k < 3; k++){ + A[j][i] += tempA[i][k] * rot[j][k]; } } } } + +template void Integrator::calcForce(int calcPot, int calcStress){ + myFF->doForces(calcPot, calcStress); +} + +template void Integrator::thermalize(){ + tStats->velocitize(); +} + +template double Integrator::getConservedQuantity(void){ + return tStats->getTotalE(); +}