IMP logo
IMP Reference Guide  2.11.0
The Integrative Modeling Platform
SlabWithToroidalPore.h
Go to the documentation of this file.
1 /**
2  * \file IMP/npctransport/SlabWithToroidalPore.h
3  * \brief A decorator for a particle that's a slab with a toroidal pore.
4  *
5  * Copyright 2007-2019 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPNPCTRANSPORT_SLAB_WITH_TOROIDAL_PORE_H
10 #define IMPNPCTRANSPORT_SLAB_WITH_TOROIDAL_PORE_H
11 
12 #include "npctransport_config.h"
13 #include "SlabWithPore.h"
14 #include <IMP/Decorator.h>
15 #include <IMP/decorator_macros.h>
16 
17 IMPNPCTRANSPORT_BEGIN_NAMESPACE
18 
19 //! A decorator for a particle that represents a slab containing
20 //! a toroidal pore
21 /** \ingroup helper
22  \ingroup decorators
23  */
24 class IMPNPCTRANSPORTEXPORT SlabWithToroidalPore
25 : public SlabWithPore
26 {
27  /** Decorate a particle that represents a slab (e.g. nuclear
28  envelope) with specified thickness and a toroidal pore of
29  specified major radius and thickness/2.0 minor radius.
30  Note that the radius is controlled by set_pore_radius()
31  as any other XYZR particle, but the XYZ coordinates are ignored for now
32  (assumed to be 0,0,0).
33 
34  The slab is parallel to the x,y plain from z=-0.5*thickness to
35  z=0.5*thickness, and the central axis of the pore lies on the
36  origin.
37 
38  @param m the model
39  @param pi the particle index
40  @param thickness slab thickness, also twice the minor_radius
41  @param major_radius pore major radius
42  */
43  static void do_setup_particle(IMP::Model* m,
44  ParticleIndex pi,
45  double thickness,
46  double major_radius,
47  double minor_radius_h2v_aspect_ratio=1.0);
48 
49 
50  public:
52 
53 
54  /** Decorate a particle that represents a slab (e.g. nuclear
55  envelope) with specified thickness and a toroidal pore of
56  specified major radius and minor radius of 0.5*thickness,
57  with equal horizontal and vertical minor radii.
58 
59  The slab is parallel to the x,y plain from z=-0.5*thickness to
60  z=0.5*thickness, and the central axis of the pore lies on the
61  origin.
62 
63  @param m the model
64  @param pi the particle index
65  @param thickness slab thickness, also twice the minor radius
66  @param major_radius pore major radius
67  */
69  double, thickness,
70  double, major_radius);
71 
72  /** Decorate a particle that represents a slab (e.g. nuclear
73  envelope) with specified thickness and a toroidal pore of
74  specified major radius and minor radius of 0.5*thickness,
75  and specified ratio between horizontal and vertical minor
76  radii.
77 
78  The slab is parallel to the x,y plain from z=-0.5*thickness to
79  z=0.5*thickness, and the central axis of the pore lies on the
80  origin.
81 
82  @param m the model
83  @param pi the particle index
84  @param thickness slab thickness, also twice the vertical
85  minor radius
86  @param major_radius pore major radius
87  @param minor_radius_h2v_aspect_ratio
88  ratio between horizontal and vertical minor radius
89  */
91  double, thickness,
92  double, major_radius,
93  double, minor_radius_h2v_aspect_ratio);
94 
95  //! Return true if the particle is an instance of SlabWithToroidalPore
96  static bool get_is_setup(Model *m, ParticleIndex pi) {
97  return SlabWithPore::get_is_setup(m, pi) &&
98  m->get_has_attribute(get_minor_radius_h2v_aspect_ratio_key(), pi) &&
99  m->get_has_attribute(get_toroidal_pore_key(), pi);
100  }
101 
102  void set_minor_radius_h2v_aspect_ratio(double aspect_ratio){
103  get_particle()->set_value
104  (get_minor_radius_h2v_aspect_ratio_key(),
105  aspect_ratio);
106  }
107 
108  double get_minor_radius_h2v_aspect_ratio() const{
109  return get_particle()->get_value
110  (get_minor_radius_h2v_aspect_ratio_key());
111  }
112 
113  double get_vertical_minor_radius() const{
114  return get_thickness()*0.5;
115  }
116 
117  void set_vertical_minor_radius(double rv) {
118  set_thickness(2.0*rv);
119  }
120 
121  double get_horizontal_minor_radius() const{
122  return get_vertical_minor_radius()*get_minor_radius_h2v_aspect_ratio();
123  }
124 
125  void set_horizontal_minor_radius(double rh) {
126  set_minor_radius_h2v_aspect_ratio
127  ( rh/ get_vertical_minor_radius() );
128  }
129 
130  //! Get the decorator key for the ratio between horizontal and vertical aspect ratio
131  static FloatKey get_minor_radius_h2v_aspect_ratio_key();
132 
133  //! Get the decorator key indicating a toroidal pore
134  static IntKey get_toroidal_pore_key();
135 
136 };
137 
138 
139 
140 IMP_DECORATORS(SlabWithToroidalPore, SlabsWithToroidalPores, IMP::SlabsWithPores);
141 
142 IMPNPCTRANSPORT_END_NAMESPACE
143 
144 #endif /* IMPNPCTRANSPORT_SLAB_WITH_TOROIDAL_PORE_H */
The base class for decorators.
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition: base_types.h:32
static bool get_is_setup(Model *m, ParticleIndex pi)
Return true if the particle is an instance of SlabWithToroidalPore.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
void set_thickness(double thickness)
sets slab thickness
Definition: SlabWithPore.h:79
Various general useful macros for IMP.
Key< 1 > IntKey
The type used to identify int attributes in the Particles.
Definition: base_types.h:36
#define IMP_DECORATOR_SETUP_2(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name)
Particle * get_particle() const
Returns the particle decorated by this decorator.
Definition: Decorator.h:171
Float get_thickness() const
returns whether the particle last entered the transport moiety from its
Definition: SlabWithPore.h:86
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
A decorator for a particle that's a slab with a cylindrical pore.
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name)