1 #ifndef LINK_LT_POS_CPP 2 #define LINK_LT_POS_CPP 11 #include "LinkLTPos.h" 12 #include <mcMd/simulation/Simulation.h> 13 #include <mcMd/links/LinkMaster.h> 14 #include <mcMd/chemistry/Molecule.h> 15 #include <mcMd/chemistry/Atom.h> 16 #include <simp/species/Species.h> 17 #include <simp/boundary/Boundary.h> 18 #include <util/misc/FileMaster.h> 38 read<int>(in,
"linkCapacity", linkCapacity_);
40 read<double>(in,
"min", min_);
41 read<double>(in,
"max", max_);
42 read<int>(in,
"nBin", nBin_);
57 birthTimes_.
allocate(2*linkCapacity_, chLength);
60 accumulator_.allocate(chLength);
62 for (i=0; i<chLength; ++i) {
63 accumulator_[i].setParam(min_, max_, nBin_);
66 for (j=0; j<2*linkCapacity_; ++j) {
67 for (i=0; i<chLength; ++i) {
86 int btime0, btime1, dtime, ltime;
91 le = (
event.get()->tag())*2;
94 for (i=0; i<chLength; ++i){
95 btime0 = birthTimes_(le,i);
96 btime1 = birthTimes_(le1,i);
98 ltime = dtime - btime0;
99 birthTimes_(le,i) = -1;
100 accumulator_[i].sample((
double)ltime);
103 ltime = dtime - btime1;
104 birthTimes_(le1,i) = -1;
105 accumulator_[i].sample((
double)ltime);
113 int tag =
event.getLink()->tag();
114 int idAtom0 =
event.getLink()->atom0().indexInMolecule();
115 int idAtom1 =
event.getLink()->atom1().indexInMolecule();
116 int end =
event.getEndId();
121 if (birthTimes_(le,idAtom0)==-1) {
127 if (birthTimes_(le,idAtom1)==-1) {
146 for (i=0; i<chLength; ++i) {
147 accumulator_[i].output(outputFile_);
148 outputFile_ << std::endl;
virtual void output()
Output results to output file.
void allocate(int capacity1, int capacity2)
Allocate memory for a matrix.
int nAtom() const
Get number of atoms per molecule for this Species.
Event signalling the reset of an atom from the LinkMaster.
Link * get() const
Get pointer to newly added Link.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
LinkLTPos(System &system)
Constructor.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
End & readEnd(std::istream &in)
Add and read the closing bracket.
File containing preprocessor macros for error handling.
Event signalling removal of a Link from the LinkMaster.
Classes used by all simpatico molecular simulations.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
void sample(long iStep)
Don't do anything.
Simulation & simulation() const
Get the parent Simulation by reference.
virtual void writeParam(std::ostream &out)
Write all parameters to an output stream.
void readInterval(std::istream &in)
Read interval from file, with error checking.
Utility classes for scientific computation.
Event signalling addition of Link to the LinkMaster.
Template for Analyzer associated with one System.
virtual void setup()
Register Observer.
int iStep() const
Get value of step index for main MC or MD loop.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int tag() const
Get a permanent integer identifier for this object.
virtual void readParameters(std::istream &in)
Read parameters from file.
const Atom & atom1() const
Get Atom1 connected to a Link.
void setClassName(const char *className)
Set class name string.
int indexInMolecule() const
Get local index for this Atom within the parent molecule;.
Begin & readBegin(std::istream &in, const char *label, bool isRequired=true)
Add and read a class label and opening bracket.
FileMaster & fileMaster()
Get the FileMaster by reference.
const std::string & outputFileName() const
Return outputFileName string.
Species & species(int i)
Get a specific Species by reference.
const Atom & atom0() const
Get Atom0 connected to a Link.
LinkMaster & linkMaster() const
Get the LinkMaster by reference.