Simpatico  v1.10
Configuration.h
1 #ifndef TOOLS_CONFIGURATION_H
2 #define TOOLS_CONFIGURATION_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/param/ParamComposite.h> // base class
12 
13 #include <tools/chemistry/Atom.h> // member (template argument)
14 #include <tools/chemistry/Group.h> // member (template argument)
15 #include <tools/chemistry/Species.h> // member (template argument)
16 #include <tools/storage/AtomStorage.h> // member
17 #include <tools/storage/GroupStorage.h> // member (template)
18 #include <simp/boundary/Boundary.h> // member
19 #include <util/containers/DArray.h> // member (template)
20 #include <util/containers/DSArray.h> // member (template)
21 #include <util/containers/ArrayIterator.h> // inline function
22 
23 
24 namespace Tools
25 {
26 
27  using namespace Util;
28  using namespace Simp;
29 
40  class Configuration : public ParamComposite
41  {
42 
43  public:
44 
50 
54  Configuration();
55 
59  ~Configuration();
60 
62 
66  void readParam(const char* filename);
67 
71  void readParameters(std::istream& in);
72 
76  void clear();
77 
78  // Accessors for members (non-const reference)
79 
83  Boundary& boundary();
84 
86  AtomStorage& atoms();
87 
88  #ifdef SIMP_BOND
89  GroupStorage<2>& bonds();
91  #endif
92 
93  #ifdef SIMP_ANGLE
94  GroupStorage<3>& angles();
96  #endif
97 
98  #ifdef SIMP_DIHEDRAL
99  GroupStorage<4>& dihedrals();
101 
103  GroupStorage<4>& impropers();
104  #endif
105 
111  int nSpecies() const;
112 
118  Species& species(int i);
119 
120  private:
121 
123  Boundary boundary_;
124 
126  AtomStorage atoms_;
127 
128  #ifdef SIMP_BOND
129  GroupStorage<2> bonds_;
131  #endif
132 
133  #ifdef SIMP_ANGLE
134  GroupStorage<3> angles_;
136  #endif
137 
138  #ifdef SIMP_DIHEDRAL
139  GroupStorage<4> dihedrals_;
141 
143  GroupStorage<4> impropers_;
144  #endif
145 
147  DArray<Species> species_;
148 
150  int atomCapacity_;
151 
152  #ifdef SIMP_BOND
153  int bondCapacity_;
155  #endif
156 
157  #ifdef SIMP_ANGLE
158  int angleCapacity_;
160  #endif
161 
162  #ifdef SIMP_DIHEDRAL
163  int dihedralCapacity_;
165 
167  int improperCapacity_;
168  #endif
169 
171  int nSpecies_;
172 
173  };
174 
175  // Inline functions
176 
177  /*
178  * Return the Boundary by reference.
179  */
181  { return boundary_; }
182 
184  { return atoms_; }
185 
186  #ifdef SIMP_BOND
188  { return bonds_; }
189  #endif
190 
191  #ifdef SIMP_ANGLE
193  { return angles_; }
194  #endif
195 
196  #ifdef SIMP_DIHEDRAL
198  { return dihedrals_; }
199 
201  { return impropers_; }
202  #endif
203 
204  inline int Configuration::nSpecies() const
205  { return nSpecies_; }
206 
208  { return species_[i]; }
209 
210 }
211 #endif
Container for a set of atoms.
An orthorhombic periodic unit cell.
Classes used by all simpatico molecular simulations.
AtomStorage & atoms()
Get the AtomStorage.
An instantaneous molecular dynamics configuration.
Definition: Configuration.h:40
int nSpecies() const
Number of species.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Forward iterator for an Array or a C array.
Definition: ArrayIterator.h:39
Single-processor classes for pre- and post-processing MD trajectories.
GroupStorage< 4 > & impropers()
Get the Improper dihedral storage.
Dynamically allocatable contiguous array template.
Definition: DArray.h:31
GroupStorage< 3 > & angles()
Get the Angle storage.
GroupStorage< 4 > & dihedrals()
Get the Dihedral storage.
virtual void readParam(std::istream &in)
Read the parameter file block.
Boundary & boundary()
Get the Boundary by non-const reference.
Species & species(int i)
Get a particular species identified by index.
An object that can read multiple parameters from file.
A Species represents a set of chemically similar molecules.
GroupStorage< 2 > & bonds()
Get the Bond storage.