Simpatico  v1.10
ComMSD.h
1 #ifndef MCMD_COM_MSD_H
2 #define MCMD_COM_MSD_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 <mcMd/analyzers/SystemAnalyzer.h> // base class template
12 #include <mcMd/simulation/System.h> // base class template parameter
13 #include <util/accumulators/MeanSqDispArray.h> // member template
14 #include <util/space/Vector.h> // template parameter
15 #include <util/space/IntVector.h> // template parameter
16 #include <util/containers/DArray.h> // member template
17 
18 namespace Simp {
19  class Species;
20 }
21 
22 namespace McMd
23 {
24 
25  using namespace Util;
26  using namespace Simp;
27 
35  class ComMSD : public SystemAnalyzer<System>
36  {
37 
38  public:
39 
45  ComMSD(System &system);
46 
52  virtual void readParameters(std::istream& in);
53 
59  virtual void loadParameters(Serializable::IArchive& ar);
60 
66  virtual void save(Serializable::OArchive& ar);
67 
74  template <class Archive>
75  void serialize(Archive& ar, const unsigned int version);
76 
80  virtual void setup();
81 
87  virtual void sample(long iStep);
88 
92  virtual void output();
93 
94  private:
95 
101  void moleculeCom(int iMol, Vector &R0);
102 
104  std::ofstream outputFile_;
105 
107  MeanSqDispArray<Vector> accumulator_;
108 
110  DArray<Vector> truePositions_;
111 
113  DArray<Vector> oldPositions_;
114 
116  DArray<IntVector> shifts_;
117 
119  int speciesId_;
120 
122  int nMolecule_;
123 
125  int nAtom_;
126 
128  int capacity_;
129 
131  bool isInitialized_;
132 
133  };
134 
135  /*
136  * Serialize to/from an archive.
137  */
138  template <class Archive>
139  void ComMSD::serialize(Archive& ar, const unsigned int version)
140  {
141  Analyzer::serialize(ar, version);
142  ar & speciesId_;
143  ar & capacity_;
144  ar & nAtom_;
145  ar & accumulator_;
146  ar & truePositions_;
147  ar & oldPositions_;
148  ar & shifts_;
149  ar & nMolecule_;
150  }
151 
152 }
153 #endif
void serialize(Archive &ar, BoundaryEnsemble::Type &data, const unsigned int version)
Serialize a BoundaryEnsemble::Type enum value.
A Vector is a Cartesian vector.
Definition: Vector.h:75
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
Classes used by all simpatico molecular simulations.
Saving / output archive for binary ostream.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Mean-squared displacement (MSD) vs.
Template for Analyzer associated with one System.
Dynamically allocatable contiguous array template.
Definition: DArray.h:31
Saving archive for binary istream.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void serialize(Archive &ar, T &data, const unsigned int version)
Serialize one object of type T.
Definition: serialize.h:29
Molecular center of mass mean squared displacement.
Definition: ComMSD.h:35