1 #ifndef SLIPLINKER_END_CPP 2 #define SLIPLINKER_END_CPP 11 #include "SliplinkerEnd.h" 12 #include <mcMd/simulation/Simulation.h> 13 #include <mcMd/mcSimulation/McSystem.h> 14 #include <mcMd/links/LinkMaster.h> 15 #include <mcMd/potentials/pair/McPairPotential.h> 16 #include <mcMd/potentials/bond/BondPotential.h> 17 #include <mcMd/chemistry/Molecule.h> 18 #include <mcMd/chemistry/Atom.h> 19 #include <simp/boundary/Boundary.h> 20 #include <util/misc/FileMaster.h> 21 #include <util/space/Vector.h> 22 #include <util/space/Dimension.h> 43 read<double>(in,
"cutoff", cutoff_);
44 read<double>(in,
"mu", mu_);
45 read<int>(in,
"speciesId", speciesId_);
53 Atom *atom0Ptr, *atom1Ptr;
57 double prob, dRSq, mindRSq=cutoff_*cutoff_, rnd, norm;
58 int i, ntrials, j, nNeighbor, idLink, id0, id1;
63 double cdf[maxNeighbor], energy, sum;
64 int idneighbors[maxNeighbor];
67 for (i=0; i < ntrials; ++i){
70 if (
random().uniform(0.0, 1.0) > 0.5){
81 atom0Ptr = &molIPtr->
atom(iAtom0);
85 nNeighbor = neighbors_.
size();
91 for (j = 0; j < nNeighbor; ++j) {
92 atom1Ptr = neighbors_[j];
102 if (dRSq <= mindRSq) {
120 norm = 1.0/cdf[n0-1];
121 while (rnd > cdf[j]*norm ){
124 atom1Ptr = neighbors_[idneighbors[j]];
130 if (
random().uniform(0.0, 1.0) > 0.5){
145 if (
system().linkMaster().nLink() > 0){
153 atom0Ptr = &(linkPtr->
atom0());
154 atom1Ptr = &(linkPtr->
atom1());
156 atom0Ptr = &(linkPtr->
atom1());
157 atom1Ptr = &(linkPtr->
atom0());
167 if (iAtom0 == 0 || iAtom0 == mol0Ptr->
nAtom() - 1){
172 if (dRSq <= mindRSq) {
176 nNeighbor = neighbors_.
size();
177 id0 = atom0Ptr->
id();
181 for (j = 0; j < nNeighbor; ++j) {
182 atom1Ptr = neighbors_[j];
184 id1 = atom1Ptr->
id();
192 if (dRSq <= mindRSq) {
SliplinkerEnd(McSystem &system)
Constructor.
int nLink() const
Get the total number of active Links.
Molecule & molecule() const
Get the parent Molecule by reference.
A System for use in a Markov chain Monte Carlo simulation.
void removeLink(int id)
Remove a Link.
void incrementNAttempt()
Increment the number of attempted moves.
static const int MaxNeighbor
Maximum possible number of neighboring atoms.
void getNeighbors(const Vector &pos, NeighborArray &neighbors) const
Fill a NeighborArray with pointers to atoms near a specified position.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
virtual bool move()
Create or destroy slip-springs.
const CellList & cellList() const
Get the cellList by const reference.
Mask & mask()
Get the associated Mask by reference.
A Link represents a crosslink between two Atoms.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
double uniform()
Return a random floating point number x, uniformly distributed in the range 0 <= x < 1...
double boltzmann(double energy)
Boltzmann weight associated with an energy difference.
bool isMasked(const Atom &atom) const
True if the atom is in the masked set for the target Atom.
int nMolecule(int speciesId) const
Get the number of molecules of one Species in this System.
McSystem & system()
Get parent McSystem.
Molecule & randomMolecule(int speciesId)
Get a random Molecule of a specified species in this System.
void incrementNAccept()
Increment the number of accepted moves.
A point particle within a Molecule.
Utility classes for scientific computation.
An McMove that acts on one McSystem.
virtual void readParameters(std::istream &in)
Read cutoff and probability.
int id() const
Get global index for this Atom within the Simulation.
long uniformInt(long range1, long range2)
Return random long int x uniformly distributed in range1 <= x < range2.
Forward iterator for a PArray.
Random & random()
Get Random number generator of parent Simulation.
McPairPotential & pairPotential() const
Return the McPairPotential by reference.
virtual double energy(double rSq, int type) const =0
Returns potential energy for one bond.
Boundary & boundary() const
Get the Boundary by reference.
BondPotential & linkPotential() const
Return the McLinkPotential by reference.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
const Atom & atom1() const
Get Atom1 connected to a Link.
void readProbability(std::istream &in)
Read the probability from file.
void setClassName(const char *className)
Set class name string.
const Atom & atom(int localId) const
Get a specific Atom in this Molecule.
int indexInMolecule() const
Get local index for this Atom within the parent molecule;.
Link & link(int id) const
Return an active link by an internal set index.
Simulation & simulation()
Get parent Simulation object.
A physical molecule (a set of covalently bonded Atoms).
const Vector & position() const
Get the position Vector by const reference.
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).
const Atom & atom0() const
Get Atom0 connected to a Link.
int nAtom() const
Get the number of Atoms in this Molecule.
LinkMaster & linkMaster() const
Get the LinkMaster by reference.