IMP logo
IMP Reference Guide  2.24.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-2026 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>
15 #include <deque>
16 
17 IMPNPCTRANSPORT_BEGIN_NAMESPACE
18 
19 /** Compute various statistics of a chain.*/
20 class IMPNPCTRANSPORTEXPORT ChainStatisticsOptimizerState
21  : public OptimizerState {
22  private:
23  typedef OptimizerState P;
24 
25  // particles in the chain:
26  ParticlesTemp ps_;
27 
28  // time series of the positions of particles in the chain:
29  std::deque<algebra::Vector3Ds> positions_;
30  std::deque<double> times_fs_;
31 
32  // mean radius-of-gyration and its square since last reset
33  double mean_rgyr_;
34  double mean_rgyr2_;
35 
36  // mean end-to-end length and its square since last reset
37  double mean_end_to_end_;
38  double mean_end_to_end2_;
39 
40  // mean bond distance and its square since last reset
41  double mean_bond_distance_;
42  double mean_bond_distance2_;
43 
44  // number of samples over which means are computed
45  int n_;
46 
47  double get_dt() const;
48 
49  public:
50  /**
51  @param ps the particles being wrapped
52  @param periodicity frame interval for statistics, equiv. to set_period(1)
53  */
55  ( const ParticlesTemp &ps,
56  unsigned int periodicity = 1);
57 
58  double get_correlation_time() const;
59 
60  //! returns a vector of diffusion coefficients
61  //! for each particle in the chain, computed in the local
62  //! reference frame of the chain (by locally aligning
63  //! the chain)
64  Floats get_local_diffusion_coefficients() const;
65 
66  //! get an estimate of the diffusion coefficient
67  //! of the entire chain in A^2/fs units
68  double get_diffusion_coefficient() const;
69 
70  //! returns the mean Rgyr of this chain
72  return mean_rgyr_;
73  }
74 
75  //! returns the mean Rgyr^2, which can be used to compute
76  //! std-dev (but recorded separately so it could be averaged with
77  //! other chains)
79  return mean_rgyr2_;
80  }
81 
82  //! returns the mean end-to-end distance of this chain
84  return mean_end_to_end_;
85  }
86 
87  //! returns the mean square end-to-end distance, which can be used to compute
88  //! std-dev (but recorded separately so it could be averaged with
89  //! other chains)
91  return mean_end_to_end2_;
92  }
93 
94  //! returns the mean bond distance of this chain
95  double get_mean_bond_distance() const{
96  return mean_bond_distance_;
97  }
98 
99  //! returns the mean square bond distance, which can be used to compute
100  //! std-dev (but recorded separately so it could be averaged with
101  //! other chains)
103  return mean_bond_distance2_;
104  }
105 
106  /**
107  Resets all the statistics about that chain
108  */
109  void reset() override;
110  virtual void do_update(unsigned int call_num) override;
112 };
114 
115 IMPNPCTRANSPORT_END_NAMESPACE
116 
117 #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
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)