1 #ifndef SLIPLINKER_ALL_CPP 2 #define SLIPLINKER_ALL_CPP 11 #include "SliplinkerAll.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_);
56 Atom *atom0Ptr, *atom1Ptr;
60 double prob, dRSq, mindRSq=cutoff_*cutoff_, rnd, norm;
61 int i, ntrials, j, nNeighbor, idLink, iAtom, id1, id0;
66 double cdf[maxNeighbor], energy, sum;
67 int idneighbors[maxNeighbor];
71 for (i=0; i < ntrials; ++i){
74 if (
random().uniform(0.0, 1.0) > 0.5){
81 atomPtr = &molIPtr->
atom(iAtom);
86 nNeighbor = neighbors_.
size();
91 for (j = 0; j < nNeighbor; ++j) {
92 atom1Ptr = neighbors_[j];
103 if (dRSq <= mindRSq) {
119 norm = 1.0/cdf[n0-1];
120 while (rnd > cdf[j]*norm ){
123 atom1Ptr = neighbors_[idneighbors[j]];
138 if (
system().linkMaster().nLink() > 0){
143 atom0Ptr = &(linkPtr->
atom0());
147 atom1Ptr = &(linkPtr->
atom1());
155 if (dRSq <= mindRSq) {
158 nNeighbor = neighbors_.
size();
159 id0 = atom0Ptr->
id();
163 for (j = 0; j < nNeighbor; ++j) {
164 atom1Ptr = neighbors_[j];
167 id1 = atom1Ptr->
id();
175 if (dRSq <= mindRSq) {
int nLink() const
Get the total number of active Links.
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.
const CellList & cellList() const
Get the cellList by const reference.
int atomCapacity() const
Get the total number of Atoms allocated.
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.
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.
Simulation & simulation() const
Get the parent Simulation by reference.
virtual bool move()
Create or destroy slip-springs.
A point particle within a Molecule.
Utility classes for scientific computation.
SliplinkerAll(McSystem &system)
Constructor.
An McMove that acts on one McSystem.
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 an Array or a C array.
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.
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.
virtual void readParameters(std::istream &in)
Read cutoff and probability.