IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2026 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>
15#include <IMP/atom/Simulator.h>
16#include <deque>
17
18IMPNPCTRANSPORT_BEGIN_NAMESPACE
19
20class Statistics;
21
22/**
23 Maintains transport statistics about a particle p in a z-axis
24 aligned channel,
25 */
27 : public OptimizerState {
28 private:
29 typedef OptimizerState P;
30 Particle* p_; // the particle
31 Float bottom_z_, top_z_; // channel boundaries on z-axis
34 unsigned int n_transports_up_; // from bottom to top of channel
35 unsigned int n_transports_down_; // from top to bottom of channOBel
36 Floats transport_time_points_in_ns_; // simulation time points of each
37 // transport event
38 // MOVED NEXT LINE TO DECORATOR (TODO: perhaps also other stats)
39 // bool is_last_entry_from_top_; // last time p entered channel
40 // // was top or bottom
41 bool is_reset_;
42
43 Particle *get_particle() const { return p_; }
44
45 public:
46 /**
47 Initiates transport statistics about a particle p in a z-axis aligned
48 channel,
49 whose bottom and top are at z-coordinates bottom_z and top_z, respectively.
50
51 @param p the particle, assumed to be decorated as a RigidBody
52 @param bottom_z the z coordinate of the channel bottom
53 @param top_z the z coordinate of the channel top
54 @param statistics_manager Statistics object that can be
55 used to communicate back pertinent information from
56 this object, or nullptr if not managed
57 @param owner a simulator that is moving this particle and can provide it with time information, or nullptr
58 */
60 Particle *p, Float bottom_z, Float top_z,
61 WeakPointer<IMP::npctransport::Statistics> statistics_manager = nullptr,
62 WeakPointer<IMP::atom::Simulator> owner = nullptr);
63
64 //! sets a simulator that moves this particle and can provide simulation time
65 //! information about it, or IMP::nullptr if none
67 owner_ = owner;
68 }
69
70 //! returns the simulator that was declared in the constructor or by
71 //set_owner()
72 //! to moves this particle, and provide simulation time information about it.
73#ifdef SWIG
74 // Help out SWIG 4.1, which gets confused by the WeakPointer here
75 IMP::atom::Simulator* get_owner() const { return owner_; }
76#else
78#endif
79
80 /**
81 Returns the number of times the particle crossed the channel
82 from its bottom to its top
83 */
84 unsigned int get_n_transports_up() const { return n_transports_up_; }
85
86 /** Returns the number of times the particle crossed the channel
87 from its top to its bottom
88 */
89 unsigned int get_n_transports_down() const { return n_transports_down_; }
90
91 /** Returns the number of times the particle crossed the channel
92 from any one side to the other
93 */
94 unsigned int get_total_n_transports() const {
95 return n_transports_up_ + n_transports_down_;
96 }
97
98 /**
99 returns a list of all the simulation time points in nanoseconds
100 when a transport even has occurred (according to the owner of this
101 OptimizerState). An empty list is returned if no
102 transport events are known or if there was no owner when they occurred
103 */
105 return transport_time_points_in_ns_;
106 }
107
108 /** resets the number of transports statistics to 0 */
109 void reset() override;
110
111 virtual void do_update(unsigned int call_num) override;
113};
114
117
118IMPNPCTRANSPORT_END_NAMESPACE
119
120#endif /* IMPNPCTRANSPORT_PARTICLE_TRANSPORT_STATISTICS_OPTIMIZER_STATE_H */
Shared optimizer state.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Base class for "simulators", such as molecular dynamics.
OptimizerState(Model *m, std::string name)
Constructor.
Class to handle individual particles of a Model object.
Definition Particle.h:45
The base class for simulators.
Definition Simulator.h:36
virtual void do_update(unsigned int call_num) override
ParticleTransportStatisticsOptimizerState(Particle *p, Float bottom_z, Float top_z, WeakPointer< IMP::npctransport::Statistics > statistics_manager=nullptr, WeakPointer< IMP::atom::Simulator > owner=nullptr)
WeakPointer< IMP::atom::Simulator > get_owner() const
returns the simulator that was declared in the constructor or by
IMP::Vector< IMP::Pointer< ParticleTransportStatisticsOptimizerState > > ParticleTransportStatisticsOptimizerStates
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
Definition types.h:46
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Smart pointer to Object-derived classes that does not refcount.
Definition WeakPointer.h:78
description