MEDYAN  3.1
Software for simulating active matter dynamics
MotorGhost.h
Go to the documentation of this file.
1 
2 //------------------------------------------------------------------
3 // **MEDYAN** - Simulation Package for the Mechanochemical
4 // Dynamics of Active Networks, v3.1
5 //
6 // Copyright (2015-2016) Papoian Lab, University of Maryland
7 //
8 // ALL RIGHTS RESERVED
9 //
10 // See the MEDYAN web page for more information:
11 // http://www.medyan.org
12 //------------------------------------------------------------------
13 
14 #ifndef MEDYAN_MotorGhost_h
15 #define MEDYAN_MotorGhost_h
16 
17 #include "common.h"
18 
19 #include "Component.h"
20 #include "CMotorGhost.h"
21 #include "MMotorGhost.h"
22 
23 #include "Database.h"
24 #include "Histogram.h"
25 #include "Trackable.h"
26 #include "Movable.h"
27 #include "Reactable.h"
28 #include "RateChangerImpl.h"
29 
30 //FORWARD DECLARATIONS
31 class Cylinder;
32 class Controller;
33 class DRController;
34 class SubSystem;
35 
37 
47 class MotorGhost : public Component, public Trackable, public Movable, public Reactable {
48 
49 friend class Controller;
50 friend class DRController;
51 
52 friend class MotorBindingManager;
53 
54 friend struct UpdateMotorIDCallback;
55 friend struct MotorBindingCallback;
56 friend struct MotorUnbindingCallback;
57 
58 private:
59  unique_ptr<MMotorGhost> _mMotorGhost;
60  unique_ptr<CMotorGhost> _cMotorGhost;
61 
64 
65  double _position1;
66  double _position2;
67 
68  short _motorType;
69  int _motorID;
70 
71  float _birthTime;
72  float _walkLength = 0;
73 
75 
76  int _numHeads = 1;
77  double _numBoundHeads = 1;
78 
81  double _onRate = 0.0;
83  double _offRate = 0.0;
85 
87 
89  static Histogram* _lifetimes;
93 
95  static vector<MotorRateChanger*> _unbindingChangers;
97  static vector<MotorRateChanger*> _walkingChangers;
98 
99 public:
100  vector<double> coordinate;
102 
104  MotorGhost(Cylinder* c1, Cylinder* c2, short motorType,
105  double position1 = 0.5, double position2 = 0.5,
106  double onRate = 0.0, double offRate = 0.0);
107 
108  virtual ~MotorGhost() noexcept;
109 
111  void updateCoordinate();
112 
114  Cylinder* getFirstCylinder() {return _c1;}
118 
120  void setFirstCylinder(Cylinder* cylinder) {_c1 = cylinder;}
122  void setSecondCylinder(Cylinder* cylinder) {_c2 = cylinder;}
124 
126  void setCMotorGhost(CMotorGhost* cMotorGhost) {
127  _cMotorGhost = unique_ptr<CMotorGhost>(cMotorGhost);
128  }
130  CMotorGhost* getCMotorGhost() {return _cMotorGhost.get();}
131 
133  MMotorGhost* getMMotorGhost() {return _mMotorGhost.get();}
134 
136  double getFirstPosition() {return _position1;}
138  void setFirstPosition(double position1) {_position1 = position1;}
139 
140  double getSecondPosition() {return _position2;}
141  void setSecondPosition(double position2) {_position2 = position2;}
143 
145  virtual int getType() {return _motorType;}
147  int getID() {return _motorID;}
148 
149  void setID(int ID) {_motorID = ID;}
151 
153  float getBirthTime() {return _birthTime;}
154 
156  virtual void addToSubSystem() { _motorGhosts.addElement(this);}
158  virtual void removeFromSubSystem() {_motorGhosts.removeElement(this);}
160 
162  static const vector<MotorGhost*>& getMotorGhosts() {
163  return _motorGhosts.getElements();
164  }
166  static int numMotorGhosts() {
167  return _motorGhosts.countElements();
168  }
169 
171  static Histogram* getLifetimes() {return _lifetimes;}
172 
175 
178  virtual void updatePosition();
179 
181  virtual void updateReactionRates();
182 
185  void moveMotorHead(Cylinder* c, double oldPosition, double newPosition,
186  short boundType, SubSystem* ps);
187 
190  void moveMotorHead(Cylinder* oldC, Cylinder* newC,
191  double oldPosition, double newPosition,
192  short boundType, SubSystem* ps);
193 
194  virtual void printSelf();
195 
197  static species_copy_t countSpecies(const string& name);
198 };
199 
200 #endif
int _motorID
Integer ID of this motor, managed by Database.
Definition: MotorGhost.h:69
vector< T > & getElements()
Get all items in database.
Definition: Database.h:69
vector< double > coordinate
coordinate of midpoint, updated with updatePosition()
Definition: MotorGhost.h:100
static Histogram * getLifetimes()
Get the lifetimes.
Definition: MotorGhost.h:171
Used to initialize, manage, and run an entire simulation.
Definition: Controller.h:40
unsigned int species_copy_t
Species constants.
Definition: common.h:24
Cylinder * getSecondCylinder()
Get cylinder.
Definition: MotorGhost.h:116
A container to store a MMotorGhost and CMotorGhost.
Definition: MotorGhost.h:47
float _birthTime
Birth time.
Definition: MotorGhost.h:71
friend struct MotorBindingCallback
Definition: MotorGhost.h:55
MotorGhost(Cylinder *c1, Cylinder *c2, short motorType, double position1=0.5, double position2=0.5, double onRate=0.0, double offRate=0.0)
Standard constructor.
Definition: MotorGhost.cpp:44
virtual void updateReactionRates()
Update the reaction rates, inherited from Reactable.
Definition: MotorGhost.cpp:185
A container or holding Species and Reactions.
Definition: Compartment.h:49
int getID()
Parameter management.
Definition: MotorGhost.h:147
double _numBoundHeads
Number of bound heads in the ensemble, which is force-dependent.
Definition: MotorGhost.h:77
An abstract base class for a movable element in the SubSystem.
Definition: Movable.h:25
Represents a cross-link between Filaments that can move by way of chemical reactions.
Definition: MMotorGhost.h:38
A collection class to hold instances of a given class.
Definition: Database.h:38
An abstract base class for a trackable object in the SubSystem.
Definition: Trackable.h:33
void setFirstCylinder(Cylinder *cylinder)
Set cylinder.
Definition: MotorGhost.h:121
virtual size_t countSpecies() const
Return the number of Species contained under this node&#39;s hieararchy.
Definition: Component.h:122
A class to represent the chemical component of a MotorGhost.
Definition: CMotorGhost.h:36
unique_ptr< MMotorGhost > _mMotorGhost
Pointer to mech motor ghost.
Definition: MotorGhost.h:59
Cylinder * _c2
Second cylinder the motor is bound to.
Definition: MotorGhost.h:63
double getSecondPosition()
Position management function.
Definition: MotorGhost.h:140
A container to store a MCylinder and CCylinder.
Definition: Cylinder.h:50
An abstract base class for a reactable element in the SubSystem.
Definition: Reactable.h:25
double _position1
Position on first cylinder.
Definition: MotorGhost.h:65
friend struct UpdateMotorIDCallback
Definition: MotorGhost.h:54
virtual void removeFromSubSystem()
SubSystem management, inherited from Trackable.
Definition: MotorGhost.h:158
float getBirthTime()
Get the birth time.
Definition: MotorGhost.h:153
Used to initialize the dynamic rate components of a simulation.
Definition: DRController.h:30
Manager for MotorGhost binding.
Cylinder * getFirstCylinder()
Get cylinder.
Definition: MotorGhost.h:115
void setSecondCylinder(Cylinder *cylinder)
Set cylinder.
Definition: MotorGhost.h:122
friend struct MotorUnbindingCallback
Definition: MotorGhost.h:56
double _onRate
Kinetic rates of individual motor heads.
Definition: MotorGhost.h:82
void setID(int ID)
Parameter management.
Definition: MotorGhost.h:149
The base class for the Composite pattern hieararchy.
Definition: Component.h:37
static Database< MotorGhost * > _motorGhosts
Collection in SubSystem.
Definition: MotorGhost.h:86
Compartment * _compartment
Where this motorghost is.
Definition: MotorGhost.h:74
static vector< MotorRateChanger * > _unbindingChangers
For dynamic rate unbinding.
Definition: MotorGhost.h:95
static const vector< MotorGhost * > & getMotorGhosts()
Get all instances of this class from the SubSystem.
Definition: MotorGhost.h:162
Cylinder * _c1
First cylinder the motor is bound to.
Definition: MotorGhost.h:62
void removeElement(T elem)
Remove an element from the collection.
Definition: Database.h:58
virtual void addToSubSystem()
SubSystem management, inherited from Trackable.
Definition: MotorGhost.h:157
void setSecondPosition(double position2)
Position management function.
Definition: MotorGhost.h:141
double _position2
Position on second cylinder.
Definition: MotorGhost.h:66
double getFirstPosition()
Position management function.
Definition: MotorGhost.h:137
double _offRate
Kinetic rates of individual motor heads.
Definition: MotorGhost.h:83
virtual ~MotorGhost() noexcept
Definition: MotorGhost.cpp:99
virtual void printSelf()
Prints information about this node. Useful for debugging.
Definition: MotorGhost.cpp:355
A class to hold frequency of occurences in a general set of data.
Definition: Histogram.h:30
static int numMotorGhosts()
Get the number of motors in this system.
Definition: MotorGhost.h:166
MMotorGhost * getMMotorGhost()
Get mech motor ghost.
Definition: MotorGhost.h:133
short _motorType
Integer specifying the type of linker.
Definition: MotorGhost.h:68
void updateCoordinate()
Helper to get coordinate.
Definition: MotorGhost.cpp:30
float _walkLength
Walk length of ensemble.
Definition: MotorGhost.h:72
void setFirstPosition(double position1)
Position management function.
Definition: MotorGhost.h:138
static Histogram * getWalkLengths()
Get walk lengths.
Definition: MotorGhost.h:174
int countElements()
Count the number of objects in the collection.
Definition: Database.h:72
void addElement(T elem)
Add an element to the collection.
Definition: Database.h:52
int _numHeads
Number of heads that this motor contains.
Definition: MotorGhost.h:76
void moveMotorHead(Cylinder *c, double oldPosition, double newPosition, short boundType, SubSystem *ps)
Move a motor head forward.
Definition: MotorGhost.cpp:298
Manages all Movables and Reactables.
Definition: SubSystem.h:57
void setCMotorGhost(CMotorGhost *cMotorGhost)
Set chem motor ghost.
Definition: MotorGhost.h:126
unique_ptr< CMotorGhost > _cMotorGhost
Pointer to chem motor ghost.
Definition: MotorGhost.h:60
static Histogram * _lifetimes
Histogram data.
Definition: MotorGhost.h:90
virtual int getType()
Parameter management.
Definition: MotorGhost.h:146
static Histogram * _walkLengths
Histogram data.
Definition: MotorGhost.h:91
static vector< MotorRateChanger * > _walkingChangers
For dynamic rate walking.
Definition: MotorGhost.h:97
virtual void updatePosition()
Update the position, inherited from Movable.
Definition: MotorGhost.cpp:114
CMotorGhost * getCMotorGhost()
Get chem motor ghost.
Definition: MotorGhost.h:130