Simpatico  v1.10
LinkLifeTime.h
1 #ifndef LINK_LIFE_TIME_H
2 #define LINK_LIFE_TIME_H
3 
4 /*
5 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
6 *
7 * Copyright 2010 - 2014, 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/Distribution.h>
14 #include <util/containers/DArray.h>
15 #include <mcMd/links/LinkMaster.h>
16 #include <mcMd/links/LinkEvents.h>
17 #include <util/misc/Observer.h>
18 #include <util/global.h>
19 
20 namespace McMd
21 {
22 
23  using namespace Util;
24 
30  class LinkLifeTime : public SystemAnalyzer<System>,
31  public Observer<LinkAddEvent>,
32  public Observer<LinkRemoveEvent>
33 
34  {
35 
36  public:
37 
43  LinkLifeTime(System &system);
44 
50  virtual void readParameters(std::istream& in);
51 
55  virtual void setup();
56 
62  void sample(long iStep);
63 
64  virtual void update(const LinkAddEvent& event);
65 
66  virtual void update(const LinkRemoveEvent& event);
67 
71  virtual void output();
72 
73  private:
74 
75  // Output file stream
76  std::ofstream outputFile_;
77 
78  // Distribution statistical accumulator
79  Distribution accumulator_;
80 
81  // Dinamic array of creation times for each link
82  DArray<int> birthTimes_;
83 
84  // Allocated dimension for birthTimes_ array, same as links_ container.
85  int linkCapacity_;
86 
87  };
88 
89 }
90 #endif
Abstract class template for observer in the observer design pattern.
Definition: Notifier.h:19
A set of interacting Molecules enclosed by a Boundary.
Definition: System.h:115
File containing preprocessor macros for error handling.
Event signalling removal of a Link from the LinkMaster.
Definition: LinkEvents.h:78
LinkLifeTime evaluates how long the slip-springs live.
Definition: LinkLifeTime.h:30
Utility classes for scientific computation.
Definition: accumulators.mod:1
Event signalling addition of Link to the LinkMaster.
Definition: LinkEvents.h:20
Template for Analyzer associated with one System.
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
A distribution (or histogram) of values for a real variable.
Definition: Distribution.h:23