1 #ifndef CROSSLINKER_CPP 2 #define CROSSLINKER_CPP 11 #include "Crosslinker.h" 12 #include <util/format/Dbl.h> 13 #include <util/format/Int.h> 14 #include <util/misc/FileMaster.h> 15 #include <mcMd/simulation/Simulation.h> 16 #include <mcMd/links/LinkMaster.h> 37 read<double>(in,
"cutoff", cutoff_);
38 read<double>(in,
"probability", probability_);
62 for (
int ia=0; ia < molIter->nAtom(); ++ia) {
63 atomPtr = &molIter->atom(ia);
73 Atom *iAtomPtr, *jAtomPtr;
74 double dRSq, cutoffSq=cutoff_*cutoff_;
75 int nCellNeighbor, nCellAtom, totCells;
76 int ic, ip, iAtomId, jp, jAtomId;
79 for (ic = 0; ic < totCells; ++ic) {
84 nCellNeighbor = cellNeighbor.
size();
86 for (ip = 0; ip < nCellAtom; ++ip) {
87 iAtomPtr = cellNeighbor[ip];
89 iAtomId = iAtomPtr->
id();
91 for (jp = 0; jp < nCellNeighbor; ++jp) {
92 jAtomPtr = cellNeighbor[jp];
94 jAtomId = jAtomPtr->
id();
96 if ( jAtomId > iAtomId ) {
101 if (dRSq < cutoffSq) {
102 if(
system().simulation().random().uniform(0.0, 1.0) < probability_){
114 std::stringstream ss;
115 std::string nSampleString;
117 nSampleString = ss.str();
120 std::string filename;
122 filename += nSampleString;
A Vector is a Cartesian vector.
void begin(int speciesId, MoleculeIterator &iterator)
Initialize an iterator for molecules of one species in this System.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
void openOutputFile(const std::string &filename, std::ofstream &out, std::ios_base::openmode mode=std::ios_base::out) const
Open an output file.
Mask & mask()
Get the associated Mask by reference.
A set of interacting Molecules enclosed by a Boundary.
System & system()
Return reference to parent system.
void setup()
Complete any required initialization.
void readOutputFileName(std::istream &in)
Read outputFileName from file.
void clear()
Sets all Cell objects to empty state (no Atoms).
bool isMasked(const Atom &atom) const
True if the atom is in the masked set for the target Atom.
virtual void readParameters(std::istream &in)
Read output file and nStepPerSample.
Simulation & simulation() const
Get the parent Simulation by reference.
void getCellNeighbors(int ic, NeighborArray &neighbors, int &nInCell) const
Fill an array with pointers to atoms in a cell and neighboring cells.
void readInterval(std::istream &in)
Read interval from file, with error checking.
A point particle within a Molecule.
bool notEnd() const
Is the current pointer not at the end of the PArray?
Utility classes for scientific computation.
void clear()
Clear LinkMaster.
void setup(const Boundary &boundary, double cutoff)
Setup grid of empty cells.
int id() const
Get global index for this Atom within the Simulation.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
int totCells() const
Get total number of cells in this CellList.
Forward iterator for a PArray.
Template for Analyzer associated with one System.
Boundary & boundary() const
Get the Boundary by reference.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
int nSpecies() const
Get the number of Species in this Simulation.
void sample(long iStep)
Create crosslinks and dump configuration to file.
Crosslinker(System &system)
Constructor.
void setClassName(const char *className)
Set class name string.
FileMaster & fileMaster()
Get the FileMaster by reference.
void setAtomCapacity(int atomCapacity)
Set atom capacity.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.
const std::string & outputFileName() const
Return outputFileName string.
const Vector & position() const
Get the position Vector by const reference.
void writeConfig(std::ostream &out)
Write system configuration to a specified ostream.
void addLink(Atom &atom0, Atom &atom1, int typeId)
Add a link betwen two specific Atoms.
int size() const
Return logical size of this array (i.e., number of elements).
void addAtom(Atom &atom)
Add a Atom to the appropriate cell, based on its position.
LinkMaster & linkMaster() const
Get the LinkMaster by reference.