NAMD
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
Output Class Reference

#include <Output.h>

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 *)
 
void replicaDcdOff ()
 
void setReplicaDcdIndex (int index)
 
void replicaDcdInit (int index, const char *filename)
 
void replicaDcdSelectInit (int index, const char *tag, const char *filename)
 
void recvReplicaDcdInit (ReplicaDcdInitMsg *msg)
 
void recvReplicaDcdData (ReplicaDcdDataMsg *msg)
 

Static Public Member Functions

static std::pair< int, int > coordinateNeeded (int)
 
static int velocityNeeded (int)
 
static int forceNeeded (int)
 

Friends

class SimParameters
 

Detailed Description

Definition at line 35 of file Output.h.

Constructor & Destructor Documentation

◆ Output()

Output::Output ( )

Definition at line 169 of file Output.C.

169 : replicaDcdActive(0) { }

◆ ~Output()

Output::~Output ( )

Definition at line 179 of file Output.C.

179 { }

Member Function Documentation

◆ coordinate()

void Output::coordinate ( int  timestep,
int  n,
Vector coor,
FloatVector fcoor,
Lattice lattice 
)

Definition at line 345 of file Output.C.

References Molecule::dcdSelectionParams, END_OF_RUN, endi(), EVAL_MEASURE, FILE_OUTPUT, dcd_params::frequency, IMDOutput::gather_coordinates(), Molecule::get_dcd_selection_index_from_atom_id(), Molecule::get_dcd_selection_size(), Node::getScript(), Node::imd, iout, ScriptTcl::measure(), Node::molecule, Node::Object(), Node::simParameters, simParams, dcd_params::size, dcd_params::tag, wrap_coor(), and wrap_coor_dcd_selection().

Referenced by CollectionMaster::disposePositions().

347 {
349  Molecule *molecule = Node::Object()->molecule;
350  double coor_wrapped = 0;
351  float fcoor_wrapped = 0;
352 
353  if ( timestep >= 0 ) {
354 
355  // Output a DCD trajectory
356  if ( simParams->dcdFrequency &&
357  ((timestep % simParams->dcdFrequency) == 0) )
358  {
359  wrap_coor(fcoor,lattice,&fcoor_wrapped);
360  output_dcdfile(timestep, n, fcoor,
361  simParams->dcdUnitCell ? &lattice : NULL, 0);
362  }
363 
364  // Output any DCD selection trajectories that this timestep mods
365  if ( simParams->dcdSelectionOn)
366  {
367  bool needCleanup = false;
368 
369  for(int index=0; index<16;++index)
370  {
371  int frequency=molecule->dcdSelectionParams[index].frequency;
372  uint16 tag=molecule->dcdSelectionParams[index].tag;
373  int size=molecule->dcdSelectionParams[index].size;
374  if(frequency>0 && (timestep % frequency) == 0)
375  {
376  FloatVector *dcdSelectionFcoor = fcoor;
377  int dcdSelectionNpoints = n;
378  if(dcdSelectionNpoints != molecule->get_dcd_selection_size(index))
379  {
380  // on intervals when some other output is also happening, we have
381  // to filter out a copy of the selection from the full
382  // collected output then wrap and output accordingly
383  dcdSelectionNpoints = size;
384  dcdSelectionFcoor = new FloatVector[dcdSelectionNpoints];
385  needCleanup = true;
386  for(int i=0; i<n ;i++)
387  {
388  int offset = molecule->get_dcd_selection_index_from_atom_id(index, i);
389  if(offset >= 0)
390  dcdSelectionFcoor[offset] = fcoor[i];
391  }
392  }
393  else
394  {
395  dcdSelectionFcoor = fcoor;
396  }
397  wrap_coor_dcd_selection(dcdSelectionFcoor, lattice, &fcoor_wrapped, index);
398  output_dcdfile(timestep, dcdSelectionNpoints, dcdSelectionFcoor,
399  simParams->dcdUnitCell ? &lattice : NULL, tag);
400  if(needCleanup)
401  delete [] dcdSelectionFcoor;
402  }
403 
404  }
405  }
406 
407  // Output a restart file
408  if ( simParams->restartFrequency &&
409  ((timestep % simParams->restartFrequency) == 0) )
410  {
411  iout << "WRITING COORDINATES TO RESTART FILE AT STEP "
412  << timestep << "\n" << endi;
413  wrap_coor(coor,lattice,&coor_wrapped);
414  output_restart_coordinates(coor, n, timestep);
415  iout << "FINISHED WRITING RESTART COORDINATES\n" <<endi;
416  fflush(stdout);
417  }
418 
419  // Interactive MD
420  if ( simParams->IMDon &&
421  ( ((timestep % simParams->IMDfreq) == 0) ||
422  (timestep == simParams->firstTimestep) ) )
423  {
424  IMDOutput *imd = NULL;
425 #ifdef NODEGROUP_FORCE_REGISTER
426  if (simParams->CUDASOAintegrate) {
427  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
428  imd = cpdata.ckLocalBranch()->imd;
429  }
430  else
431 #endif
432  {
433  imd = Node::Object()->imd;
434  }
435  wrap_coor(fcoor,lattice,&fcoor_wrapped);
436  if (imd != NULL) imd->gather_coordinates(timestep, n, fcoor);
437  }
438 
439  }
440 
441  if (timestep == EVAL_MEASURE)
442  {
443 #ifdef NAMD_TCL
444  wrap_coor(coor,lattice,&coor_wrapped);
445  Node::Object()->getScript()->measure(coor);
446 #endif
447  }
448 
449  // Output final coordinates
450  if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
451  {
452  int realstep = ( timestep == FILE_OUTPUT ?
453  simParams->firstTimestep : simParams->N );
454  iout << "WRITING COORDINATES TO OUTPUT FILE AT STEP "
455  << realstep << "\n" << endi;
456  fflush(stdout);
457  wrap_coor(coor,lattice,&coor_wrapped);
458  output_final_coordinates(coor, n, realstep);
459  }
460 
461  // Close trajectory files
462  if (timestep == END_OF_RUN)
463  {
464  if (simParams->dcdFrequency) output_dcdfile(END_OF_RUN,0,0,
465  simParams->dcdUnitCell
466  ? &lattice : NULL, 0);
467  if ( simParams->dcdSelectionOn)
468  {
469  for(int dcdSelectionIndex=0; dcdSelectionIndex<16;++dcdSelectionIndex)
470  {
471  int dcdSelectionFrequency = molecule->dcdSelectionParams[dcdSelectionIndex].frequency;
472  int dcdSelectionTag = molecule->dcdSelectionParams[dcdSelectionIndex].tag;
473  if(dcdSelectionFrequency)
474  output_dcdfile(END_OF_RUN,0,0,
475  simParams->dcdUnitCell
476  ? &lattice : NULL, dcdSelectionTag);
477  }
478  }
479  }
480 
481 }
static Node * Object()
Definition: Node.h:86
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
int frequency
Definition: common.h:262
#define FILE_OUTPUT
Definition: Output.h:25
IMDOutput * imd
Definition: Node.h:186
uint16 tag
Definition: common.h:259
#define EVAL_MEASURE
Definition: Output.h:27
SimParameters * simParameters
Definition: Node.h:181
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
void gather_coordinates(int timestep, int N, FloatVector *coords)
Definition: IMDOutput.C:29
#define iout
Definition: InfoStream.h:51
Molecule stores the structural information for the system.
Definition: Molecule.h:175
uint16_t uint16
Definition: common.h:41
const int get_dcd_selection_size(const int index)
Definition: Molecule.h:886
void wrap_coor(Vector *coor, Lattice &lattice, double *done)
Definition: Output.C:337
int get_dcd_selection_index_from_atom_id(const int index, const int atomIndex)
Definition: Molecule.h:881
void wrap_coor_dcd_selection(Vector *coor, Lattice &lattice, double *done, int index)
Definition: Output.C:329
#define END_OF_RUN
Definition: Output.h:26
#define simParams
Definition: Output.C:129
int size
Definition: common.h:266
ScriptTcl * getScript()
Definition: Node.C:1599
void measure(Vector *)
Definition: ScriptTcl.C:1400
Molecule * molecule
Definition: Node.h:179

◆ coordinateNeeded()

std::pair< int, int > Output::coordinateNeeded ( int  timestep)
static

Definition at line 199 of file Output.C.

References Molecule::dcdSelectionParams, END_OF_RUN, EVAL_MEASURE, FILE_OUTPUT, dcd_params::frequency, Node::molecule, Node::Object(), Node::simParameters, simParams, and dcd_params::tag.

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

200 {
202 
203  if(simParams->benchTimestep) return std::make_pair(0,0);
204 
205  int positionsNeeded = 0;
206  uint16 dcdSelectionTag = 0;
207  if ( timestep >= 0 ) {
208 
209  // Output a DCD trajectory
210  if ( simParams->dcdFrequency &&
211  ((timestep % simParams->dcdFrequency) == 0) )
212  { positionsNeeded |= 1; }
213 
214  // Output a DCD Selection trajectory
215 
216  if (simParams->dcdSelectionOn)
217  {
218  Molecule *mol = Node::Object()->molecule;
219  for(int index=0; index<16;++index)
220  {
221  int frequency=mol->dcdSelectionParams[index].frequency;
222  uint16 tag=mol->dcdSelectionParams[index].tag;
223  if(frequency && (timestep % frequency) == 0)
224  {
225  if(dcdSelectionTag>0)
226  positionsNeeded |=1; //multi selection means all positions
227  positionsNeeded |= 4; dcdSelectionTag = tag;
228  }
229  }
230  }
231  // Output a restart file
232  if ( simParams->restartFrequency &&
233  ((timestep % simParams->restartFrequency) == 0) )
234  { positionsNeeded |= 2; }
235 
236  // Iteractive MD
237  if ( simParams->IMDon &&
238  ( ((timestep % simParams->IMDfreq) == 0) ||
239  (timestep == simParams->firstTimestep) ) )
240  { positionsNeeded |= 1; }
241 
242  }
243 
244  // Output final coordinates
245  if (timestep == FILE_OUTPUT || timestep == END_OF_RUN ||
246  timestep == EVAL_MEASURE)
247  {
248  positionsNeeded |= 2;
249  }
250  return std::make_pair(positionsNeeded,dcdSelectionTag);
251 }
static Node * Object()
Definition: Node.h:86
DCDParams dcdSelectionParams[16]
Definition: Molecule.h:481
int frequency
Definition: common.h:262
#define FILE_OUTPUT
Definition: Output.h:25
uint16 tag
Definition: common.h:259
#define EVAL_MEASURE
Definition: Output.h:27
SimParameters * simParameters
Definition: Node.h:181
Molecule stores the structural information for the system.
Definition: Molecule.h:175
uint16_t uint16
Definition: common.h:41
#define END_OF_RUN
Definition: Output.h:26
#define simParams
Definition: Output.C:129
Molecule * molecule
Definition: Node.h:179

◆ energy()

void Output::energy ( int  ,
BigReal  
)

◆ force()

void Output::force ( int  timestep,
int  n,
Vector frc 
)

Definition at line 621 of file Output.C.

References endi(), FORCE_OUTPUT, iout, Node::Object(), Node::simParameters, and simParams.

Referenced by CollectionMaster::disposeForces().

622 {
624 
625  if ( timestep >= 0 ) {
626 
627  // Output force DCD trajectory
628  if ( simParams->forceDcdFrequency &&
629  ((timestep % simParams->forceDcdFrequency) == 0) )
630  {
631  output_forcedcdfile(timestep, n, frc);
632  }
633 
634  }
635 
636  // Output forces
637  if (timestep == FORCE_OUTPUT)
638  {
639  int realstep = simParams->firstTimestep;
640  iout << "WRITING FORCES TO OUTPUT FILE AT STEP "
641  << realstep << "\n" << endi;
642  fflush(stdout);
643  output_forces(realstep, n, frc);
644  }
645 
646  // Trajectory file closed by velocity() above
647 
648 }
static Node * Object()
Definition: Node.h:86
SimParameters * simParameters
Definition: Node.h:181
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
#define simParams
Definition: Output.C:129
#define FORCE_OUTPUT
Definition: Output.h:28

◆ forceNeeded()

int Output::forceNeeded ( int  timestep)
static

Definition at line 595 of file Output.C.

References FORCE_OUTPUT, Node::Object(), Node::simParameters, and simParams.

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

596 {
598 
599  if(simParams->benchTimestep) return 0;
600 
601  int forcesNeeded = 0;
602 
603  if ( timestep >= 0 ) {
604 
605  // Output a force DCD trajectory
606  if ( simParams->forceDcdFrequency &&
607  ((timestep % simParams->forceDcdFrequency) == 0) )
608  { forcesNeeded |= 1; }
609 
610  }
611 
612  // Output forces
613  if (timestep == FORCE_OUTPUT)
614  {
615  forcesNeeded |= 2;
616  }
617 
618  return forcesNeeded;
619 }
static Node * Object()
Definition: Node.h:86
SimParameters * simParameters
Definition: Node.h:181
#define simParams
Definition: Output.C:129
#define FORCE_OUTPUT
Definition: Output.h:28

◆ recvReplicaDcdData()

void Output::recvReplicaDcdData ( ReplicaDcdDataMsg msg)

Definition at line 880 of file Output.C.

References ReplicaDcdDataMsg::data, DCD_FILEEXISTS, ReplicaDcdDataMsg::dcdIndex, ReplicaDcdDataMsg::dcdSelectIndex, ReplicaDcdDataMsg::DELTA, endi(), iout, NAMD_bug(), NAMD_die(), NAMD_err(), namdMyNode, ReplicaDcdDataMsg::NFILE, ReplicaDcdDataMsg::NPRIV, ReplicaDcdDataMsg::NSAVC, ReplicaDcdDataMsg::NSTEP, ReplicaDcdDataMsg::numAtoms, open_dcd_write(), sendReplicaDcdAck(), ReplicaDcdDataMsg::srcPart, ReplicaDcdDataMsg::unitcell, ReplicaDcdDataMsg::with_unitcell, write_dcdheader(), and write_dcdstep().

Referenced by recvReplicaDcdData().

880  {
881  Molecule *molecule = namdMyNode->molecule;
882  if ( msg->dcdSelectIndex>=16 && ! replicaDcdFiles.count(msg->dcdIndex) ||
883  ( ! replicaDcdFiles.count(msg->dcdIndex) )) {
884  char err_msg[257];
885  sprintf(err_msg, "Unknown replicaDcdFile identifier %d\n", msg->dcdIndex);
886  NAMD_die(err_msg);
887  }
888  replicaDcdFile &f = (msg->dcdSelectIndex<16) ? replicaDcdSelectFiles[std::make_pair(msg->dcdIndex,msg->dcdSelectIndex)]: replicaDcdFiles[msg->dcdIndex];
889 
890  if ( ! f.fileid ) {
891  // Open the DCD file
892  iout << "OPENING REPLICA DCD FILE " << msg->dcdIndex << " " << f.filename.c_str() << "\n" << endi;
893 
894  f.fileid=open_dcd_write(f.filename.c_str());
895 
896  if (f.fileid == DCD_FILEEXISTS) {
897  char err_msg[257];
898  sprintf(err_msg, "DCD file %s already exists!!", f.filename.c_str());
899  NAMD_err(err_msg);
900  } else if (f.fileid < 0) {
901  char err_msg[257];
902  if(msg->dcdSelectIndex<16)
903  sprintf(err_msg, "Couldn't open DCD Index %d Select Index %d file %s", msg->dcdIndex, msg->dcdSelectIndex, f.filename.c_str());
904  else
905  sprintf(err_msg, "Couldn't open DCD Index %d file %s", msg->dcdIndex, f.filename.c_str());
906  NAMD_err(err_msg);
907  } else if (! f.fileid) {
908  NAMD_bug("Output::recvReplicaDcdData open_dcd_write returned fileid of zero");
909  }
910 
911  // Write out the header
912  int ret_code = write_dcdheader(f.fileid, f.filename.c_str(),
913  msg->numAtoms, msg->NFILE, msg->NPRIV, msg->NSAVC, msg->NSTEP,
914  msg->DELTA, msg->with_unitcell);
915 
916  if (ret_code<0) {
917  NAMD_err("Writing of DCD header failed!!");
918  }
919  }
920 
921  // Write out the values for this timestep
922  iout << "WRITING TO REPLICA DCD FILE " << msg->dcdIndex << " " << f.filename.c_str() << "\n" << endi;
923  float *msgx = (float*) msg->data;
924  float *msgy = msgx + msg->numAtoms;
925  float *msgz = msgy + msg->numAtoms;
926  int ret_code = write_dcdstep(f.fileid, msg->numAtoms, msgx, msgy, msgz,
927  msg->with_unitcell ? msg->unitcell : 0);
928  if (ret_code < 0) NAMD_err("Writing of DCD step failed!!");
929 
930  sendReplicaDcdAck(msg->srcPart, (ReplicaDcdAckMsg*) CmiAlloc(sizeof(ReplicaDcdAckMsg)));
931 }
void NAMD_err(const char *err_msg)
Definition: common.C:170
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
Molecule stores the structural information for the system.
Definition: Molecule.h:175
int open_dcd_write(const char *dcdname)
Definition: dcdlib.C:662
#define DCD_FILEEXISTS
Definition: dcdlib.h:52
void NAMD_bug(const char *err_msg)
Definition: common.C:195
#define namdMyNode
Definition: Output.C:128
int write_dcdstep(int fd, int N, float *X, float *Y, float *Z, double *cell)
Definition: dcdlib.C:736
void NAMD_die(const char *err_msg)
Definition: common.C:147
int write_dcdheader(int fd, const char *filename, int N, int NFILE, int NPRIV, int NSAVC, int NSTEP, double DELTA, int with_unitcell)
Definition: dcdlib.C:915
void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg)
Definition: DataExchanger.C:67
uint16_t dcdSelectIndex
Definition: DataExchanger.h:48
double unitcell[6]
Definition: DataExchanger.h:51

◆ recvReplicaDcdInit()

void Output::recvReplicaDcdInit ( ReplicaDcdInitMsg msg)

Definition at line 869 of file Output.C.

References close_dcd_write(), ReplicaDcdInitMsg::data, ReplicaDcdInitMsg::dcdIndex, ReplicaDcdInitMsg::dcdSelectIndex, endi(), iout, sendReplicaDcdAck(), and ReplicaDcdInitMsg::srcPart.

Referenced by recvReplicaDcdInit().

869  {
870  replicaDcdFile &f = (msg->dcdSelectIndex<16) ? replicaDcdSelectFiles[std::make_pair(msg->dcdIndex,msg->dcdSelectIndex)]: replicaDcdFiles[msg->dcdIndex];
871  if ( f.fileid ) {
872  iout << "CLOSING REPLICA DCD FILE " << msg->dcdIndex << " " << f.filename.c_str() << "\n" << endi;
873  close_dcd_write(f.fileid);
874  f.fileid = 0;
875  }
876  f.filename = (const char*) msg->data;
877  sendReplicaDcdAck(msg->srcPart, (ReplicaDcdAckMsg*) CmiAlloc(sizeof(ReplicaDcdAckMsg)));
878 }
uint16_t dcdSelectIndex
Definition: DataExchanger.h:39
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg)
Definition: DataExchanger.C:67
void close_dcd_write(int fd)
Definition: dcdlib.C:1063

◆ replicaDcdInit()

void Output::replicaDcdInit ( int  index,
const char *  filename 
)

Definition at line 843 of file Output.C.

References ReplicaDcdInitMsg::data, ReplicaDcdInitMsg::dcdIndex, ReplicaDcdInitMsg::dcdSelectIndex, sendReplicaDcdInit(), and ReplicaDcdInitMsg::srcPart.

843  {
844  replicaDcdActive = 1;
845  replicaDcdIndex = index;
846  int msgsize = sizeof(ReplicaDcdInitMsg) + strlen(filename);
847  ReplicaDcdInitMsg *msg = (ReplicaDcdInitMsg *) CmiAlloc(msgsize);
848  msg->srcPart = CmiMyPartition();
849  msg->dcdIndex = replicaDcdIndex;
850  msg->dcdSelectIndex = 16;
851  strcpy(msg->data, filename);
852  sendReplicaDcdInit(abs(replicaDcdIndex) % CmiNumPartitions(), msg, msgsize);
853 }
uint16_t dcdSelectIndex
Definition: DataExchanger.h:39
void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize)
Definition: DataExchanger.C:45

◆ replicaDcdOff()

void Output::replicaDcdOff ( )
inline

Definition at line 93 of file Output.h.

93 { replicaDcdActive = 0; }

◆ replicaDcdSelectInit()

void Output::replicaDcdSelectInit ( int  index,
const char *  tag,
const char *  filename 
)

Definition at line 855 of file Output.C.

References ReplicaDcdInitMsg::data, ReplicaDcdInitMsg::dcdIndex, ReplicaDcdInitMsg::dcdSelectIndex, Molecule::find_or_create_dcd_selection_index(), namdMyNode, sendReplicaDcdInit(), and ReplicaDcdInitMsg::srcPart.

855  {
856  replicaDcdActive = 1;
857  replicaDcdIndex = index;
858  int msgsize = sizeof(ReplicaDcdInitMsg) + strlen(filename);
859  ReplicaDcdInitMsg *msg = (ReplicaDcdInitMsg *) CmiAlloc(msgsize);
860  msg->srcPart = CmiMyPartition();
861  msg->dcdIndex = replicaDcdIndex;
862  Molecule *molecule = namdMyNode->molecule;
864  strcpy(msg->data, filename);
865  sendReplicaDcdInit(abs(replicaDcdIndex) % CmiNumPartitions(), msg, msgsize);
866 }
uint16_t dcdSelectIndex
Definition: DataExchanger.h:39
void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize)
Definition: DataExchanger.C:45
Molecule stores the structural information for the system.
Definition: Molecule.h:175
uint16_t find_or_create_dcd_selection_index(const char *keystr)
#define namdMyNode
Definition: Output.C:128

◆ setReplicaDcdIndex()

void Output::setReplicaDcdIndex ( int  index)

Definition at line 838 of file Output.C.

838  {
839  replicaDcdActive = 1;
840  replicaDcdIndex = index;
841 }

◆ velocity()

void Output::velocity ( int  timestep,
int  n,
Vector vel 
)

Definition at line 531 of file Output.C.

References END_OF_RUN, endi(), FILE_OUTPUT, iout, Node::Object(), Node::simParameters, and simParams.

Referenced by CollectionMaster::disposeVelocities().

532 {
534 
535  if ( timestep >= 0 ) {
536 
537  // Output velocity DCD trajectory
538  if ( simParams->velDcdFrequency &&
539  ((timestep % simParams->velDcdFrequency) == 0) )
540  {
541  output_veldcdfile(timestep, n, vel);
542  }
543 
544  // Output restart file
545  if ( simParams->restartFrequency &&
546  ((timestep % simParams->restartFrequency) == 0) )
547  {
548  iout << "WRITING VELOCITIES TO RESTART FILE AT STEP "
549  << timestep << "\n" << endi;
550  output_restart_velocities(timestep, n, vel);
551  iout << "FINISHED WRITING RESTART VELOCITIES\n" <<endi;
552  fflush(stdout);
553  }
554 
555  }
556 
557  // Output final velocities
558  if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
559  {
560  int realstep = ( timestep == FILE_OUTPUT ?
561  simParams->firstTimestep : simParams->N );
562  iout << "WRITING VELOCITIES TO OUTPUT FILE AT STEP "
563  << realstep << "\n" << endi;
564  fflush(stdout);
565  output_final_velocities(realstep, n, vel);
566  }
567 
568  // Close trajectory files
569  if (timestep == END_OF_RUN)
570  {
571  if (simParams->velDcdFrequency) output_veldcdfile(END_OF_RUN,0,0);
572  // close force dcd file here since no final force output below
573  if (simParams->forceDcdFrequency) output_forcedcdfile(END_OF_RUN,0,0);
574  }
575 
576 }
static Node * Object()
Definition: Node.h:86
#define FILE_OUTPUT
Definition: Output.h:25
SimParameters * simParameters
Definition: Node.h:181
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
#define END_OF_RUN
Definition: Output.h:26
#define simParams
Definition: Output.C:129

◆ velocityNeeded()

int Output::velocityNeeded ( int  timestep)
static

Definition at line 500 of file Output.C.

References END_OF_RUN, FILE_OUTPUT, Node::Object(), Node::simParameters, and simParams.

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

501 {
503 
504  if(simParams->benchTimestep) return 0;
505 
506  int velocitiesNeeded = 0;
507 
508  if ( timestep >= 0 ) {
509 
510  // Output a velocity DCD trajectory
511  if ( simParams->velDcdFrequency &&
512  ((timestep % simParams->velDcdFrequency) == 0) )
513  { velocitiesNeeded |= 1; }
514 
515  // Output a restart file
516  if ( simParams->restartFrequency &&
517  ((timestep % simParams->restartFrequency) == 0) )
518  { velocitiesNeeded |= 2; }
519 
520  }
521 
522  // Output final velocities
523  if (timestep == FILE_OUTPUT || timestep == END_OF_RUN)
524  {
525  velocitiesNeeded |= 2;
526  }
527 
528  return velocitiesNeeded;
529 }
static Node * Object()
Definition: Node.h:86
#define FILE_OUTPUT
Definition: Output.h:25
SimParameters * simParameters
Definition: Node.h:181
#define END_OF_RUN
Definition: Output.h:26
#define simParams
Definition: Output.C:129

Friends And Related Function Documentation

◆ SimParameters

friend class SimParameters
friend

Definition at line 40 of file Output.h.


The documentation for this class was generated from the following files: