IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
ParticleTransportStatisticsOptimizerState.h
Go to the documentation of this file.
1 /**
2  * \file npctransport/ParticleTransportStatisticsOptimizerState.h
3  * \brief description
4  *
5  * Copyright 2007-2020 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPNPCTRANSPORT_PARTICLE_TRANSPORT_STATISTICS_OPTIMIZER_STATE_H
9 #define IMPNPCTRANSPORT_PARTICLE_TRANSPORT_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 <IMP/atom/Simulator.h>
18 #include <deque>
19 
20 IMPNPCTRANSPORT_BEGIN_NAMESPACE
21 
22 class Statistics;
23 
24 /**
25  Maintains transport statistics about a particle p in a z-axis
26  aligned channel,
27  */
28 class IMPNPCTRANSPORTEXPORT ParticleTransportStatisticsOptimizerState
30  private:
32  Particle* p_; // the particle
33  Float bottom_z_, top_z_; // channel boundaries on z-axis
36  unsigned int n_transports_up_; // from bottom to top of channel
37  unsigned int n_transports_down_; // from top to bottom of channOBel
38  Floats transport_time_points_in_ns_; // simulation time points of each
39  // transport event
40  // MOVED NEXT LINE TO DECORATOR (TODO: perhaps also other stats)
41  // bool is_last_entry_from_top_; // last time p entered channel
42  // // was top or bottom
43  bool is_reset_;
44 
45  Particle *get_particle() const { return p_; }
46 
47  public:
48  /**
49  Initiates transport statistics about a particle p in a z-axis aligned
50  channel,
51  whose bottom and top are at z-coordinates bottom_z and top_z, respectively.
52 
53  @param p the particle, assumed to be decorated as a RigidBody
54  @param bottom_z the z coordinate of the channel bottom
55  @param top_z the z coordinate of the channel top
56  @param statistics_manager Statistics object that can be
57  used to communicate back pertinent information from
58  this object, or nullptr if not managed
59  @param owner a simulator that is moving this particle and can provide it with time information, or nullptr
60  */
62  Particle *p, Float bottom_z, Float top_z,
63  WeakPointer<IMP::npctransport::Statistics> statistics_manager = nullptr,
64  WeakPointer<IMP::atom::Simulator> owner = nullptr);
65 
66  //! sets a simulator that moves this particle and can provide simulation time
67  //! information about it, or IMP::nullptr if none
69  owner_ = owner;
70  }
71 
72  //! returns the simulator that was declared in the constructor or by
73  //set_owner()
74  //! to moves this particle, and provide simulation time information about it.
75  WeakPointer<IMP::atom::Simulator> get_owner() const { return owner_; }
76 
77  /**
78  Returns the number of times the particle crossed the channel
79  from its bottom to its top
80  */
81  unsigned int get_n_transports_up() const { return n_transports_up_; }
82 
83  /** Returns the number of times the particle crossed the channel
84  from its top to its bottom
85  */
86  unsigned int get_n_transports_down() const { return n_transports_down_; }
87 
88  /** Returns the number of times the particle crossed the channel
89  from any one side to the other
90  */
91  unsigned int get_total_n_transports() const {
92  return n_transports_up_ + n_transports_down_;
93  }
94 
95  /**
96  returns a list of all the simulation time points in nanoseconds
97  when a transport even has occurred (according to the owner of this
98  OptimizerState). An empty list is returned if no
99  transport events are known or if there was no owner when they occurred
100  */
102  return transport_time_points_in_ns_;
103  }
104 
105  /** resets the number of transports statistics to 0 */
106  void reset();
107 
108  virtual void do_update(unsigned int call_num) IMP_OVERRIDE;
110 };
111 
114 
115 IMPNPCTRANSPORT_END_NAMESPACE
116 
117 #endif /* IMPNPCTRANSPORT_PARTICLE_TRANSPORT_STATISTICS_OPTIMIZER_STATE_H */
WeakPointer< IMP::atom::Simulator > get_owner() const
returns the simulator that was declared in the constructor or by
Smart pointer to Object-derived classes that does not refcount.
Definition: WeakPointer.h:76
#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)
virtual void reset()
Reset counters, as if at the start of an optimize run.
Simple molecular dynamics optimizer.
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.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:20
description
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Shared optimizer state.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.