Simpatico  v1.10
MdPairEnergyCoefficients.h
1 #ifndef SIMP_NOPAIR
2 #ifndef MCMD_MD_PAIR_ENERGY_COEFFICIENTS_H
3 #define MCMD_MD_PAIR_ENERGY_COEFFICIENTS_H
4 
5 /*
6 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
7 *
8 * Copyright 2010 - 2017, The Regents of the University of Minnesota
9 * Distributed under the terms of the GNU General Public License.
10 */
11 
12 #include <mcMd/analyzers/SystemAnalyzer.h> // base class template
13 #include <mcMd/mdSimulation/MdSystem.h> // base template parameter
14 #include <mcMd/analyzers/util/PairSelector.h>
15 
16 #include <util/global.h>
17 #include <util/containers/Pair.h>
18 #include <util/containers/DSArray.h>
19 #include <util/accumulators/Average.h>
20 
21 namespace McMd
22 {
23 
24  using namespace Util;
25 
26  class MdPairPotential;
27  class PairList;
28 
38  class MdPairEnergyCoefficients : public SystemAnalyzer<MdSystem>
39  {
40 
41  public:
42 
45 
48 
57  virtual void readParameters(std::istream& in);
58 
64  virtual void loadParameters(Serializable::IArchive& ar);
65 
71  virtual void save(Serializable::OArchive& ar);
72 
79  template <class Archive>
80  void serialize(Archive& ar, const unsigned int version);
81 
83  virtual void sample(long iStep);
84 
86  virtual void output();
87 
88  private:
89 
91  PairSelector selector_;
92 
94  int nAtomType_;
95 
97  int nSpecies_;
98 
100  const PairList *pairListPtr_;
101 
103  MdPairPotential* pairPotentialPtr_;
104 
106  Boundary *boundaryPtr_;
107 
109  int maxMoleculeNeighbors_;
110 
112  DArray< DArray< DSArray< Pair< Atom *> > > > moleculeNeighbors_;
113 
116  DArray< DArray< double > > twoMoleculePairEnergy_;
117 
119  Average pairEnergyAccumulator_;
120 
122  Average moleculePESqAccumulator_;
123 
125  Average twoMoleculePESqAccumulator_;
126 
128  Average pESqAccumulator_;
129 
131  std::ofstream outputFile_;
132 
133  // Has readParam been called?
134  bool isInitialized_;
135 
136  /*
137  * Methods
138  */
139 
140  // Reset the internal molecules' neighbor list arrays
141  void clear();
142 
143  };
144 
145  /*
146  * Serialize to/from an archive.
147  */
148  template <class Archive>
149  void MdPairEnergyCoefficients::serialize(Archive& ar, const unsigned int version)
150  {
151  ar & pairEnergyAccumulator_;
152  ar & moleculePESqAccumulator_;
153  ar & twoMoleculePESqAccumulator_;
154  ar & pESqAccumulator_;
155  //DArray< DArray< DSArray< Pair< Atom *> > > > moleculeNeighbors_;
156  //DArray< DArray< double > > twoMoleculePairEnergy_;
157 
158  }
159 
160 }
161 #endif
162 #endif
Calculates the average and variance of a sampled property.
Definition: Average.h:43
An orthorhombic periodic unit cell.
A Verlet neighbor list.
Analyzer to output the total pair energy and the sum of squares of the monomeric and molecular pair e...
File containing preprocessor macros for error handling.
void serialize(Archive &ar, PairSelector &selector, const unsigned int version)
Serialize a PairSelector.
Definition: PairSelector.h:167
void serialize(Archive &ar, const unsigned int version)
Serialize to/from an archive.
Saving / output archive for binary ostream.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Selection rule for pairs of Atoms.
Definition: PairSelector.h:32
Template for Analyzer associated with one System.
An PairPotential for MD simulation.
Dynamically allocatable contiguous array template.
Definition: DArray.h:31
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A System for Molecular Dynamics simulation.
Definition: MdSystem.h:68