--- branches/mmeineke/mdtools/md_code/Symplectic.cpp 2002/07/09 18:40:59 10 +++ trunk/mdtools/md_code/Symplectic.cpp 2003/01/17 21:53:36 238 @@ -4,8 +4,9 @@ #include "Integrator.hpp" #include "Thermo.hpp" #include "ReadWrite.hpp" +#include "ForceField.hpp" +#include "simError.h" - extern "C"{ void v_constrain_a_( double &dt, int &n_atoms, double* mass, @@ -34,7 +35,6 @@ Symplectic::Symplectic( SimInfo* the_entry_plug ){ isFirst = 1; srInteractions = entry_plug->sr_interactions; - longRange = entry_plug->longRange; nSRI = entry_plug->n_SRI; // give a little love back to the SimInfo object @@ -120,7 +120,7 @@ void Symplectic::integrate( void ){ double dt2; // half the dt double vx, vy, vz; // the velocities - double vx2, vy2, vz2; // the square of the velocities +// double vx2, vy2, vz2; // the square of the velocities double rx, ry, rz; // the postitions double ji[3]; // the body frame angular momentum @@ -129,6 +129,7 @@ void Symplectic::integrate( void ){ double angle; // the angle through which to rotate the rotation matrix double A[3][3]; // the rotation matrix + int time; double dt = entry_plug->dt; double runTime = entry_plug->run_time; @@ -141,12 +142,13 @@ void Symplectic::integrate( void ){ int status_n = (int)( statusTime / dt ); int vel_n = (int)( thermalTime / dt ); + ForceFields *ff = entry_plug-> + Thermo *tStats = new Thermo( entry_plug ); StatWriter* e_out = new StatWriter( entry_plug ); DumpWriter* dump_out = new DumpWriter( entry_plug ); - Atom** atoms = entry_plug->atoms; DirectionalAtom* dAtom; dt2 = 0.5 * dt; @@ -154,6 +156,7 @@ void Symplectic::integrate( void ){ // initialize the forces the before the first step + for(i = 0; i < nAtoms; i++){ atoms[i]->zeroForces(); } @@ -170,6 +173,9 @@ void Symplectic::integrate( void ){ tStats->velocitize(); } + dump_out->writeDump( 0.0 ); + e_out->writeStat( 0.0 ); + if( n_constrained ){ double *Rx = new double[nAtoms]; @@ -358,12 +364,14 @@ void Symplectic::integrate( void ){ dAtom->setJz( ji[2] ); } } - + + time = tl + 1; + if( entry_plug->setTemp ){ - if( !(tl % vel_n) ) tStats->velocitize(); + if( !(time % vel_n) ) tStats->velocitize(); } - if( !(tl % sample_n) ) dump_out->writeDump( tl * dt ); - if( !(tl % status_n) ) e_out->writeStat( tl * dt ); + if( !(time % sample_n) ) dump_out->writeDump( time * dt ); + if( !(time % status_n) ) e_out->writeStat( time * dt ); } } else{ @@ -486,9 +494,9 @@ void Symplectic::integrate( void ){ atoms[i]->set_vy( vy ); atoms[i]->set_vz( vz ); - vx2 = vx * vx; - vy2 = vy * vy; - vz2 = vz * vz; +// vx2 = vx * vx; +// vy2 = vy * vy; +// vz2 = vz * vz; if( atoms[i]->isDirectional() ){ @@ -521,12 +529,14 @@ void Symplectic::integrate( void ){ dAtom->setJz( ji[2] ); } } - + + time = tl + 1; + if( entry_plug->setTemp ){ - if( !(tl % vel_n) ) tStats->velocitize(); + if( !(time % vel_n) ) tStats->velocitize(); } - if( !(tl % sample_n) ) dump_out->writeDump( tl * dt ); - if( !(tl % status_n) ) e_out->writeStat( tl * dt ); + if( !(time % sample_n) ) dump_out->writeDump( time * dt ); + if( !(time % status_n) ) e_out->writeStat( time * dt ); } }