Simpatico  v1.10
PointGenerator.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "PointGenerator.h"
9 #include <mcMd/simulation/Simulation.h>
10 #include <mcMd/simulation/System.h>
11 #include <simp/boundary/Boundary.h>
12 
13 namespace McMd
14 {
15 
16  class CellList;
17  using namespace Util;
18  using namespace Simp;
19 
21  : Generator(species, system)
22  {}
23 
24  /*
25  * Recursive function to try to place an atom.
26  */
27  bool
29  Array<double> const & diameters,
30  CellList& cellList)
31  {
32  Atom& atom = molecule.atom(0);
33  bool success = false;
34  int iAttempt = 0;
35  int maxAttempt = 1;
36  while (!success && iAttempt < maxAttempt) {
37  boundary().randomPosition(simulation().random(), atom.position());
38  success = attemptPlaceAtom(atom, diameters, cellList);
39  }
40  return success;
41  }
42 
43 }
void randomPosition(Random &random, Vector &r) const
Generate random position within the primary unit cell.
PointGenerator(Simp::Species &species, System &system)
Constructor.
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Classes used by all simpatico molecular simulations.
A point particle within a Molecule.
Utility classes for scientific computation.
Definition: accumulators.mod:1
const Boundary & boundary() const
Get the associated Boundary by reference.
Definition: Generator.h:202
Generates initial configurations for molecules of one species.
Definition: Generator.h:38
Simulation & simulation()
Get the associated Simulation by reference.
Definition: Generator.h:190
A cell list for Atom objects in a periodic system boundary.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
const Atom & atom(int localId) const
Get a specific Atom in this Molecule.
A physical molecule (a set of covalently bonded Atoms).
const Vector & position() const
Get the position Vector by const 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.
Definition: Generator.cpp:52
bool attemptPlaceMolecule(Molecule &molecule, Array< double > const &diameters, CellList &cellList)
Attempt to place an "molecule" (i.e., an atom).