Simpatico  v1.10
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
McMd::Generator Class Referenceabstract

Detailed Description

Generates initial configurations for molecules of one species.

Definition at line 38 of file Generator.h.

#include <Generator.h>

Inheritance diagram for McMd::Generator:
McMd::LinearGenerator McMd::PointGenerator

Public Member Functions

 Generator (Species &species, System &system)
 Constructor. More...
 
virtual ~Generator ()
 Destructor. More...
 
void setBondPotential (BondPotential &bondPotential)
 Create an association with a BondPotential. More...
 
virtual bool generate (int nMolecule, Array< double > const &diameters, CellList &cellList)
 Generate nMolecule molecules of the associated Species. More...
 

Static Public Member Functions

static void setupCellList (int atomCapacity, Boundary &boundary, const Array< double > &diameters, CellList &cellList)
 Allocate any required memory for the cell list. More...
 

Protected Member Functions

bool attemptPlaceAtom (Atom &atom, const Array< double > &diameters, CellList &cellList)
 Attempt to place an atom. More...
 
virtual bool attemptPlaceMolecule (Molecule &molecule, const Array< double > &diameters, CellList &cellList)=0
 Attempt to insert an entire molecule (pure virtual). More...
 
const Speciesspecies ()
 Get the associated Species by reference. More...
 
Simulationsimulation ()
 Get the associated Simulation by reference. More...
 
Systemsystem ()
 Get the associated System by reference. More...
 
const Boundaryboundary () const
 Get the associated Boundary by reference. More...
 
const BondPotentialbondPotential ()
 Get the associated BondPotential by reference. More...
 

Constructor & Destructor Documentation

McMd::Generator::Generator ( Species species,
System system 
)

Constructor.

Parameters
speciesassociated Species object
systemparent System

Definition at line 25 of file Generator.cpp.

McMd::Generator::~Generator ( )
virtual

Destructor.

Definition at line 38 of file Generator.cpp.

Member Function Documentation

void McMd::Generator::setBondPotential ( BondPotential bondPotential)

Create an association with a BondPotential.

Parameters
bondPotentialBondPotential

Definition at line 45 of file Generator.cpp.

References bondPotential().

Referenced by McMd::generatorFactory().

bool McMd::Generator::generate ( int  nMolecule,
Array< double > const &  diameters,
CellList cellList 
)
virtual

Generate nMolecule molecules of the associated Species.

Precondition
Size of diameters array == number of atom types
Parameters
nMoleculedesired number of molecules
diametersarray of excluded volume diameters for atomTypes
cellListCellList object

Definition at line 87 of file Generator.cpp.

References McMd::System::addMolecule(), McMd::CellList::atomCapacity(), McMd::Simulation::atomCapacity(), attemptPlaceMolecule(), Util::Log::file(), McMd::Simulation::getMolecule(), Simp::Species::id(), Simp::Species::isMutable(), Simp::Species::mutator(), McMd::System::removeMolecule(), McMd::SpeciesMutator::setMoleculeState(), simulation(), McMd::System::simulation(), species(), McMd::Simulation::species(), system(), and UTIL_CHECK.

Referenced by McMd::McSystem::generateMolecules(), and McMd::MdSystem::generateMolecules().

void McMd::Generator::setupCellList ( int  atomCapacity,
Boundary boundary,
const Array< double > &  diameters,
CellList cellList 
)
static

Allocate any required memory for the cell list.

Parameters
atomCapacitymaximum allowed atom id + 1
boundaryBoundary object, periodic unit cell
diametersarray of excluded volume diameters
cellListCellList to be allocated

Definition at line 131 of file Generator.cpp.

References Util::Array< Data >::capacity(), McMd::CellList::setAtomCapacity(), and McMd::CellList::setup().

Referenced by McMd::McSystem::generateMolecules(), and McMd::MdSystem::generateMolecules().

bool McMd::Generator::attemptPlaceAtom ( Atom atom,
const Array< double > &  diameters,
CellList cellList 
)
protected

Attempt to place an atom.

The proposed position for the atom should be set upon entry. This function checks if the atom position is within the hard-core cutoff distance of any atoms that are already in the cell list. The cutoff distance for atoms of types i and j is the average of the excluded volume diameters for types i and j. If the atom position satisfies this geometrical constraint, the atom is added to the cell list and returns true. If it does not, the function returns false.

Parameters
atomnew Atom, with proposed position already set
diametersarray of excluded diameters for atom types
cellListCellList object containing existing atoms
Returns
true on success, false on failure.

Definition at line 52 of file Generator.cpp.

References McMd::CellList::addAtom(), boundary(), Simp::OrthorhombicBoundary::distanceSq(), McMd::CellList::getNeighbors(), McMd::Atom::position(), Simp::OrthorhombicBoundary::shift(), Util::FSArray< Data, Capacity >::size(), and McMd::Atom::typeId().

Referenced by McMd::PointGenerator::attemptPlaceMolecule(), and McMd::LinearGenerator::attemptPlaceMolecule().

virtual bool McMd::Generator::attemptPlaceMolecule ( Molecule molecule,
const Array< double > &  diameters,
CellList cellList 
)
protectedpure virtual

Attempt to insert an entire molecule (pure virtual).

Parameters
moleculenew molecule, with unknown atomic positions
diametersarray of excluded volume diameters for types
cellListCellList object storing existing atoms
Returns
true on success, false on failure.

Referenced by generate().

const Species & McMd::Generator::species ( )
inlineprotected

Get the associated Species by reference.

Definition at line 184 of file Generator.h.

Referenced by McMd::LinearGenerator::attemptPlaceMolecule(), and generate().

Simulation & McMd::Generator::simulation ( )
inlineprotected

Get the associated Simulation by reference.

Definition at line 190 of file Generator.h.

Referenced by McMd::PointGenerator::attemptPlaceMolecule(), McMd::LinearGenerator::attemptPlaceMolecule(), and generate().

System & McMd::Generator::system ( )
inlineprotected

Get the associated System by reference.

Definition at line 196 of file Generator.h.

Referenced by generate().

const Boundary & McMd::Generator::boundary ( ) const
inlineprotected

Get the associated Boundary by reference.

Definition at line 202 of file Generator.h.

Referenced by attemptPlaceAtom(), McMd::PointGenerator::attemptPlaceMolecule(), and McMd::LinearGenerator::attemptPlaceMolecule().

const BondPotential & McMd::Generator::bondPotential ( )
inlineprotected

Get the associated BondPotential by reference.

Definition at line 209 of file Generator.h.

Referenced by McMd::LinearGenerator::attemptPlaceMolecule(), and setBondPotential().


The documentation for this class was generated from the following files: