Simpatico  v1.10
tools/chemistry/Molecule.h
1 #ifndef TOOLS_MOLECULE_H
2 #define TOOLS_MOLECULE_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <util/space/Vector.h> // members
12 #include <util/global.h> // error handling
13 
14 namespace Tools
15 {
16 
17  using namespace Util;
18 
19  struct Atom;
20  class Species;
21 
32  class Molecule
33  {
34  public:
35 
39  Molecule();
40 
44  Species& species() const;
45 
49  int id() const;
50 
56  Atom& atom(int id) const;
57 
61  bool isActive() const;
62 
63  private:
64 
71  Atom** atoms_;
72 
76  Species* speciesPtr_;
77 
81  int id_;
82 
86  int nAtom_;
87 
88  //friends:
89 
90  friend class Species;
91 
92  };
93 
94  // Inline functions
95 
96  inline Species& Molecule::species() const
97  {
98  assert(speciesPtr_);
99  return *speciesPtr_;
100  }
101 
102  inline int Molecule::id() const
103  { return id_; }
104 
105  inline Atom& Molecule::atom(int id) const
106  {
107  assert(id >= 0);
108  assert(id < nAtom_);
109  assert(atoms_[id]);
110  return *(atoms_[id]);
111  }
112 
113  inline bool Molecule::isActive() const
114  { return (bool)nAtom_; }
115 
116 }
117 #endif
int id() const
Return id of this Molecule within its species.
bool isActive() const
Is this molecule active?
Species & species() const
Return parent Species by reference.
File containing preprocessor macros for error handling.
Atom & atom(int id) const
Return Atom identified by index.
Utility classes for scientific computation.
Definition: accumulators.mod:1
An Molecule has a sequence of atoms, and belongs to an Species.
Single-processor classes for pre- and post-processing MD trajectories.
A point particle in an MD simulation.
A Species represents a set of chemically similar molecules.