IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
ChainStatisticsOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file npctransport/ChainStatisticsOptimizerState.h
3  * \brief description
4  *
5  * Copyright 2007-2022 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPNPCTRANSPORT_CHAIN_STATISTICS_OPTIMIZER_STATE_H
9 #define IMPNPCTRANSPORT_CHAIN_STATISTICS_OPTIMIZER_STATE_H
10 
11 #include "npctransport_config.h"
12 #include <IMP/Particle.h>
13 #include <IMP/OptimizerState.h>
14 //#include <IMP/optimizer_state_macros.h>
17 #include <deque>
18 
19 IMPNPCTRANSPORT_BEGIN_NAMESPACE
20 
21 /** Compute various statistics of a chain.*/
22 class IMPNPCTRANSPORTEXPORT ChainStatisticsOptimizerState
24  private:
26 
27  // particles in the chain:
28  ParticlesTemp ps_;
29 
30  // time series of the positions of particles in the chain:
31  std::deque<algebra::Vector3Ds> positions_;
32  std::deque<double> times_fs_;
33 
34  // mean radius-of-gyration and its square since last reset
35  double mean_rgyr_;
36  double mean_rgyr2_;
37 
38  // mean end-to-end length and its square since last reset
39  double mean_end_to_end_;
40  double mean_end_to_end2_;
41 
42  // mean bond distance and its square since last reset
43  double mean_bond_distance_;
44  double mean_bond_distance2_;
45 
46  // number of samples over which means are computed
47  int n_;
48 
49  double get_dt() const;
50 
51  public:
52  /**
53  @param ps the particles being wrapped
54  @param periodicity frame interval for statistics, equiv. to set_period(1)
55  */
57  ( const ParticlesTemp &ps,
58  unsigned int periodicity = 1);
59 
60  double get_correlation_time() const;
61 
62  //! returns a vector of diffusion coefficients
63  //! for each particle in the chain, computed in the local
64  //! reference frame of the chain (by locally aligning
65  //! the chain)
66  Floats get_local_diffusion_coefficients() const;
67 
68  //! get an estimate of the diffusion coefficient
69  //! of the entire chain in A^2/fs units
70  double get_diffusion_coefficient() const;
71 
72  //! returns the mean Rgyr of this chain
74  return mean_rgyr_;
75  }
76 
77  //! returns the mean Rgyr^2, which can be used to compute
78  //! std-dev (but recorded separately so it could be averaged with
79  //! other chains)
81  return mean_rgyr2_;
82  }
83 
84  //! returns the mean end-to-end distance of this chain
86  return mean_end_to_end_;
87  }
88 
89  //! returns the mean square end-to-end distance, which can be used to compute
90  //! std-dev (but recorded separately so it could be averaged with
91  //! other chains)
93  return mean_end_to_end2_;
94  }
95 
96  //! returns the mean bond distance of this chain
97  double get_mean_bond_distance() const{
98  return mean_bond_distance_;
99  }
100 
101  //! returns the mean square bond distance, which can be used to compute
102  //! std-dev (but recorded separately so it could be averaged with
103  //! other chains)
105  return mean_bond_distance2_;
106  }
107 
108  /**
109  Resets all the statistics about that chain
110  */
111  void reset() override;
112  virtual void do_update(unsigned int call_num) override;
114 };
116 
117 IMPNPCTRANSPORT_END_NAMESPACE
118 
119 #endif /* IMPNPCTRANSPORT_CHAIN_STATISTICS_OPTIMIZER_STATE_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Angle restraint between three particles.
virtual void do_update(unsigned int)
double get_mean_end_to_end_distance() const
returns the mean end-to-end distance of this chain
double get_mean_radius_of_gyration() const
returns the mean Rgyr of this chain
double get_mean_bond_distance() const
returns the mean bond distance of this chain
virtual void reset()
Reset counters, as if at the start of an optimize run.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
Definition: object_macros.h:44
Shared optimizer state that is invoked upon commitment of new coordinates.
description
Shared optimizer state.
double get_diffusion_coefficient(const algebra::Vector3Ds &displacements, double dt)