Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Output Class Reference

#include <Output.h>

List of all members.

Public Member Functions

 Output ()
 ~Output ()
void energy (int, BigReal *)
void coordinate (int, int, Vector *, FloatVector *, Lattice &)
void velocity (int, int, Vector *)
void force (int, int, Vector *)

Static Public Member Functions

int coordinateNeeded (int)
int velocityNeeded (int)
int forceNeeded (int)


Constructor & Destructor Documentation

Output::Output  ) 
 

Definition at line 84 of file Output.C.

00084 { }

Output::~Output  ) 
 

Definition at line 94 of file Output.C.

00094 { }


Member Function Documentation

void Output::coordinate int  ,
int  ,
Vector ,
FloatVector ,
Lattice
 

Definition at line 193 of file Output.C.

References SimParameters::dcdFrequency, SimParameters::dcdUnitCell, END_OF_RUN, FILE_OUTPUT, SimParameters::firstTimestep, IMDOutput::gather_coordinates(), Node::getScript(), Node::imd, SimParameters::IMDfreq, SimParameters::IMDon, iout, ScriptTcl::measure(), SimParameters::N, Node::Object(), SimParameters::restartFrequency, Node::simParameters, simParams, and wrap_coor().

Referenced by CollectionMaster::disposePositions().

00195 {
00196   SimParameters *simParams = Node::Object()->simParameters;
00197   double coor_wrapped = 0;
00198   float fcoor_wrapped = 0;
00199 
00200   if ( timestep >= 0 ) {
00201 
00202     //  Output a DCD trajectory 
00203     if ( simParams->dcdFrequency &&
00204        ((timestep % simParams->dcdFrequency) == 0) )
00205     {
00206       wrap_coor(fcoor,lattice,&fcoor_wrapped);
00207       output_dcdfile(timestep, n, fcoor, 
00208           simParams->dcdUnitCell ? &lattice : NULL);
00209     }
00210 
00211     //  Output a restart file
00212     if ( simParams->restartFrequency &&
00213        ((timestep % simParams->restartFrequency) == 0) )
00214     {
00215       iout << "WRITING COORDINATES TO RESTART FILE AT STEP "
00216                                 << timestep << "\n" << endi;
00217       wrap_coor(coor,lattice,&coor_wrapped);
00218       output_restart_coordinates(coor, n, timestep);
00219       iout << "FINISHED WRITING RESTART COORDINATES\n" <<endi;
00220       fflush(stdout);
00221     }
00222 
00223     //  Interactive MD
00224     if ( simParams->IMDon &&
00225        ( ((timestep % simParams->IMDfreq) == 0) ||
00226          (timestep == simParams->firstTimestep) ) )
00227     {
00228       IMDOutput *imd = Node::Object()->imd;
00229       wrap_coor(fcoor,lattice,&fcoor_wrapped);
00230       if (imd != NULL) imd->gather_coordinates(timestep, n, fcoor);
00231     }
00232 
00233   }
00234 
00235   if (timestep == EVAL_MEASURE)
00236   {
00237 #ifdef NAMD_TCL
00238     wrap_coor(coor,lattice,&coor_wrapped);
00239     Node::Object()->getScript()->measure(coor);
00240 #endif
00241   }
00242 
00243   //  Output final coordinates
00244   if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
00245   {
00246     int realstep = ( timestep == FILE_OUTPUT ?
00247           simParams->firstTimestep : simParams->N );
00248     iout << "WRITING COORDINATES TO OUTPUT FILE AT STEP "
00249                                 << realstep << "\n" << endi;
00250     fflush(stdout);
00251     wrap_coor(coor,lattice,&coor_wrapped);
00252     output_final_coordinates(coor, n, realstep);
00253   }
00254 
00255   //  Close trajectory files
00256   if (timestep == END_OF_RUN)
00257   {
00258     if (simParams->dcdFrequency) output_dcdfile(END_OF_RUN,0,0, 
00259         simParams->dcdUnitCell ? &lattice : NULL);
00260   }
00261 
00262 }

int Output::coordinateNeeded int   )  [static]
 

Definition at line 114 of file Output.C.

References SimParameters::benchTimestep, SimParameters::dcdFrequency, END_OF_RUN, FILE_OUTPUT, SimParameters::firstTimestep, SimParameters::IMDfreq, SimParameters::IMDon, Node::Object(), SimParameters::restartFrequency, Node::simParameters, and simParams.

Referenced by Controller::enqueueCollections(), and Sequencer::submitCollections().

00115 {
00116   SimParameters *simParams = Node::Object()->simParameters;
00117 
00118   if(simParams->benchTimestep) return 0;
00119 
00120   int positionsNeeded = 0;
00121 
00122   if ( timestep >= 0 ) {
00123 
00124     //  Output a DCD trajectory 
00125     if ( simParams->dcdFrequency &&
00126        ((timestep % simParams->dcdFrequency) == 0) )
00127     { positionsNeeded |= 1; }
00128 
00129     //  Output a restart file
00130     if ( simParams->restartFrequency &&
00131        ((timestep % simParams->restartFrequency) == 0) )
00132     { positionsNeeded |= 2; }
00133 
00134     //  Iteractive MD
00135     if ( simParams->IMDon &&
00136        ( ((timestep % simParams->IMDfreq) == 0) ||
00137          (timestep == simParams->firstTimestep) ) )
00138       { positionsNeeded |= 1; }
00139 
00140   }
00141 
00142   //  Output final coordinates
00143   if (timestep == FILE_OUTPUT || timestep == END_OF_RUN ||
00144                                         timestep == EVAL_MEASURE)
00145   {
00146     positionsNeeded |= 2;
00147   }
00148 
00149   return positionsNeeded;
00150 }

void Output::energy int  ,
BigReal
 

void Output::force int  ,
int  ,
Vector
 

Definition at line 402 of file Output.C.

References SimParameters::firstTimestep, SimParameters::forceDcdFrequency, iout, Node::Object(), Node::simParameters, and simParams.

Referenced by CollectionMaster::disposeForces().

00403 {
00404   SimParameters *simParams = Node::Object()->simParameters;
00405 
00406   if ( timestep >= 0 ) {
00407 
00408     //  Output force DCD trajectory
00409     if ( simParams->forceDcdFrequency &&
00410        ((timestep % simParams->forceDcdFrequency) == 0) )
00411     {
00412       output_forcedcdfile(timestep, n, frc);
00413     }
00414 
00415   }
00416 
00417   //  Output forces
00418   if (timestep == FORCE_OUTPUT)
00419   {
00420     int realstep = simParams->firstTimestep;
00421     iout << "WRITING FORCES TO OUTPUT FILE AT STEP "
00422                                 << realstep << "\n" << endi;
00423     fflush(stdout);
00424     output_forces(realstep, n, frc);
00425   }
00426 
00427   //  Trajectory file closed by velocity() above
00428 
00429 }

int Output::forceNeeded int   )  [static]
 

Definition at line 376 of file Output.C.

References SimParameters::benchTimestep, SimParameters::forceDcdFrequency, Node::Object(), Node::simParameters, and simParams.

Referenced by Controller::enqueueCollections(), and Sequencer::submitCollections().

00377 {
00378   SimParameters *simParams = Node::Object()->simParameters;
00379 
00380   if(simParams->benchTimestep) return 0;
00381 
00382   int forcesNeeded = 0;
00383 
00384   if ( timestep >= 0 ) {
00385 
00386     //  Output a force DCD trajectory
00387     if ( simParams->forceDcdFrequency &&
00388        ((timestep % simParams->forceDcdFrequency) == 0) )
00389       { forcesNeeded |= 1; }
00390 
00391   }
00392 
00393   //  Output forces
00394   if (timestep == FORCE_OUTPUT)
00395   {
00396     forcesNeeded |= 2;
00397   }
00398 
00399   return forcesNeeded;
00400 }

void Output::velocity int  ,
int  ,
Vector
 

Definition at line 312 of file Output.C.

References END_OF_RUN, FILE_OUTPUT, SimParameters::firstTimestep, SimParameters::forceDcdFrequency, iout, SimParameters::N, Node::Object(), SimParameters::restartFrequency, Node::simParameters, simParams, and SimParameters::velDcdFrequency.

Referenced by CollectionMaster::disposeVelocities().

00313 {
00314   SimParameters *simParams = Node::Object()->simParameters;
00315 
00316   if ( timestep >= 0 ) {
00317 
00318     //  Output velocity DCD trajectory
00319     if ( simParams->velDcdFrequency &&
00320        ((timestep % simParams->velDcdFrequency) == 0) )
00321     {
00322       output_veldcdfile(timestep, n, vel);
00323     }
00324 
00325   //  Output restart file
00326     if ( simParams->restartFrequency &&
00327        ((timestep % simParams->restartFrequency) == 0) )
00328     {
00329       iout << "WRITING VELOCITIES TO RESTART FILE AT STEP "
00330                                 << timestep << "\n" << endi;
00331       output_restart_velocities(timestep, n, vel);
00332       iout << "FINISHED WRITING RESTART VELOCITIES\n" <<endi;
00333       fflush(stdout);
00334     }
00335 
00336   }
00337 
00338   //  Output final velocities
00339   if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
00340   {
00341     int realstep = ( timestep == FILE_OUTPUT ?
00342           simParams->firstTimestep : simParams->N );
00343     iout << "WRITING VELOCITIES TO OUTPUT FILE AT STEP "
00344                                 << realstep << "\n" << endi;
00345     fflush(stdout);
00346     output_final_velocities(realstep, n, vel);
00347   }
00348 
00349   //  Close trajectory files
00350   if (timestep == END_OF_RUN)
00351   {
00352     if (simParams->velDcdFrequency) output_veldcdfile(END_OF_RUN,0,0);
00353     // close force dcd file here since no final force output below
00354     if (simParams->forceDcdFrequency) output_forcedcdfile(END_OF_RUN,0,0);
00355   }
00356 
00357 }

int Output::velocityNeeded int   )  [static]
 

Definition at line 281 of file Output.C.

References SimParameters::benchTimestep, FILE_OUTPUT, Node::Object(), SimParameters::restartFrequency, Node::simParameters, simParams, and SimParameters::velDcdFrequency.

Referenced by Controller::enqueueCollections(), and Sequencer::submitCollections().

00282 {
00283   SimParameters *simParams = Node::Object()->simParameters;
00284 
00285   if(simParams->benchTimestep) return 0;
00286 
00287   int velocitiesNeeded = 0;
00288 
00289   if ( timestep >= 0 ) {
00290 
00291     //  Output a velocity DCD trajectory
00292     if ( simParams->velDcdFrequency &&
00293        ((timestep % simParams->velDcdFrequency) == 0) )
00294       { velocitiesNeeded |= 1; }
00295 
00296     //  Output a restart file
00297     if ( simParams->restartFrequency &&
00298        ((timestep % simParams->restartFrequency) == 0) )
00299       { velocitiesNeeded |= 2; }
00300 
00301   }
00302 
00303   //  Output final velocities
00304   if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
00305   {
00306     velocitiesNeeded |= 2;
00307   }
00308 
00309   return velocitiesNeeded;
00310 }


The documentation for this class was generated from the following files:
Generated on Fri May 25 04:07:23 2012 for NAMD by  doxygen 1.3.9.1