IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
ParticleFactory.h
Go to the documentation of this file.
1 /**
2  * \file ParticleFactory.h
3  * \brief description
4  *
5  * Copyright 2007-2020 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPNPCTRANSPORT_PARTICLE_FACTORY_H
9 #define IMPNPCTRANSPORT_PARTICLE_FACTORY_H
10 
11 #include "npctransport_config.h"
12 #include "SimulationData.h"
13 #include <IMP/WeakPointer.h>
14 #include <IMP/core/Typed.h>
15 #include <IMP/display/Color.h>
16 
17 #include <string>
18 
19 IMPNPCTRANSPORT_BEGIN_NAMESPACE
20 
21 
22 //! Factory that produces diffusing particles with specified attributes
23 class IMPNPCTRANSPORTEXPORT ParticleFactory : public IMP::Object {
24  public:
25  /** The simulation data whose model is associated with new particle
26  */
28 
29  /** particle radius (A) */
30  double radius_;
31 
32  /** diffusion factor */
33  double D_factor_;
34 
35  /** angular diffusion factor */
37 
38  /** particle color */
40 
41  /** particle type */
43 
44  public:
45  /**
46  construct a factory that produces diffusing particles with specified attributes,
47  with a default mass of 1.0
48 
49  @param sd the simulation data whose model is associated with new particles
50  - particles are decorated with a simulation data attribute to mark their owner
51  @param radius particle radius (A)
52  @param D_factor diffusion factor (relative to that auto-calculated
53  from radius). If 0.0, no diffusion or angular diffusion
54  is set up.
55  @param angular_D_factor angular diffusion factor (relative to that
56  auto-calculated from radius times D_factor). If
57  non-positive, do not setup angular rigid
58  body diffusion (still set up Diffusion if
59  D_factor>0.0)
60  @param color color for new particles
61  @param type the type of new particles
62  @param name object name
63  */
65  double radius,
66  double D_factor,
67  double angular_D_factor,
68  display::Color color,
69  core::ParticleType type,
70  std::string name = "Particle factory %1%")
71  :
72  IMP::Object(name),
73  sd_(sd),
74  radius_(radius),
75  D_factor_(D_factor),
76  angular_D_factor_(angular_D_factor),
77  color_(color),
78  type_(type)
79  {}
80 
81  /**
82  create a particle as specified during construction.
83  The particle is decorated with XYZR, RigidBodyDiffusion,
84  Color and Typed decorator. In addition, a simulation data
85  key is added to it pointing to this->sd_
86 
87  @param name - name of particle. If empty, the return value of
88  this->type_.get_string() is used
89  */
90  IMP::Particle* create(std::string name="");
91 
92  //! return model associated with this factory
94  return sd_->get_model();
95  }
96 
97  //! return SimulationData object associated with this factory
99  return sd_;
100  }
101 
102  //! return radius of generated particles
103  double get_radius() const { return radius_; }
104 
105 
107 };
108 
109 
110 IMPNPCTRANSPORT_END_NAMESPACE
111 
112 #endif /* IMPNPCTRANSPORT_PARTICLE_FACTORY_H */
Represent an RGB color.
Definition: Color.h:24
Factory that produces diffusing particles with specified attributes.
ParticleFactory(SimulationData *sd, double radius, double D_factor, double angular_D_factor, display::Color color, core::ParticleType type, std::string name="Particle factory %1%")
Smart pointer to Object-derived classes that does not refcount.
Definition: WeakPointer.h:76
double get_radius() const
return radius of generated particles
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A particle with a user-defined type.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Common base class for heavy weight IMP objects.
Definition: Object.h:106
A nullptr-initialized pointer to an Object.
Represent a color.
Store all parameters for a simulation.
description
SimulationData * get_simulation_data()
return SimulationData object associated with this factory
IMP::WeakPointer< SimulationData > sd_
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Model * get_model()
return model associated with this factory