10 #include <mcMd/simulation/Simulation.h> 11 #include <mcMd/simulation/System.h> 12 #include <mcMd/species/SpeciesMutator.h> 13 #include <mcMd/neighbor/CellList.h> 14 #include <simp/species/Species.h> 26 : speciesPtr_(&species),
27 simulationPtr_(&system.simulation()),
29 boundaryPtr_(&system.boundary())
31 , bondPotentialPtr_(0)
64 double di = diameters[atom.
typeId()];
67 int n = neighbors.
size();
68 for (
int j = 0; j < n; ++j) {
69 neighborPtr = neighbors[j];
71 dj = diameters[neighborPtr->
typeId()];
102 for (
int iMol = 0; iMol < nMolecule; ++iMol) {
112 while (!success && iAttempt < maxAttempt) {
114 diameters, cellList);
119 Log::file() <<
"Failed to insert Linear molecule " 141 double maxDiameter = 0.0;
142 for (
int iType = 0; iType < diameters.
capacity(); iType++) {
143 if (diameters[iType] > maxDiameter) {
144 maxDiameter = diameters[iType];
149 cellList.
setup(boundary, maxDiameter);
static void setupCellList(int atomCapacity, Boundary &boundary, const Array< double > &diameters, CellList &cellList)
Allocate any required memory for the cell list.
void setBondPotential(BondPotential &bondPotential)
Create an association with a BondPotential.
A Vector is a Cartesian vector.
void getNeighbors(const Vector &pos, NeighborArray &neighbors) const
Fill a NeighborArray with pointers to atoms near a specified position.
System & system()
Get the associated System by reference.
double distanceSq(const Vector &r1, const Vector &r2) const
Return square distance between positions r1 and r2.
const BondPotential & bondPotential()
Get the associated BondPotential by reference.
virtual bool attemptPlaceMolecule(Molecule &molecule, const Array< double > &diameters, CellList &cellList)=0
Attempt to insert an entire molecule (pure virtual).
An orthorhombic periodic unit cell.
int atomCapacity() const
Get the total number of Atoms allocated.
Generator(Species &species, System &system)
Constructor.
A set of interacting Molecules enclosed by a Boundary.
int atomCapacity() const
Get the maximum allowed atom index + 1.
File containing preprocessor macros for error handling.
Classes used by all simpatico molecular simulations.
Molecule & getMolecule(int speciesId)
Get a new molecule from a reservoir of unused Molecule objects.
virtual ~Generator()
Destructor.
const Species & species()
Get the associated Species by reference.
Simulation & simulation() const
Get the parent Simulation by reference.
void addMolecule(Molecule &molecule)
Add a Molecule to this System.
int typeId() const
Get type index for this Atom.
A point particle within a Molecule.
Utility classes for scientific computation.
const Boundary & boundary() const
Get the associated Boundary by reference.
void setup(const Boundary &boundary, double cutoff)
Setup grid of empty cells.
void shift(Vector &r) const
Shift Cartesian Vector r to its primary image.
virtual void setMoleculeState(Molecule &molecule, int stateId)=0
Change the state of a specific molecule.
Simulation & simulation()
Get the associated Simulation by reference.
A cell list for Atom objects in a periodic system boundary.
static std::ostream & file()
Get log ostream by reference.
int id() const
Get integer id of this Species.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
bool isMutable() const
Is this a mutable Species?
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Abstract Bond Potential class.
void setAtomCapacity(int atomCapacity)
Set atom capacity.
int capacity() const
Return allocated size.
virtual bool generate(int nMolecule, Array< double > const &diameters, CellList &cellList)
Generate nMolecule molecules of the associated Species.
A physical molecule (a set of covalently bonded Atoms).
void removeMolecule(Molecule &molecule)
Remove a specific molecule from this System.
const Vector & position() const
Get the position Vector by const reference.
McMd::SpeciesMutator & mutator()
Return the species mutator object by reference.
A Species represents a set of chemically similar molecules.
bool attemptPlaceAtom(Atom &atom, const Array< double > &diameters, CellList &cellList)
Attempt to place an atom.
Species & species(int i)
Get a specific Species by reference.
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.