IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
ProteinLocalizationRestraint.h
Go to the documentation of this file.
1 /**
2  * \file IMP/npc/ProteinLocalizationRestraint.h
3  * \brief protein localization restraints
4  *
5  * Restrict max distance between at least one pair of particles of any
6  * two distinct types. It also handles multiple copies of the same particles.
7  *
8  * Copyright 2007-2020 IMP Inventors. All rights reserved.
9  *
10  */
11 
12 #ifndef IMPNPC_PROTEIN_LOCALIZATION_RESTRAINT_H
13 #define IMPNPC_PROTEIN_LOCALIZATION_RESTRAINT_H
14 
15 #include <IMP/Pointer.h>
16 #include <IMP/Restraint.h>
17 #include <IMP/npc/npc_config.h>
18 #include <IMP/SingletonContainer.h>
19 
20 IMPNPC_BEGIN_NAMESPACE
21 
22 //! Restrain particles by their z coordinate
23 /** Each particle's z coordinate is harmonically restrained to lie between
24  the given lower and upper bounds.
25  */
26 class IMPNPCEXPORT ZAxialPositionRestraint : public Restraint
27 {
29  double lower_bound_;
30  double upper_bound_;
31  double sigma_;
32  bool consider_radius_;
33 public:
35  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
37  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
38 
39 #ifndef IMP_DOXYGEN
40  void add_particle(Particle *p);
41  void add_particles(const ParticlesTemp &ps);
42  void set_particles(const ParticlesTemp &ps);
43 #endif
44 
45  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
47 
49 };
50 
51 //! Restrain particles by their z coordinate
52 /** Each particle's z coordinate is harmonically restrained to lie above
53  the given lower bound.
54  */
55 class IMPNPCEXPORT ZAxialPositionLowerRestraint : public Restraint
56 {
58  double lower_bound_;
59  double sigma_;
60  bool consider_radius_;
61 public:
63  double lower_bound, bool consider_radius, double sigma=1);
65  double lower_bound, bool consider_radius, double sigma=1);
66 
67 #ifndef IMP_DOXYGEN
68  void add_particle(Particle *p);
69  void add_particles(const ParticlesTemp &ps);
70  void set_particles(const ParticlesTemp &ps);
71 #endif
72 
73  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
75 
77 };
78 
79 //! Restrain particles by their z coordinate
80 /** Each particle's z coordinate is harmonically restrained to lie below
81  the given upper bound.
82  */
83 class IMPNPCEXPORT ZAxialPositionUpperRestraint : public Restraint
84 {
86  double upper_bound_;
87  double sigma_;
88  bool consider_radius_;
89 public:
91  double upper_bound, bool consider_radius, double sigma=1);
93  double upper_bound, bool consider_radius, double sigma=1);
94 
95 #ifndef IMP_DOXYGEN
96  void add_particle(Particle *p);
97  void add_particles(const ParticlesTemp &ps);
98  void set_particles(const ParticlesTemp &ps);
99 #endif
100 
101  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
103 
105 };
106 
107 
108 //! Restrain particles by their y coordinate
109 /** Each particle's y coordinate is harmonically restrained to lie between
110  the given lower and upper bounds.
111  */
112 class IMPNPCEXPORT YAxialPositionRestraint : public Restraint
113 {
115  double lower_bound_;
116  double upper_bound_;
117  double sigma_;
118  bool consider_radius_;
119 public:
121  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
123  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
124 
125 #ifndef IMP_DOXYGEN
126  void add_particle(Particle *p);
127  void add_particles(const ParticlesTemp &ps);
128  void set_particles(const ParticlesTemp &ps);
129 #endif
130 
131  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
133 
135 };
136 
137 //! Restrain particles by their y coordinate
138 /** Each particle's y coordinate is harmonically restrained to lie above
139  the given lower bound.
140  */
141 class IMPNPCEXPORT YAxialPositionLowerRestraint : public Restraint
142 {
144  double lower_bound_;
145  double sigma_;
146  bool consider_radius_;
147 public:
149  double lower_bound, bool consider_radius, double sigma=1);
151  double lower_bound, bool consider_radius, double sigma=1);
152 
153 #ifndef IMP_DOXYGEN
154  void add_particle(Particle *p);
155  void add_particles(const ParticlesTemp &ps);
156  void set_particles(const ParticlesTemp &ps);
157 #endif
158 
159  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
161 
163 };
164 
165 //! Restrain particles by their y coordinate
166 /** Each particle's y coordinate is harmonically restrained to lie below
167  the given upper bound.
168  */
169 class IMPNPCEXPORT YAxialPositionUpperRestraint : public Restraint
170 {
172  double upper_bound_;
173  double sigma_;
174  bool consider_radius_;
175 public:
177  double upper_bound, bool consider_radius, double sigma=1);
179  double upper_bound, bool consider_radius, double sigma=1);
180 
181 #ifndef IMP_DOXYGEN
182  void add_particle(Particle *p);
183  void add_particles(const ParticlesTemp &ps);
184  void set_particles(const ParticlesTemp &ps);
185 #endif
186 
187  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
189 
191 };
192 
193 
194 //! Restrain particles by their distance from the z axis in the xy plane
195 /** Each particle's distance to the z axis is harmonically restrained to
196  lie between the given lower and upper bounds.
197  */
198 class IMPNPCEXPORT XYRadialPositionRestraint : public Restraint
199 {
201  double lower_bound_;
202  double upper_bound_;
203  double sigma_;
204  bool consider_radius_;
205 public:
207  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
209  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
210 
211 #ifndef IMP_DOXYGEN
212  void add_particle(Particle *p);
213  void add_particles(const ParticlesTemp &ps);
214  void set_particles(const ParticlesTemp &ps);
215 #endif
216 
217  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
219 
221 };
222 
223 //! Restrain particles by their distance from the z axis in the xy plane
224 /** Each particle's distance to the z axis is harmonically restrained to
225  lie above the given lower bound.
226  */
227 class IMPNPCEXPORT XYRadialPositionLowerRestraint : public Restraint
228 {
230  double lower_bound_;
231  double sigma_;
232  bool consider_radius_;
233 public:
235  double lower_bound, bool consider_radius, double sigma=1);
237  double lower_bound, bool consider_radius, double sigma=1);
238 
239 #ifndef IMP_DOXYGEN
240  void add_particle(Particle *p);
241  void add_particles(const ParticlesTemp &ps);
242  void set_particles(const ParticlesTemp &ps);
243 #endif
244 
245  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
247 
249 };
250 
251 //! Restrain particles by their distance from the z axis in the xy plane
252 /** Each particle's distance to the z axis is harmonically restrained to
253  lie below the given upper bound.
254  */
255 class IMPNPCEXPORT XYRadialPositionUpperRestraint : public Restraint
256 {
258  double upper_bound_;
259  double sigma_;
260  bool consider_radius_;
261 public:
263  double upper_bound, bool consider_radius, double sigma=1);
265  double upper_bound, bool consider_radius, double sigma=1);
266 
267 #ifndef IMP_DOXYGEN
268  void add_particle(Particle *p);
269  void add_particles(const ParticlesTemp &ps);
270  void set_particles(const ParticlesTemp &ps);
271 #endif
272 
273  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
275 
277 };
278 
279 
280 //! Try to keep all particle surfaces in contact
281 /** The particles (each of which should be a core::XYZR) are harmonically
282  restrained such that each particle's sphere surface is in contact
283  with every other surface.
284  */
285 class IMPNPCEXPORT ProteinContactRestraint : public Restraint
286 {
288  double tolerance_factor_;
289  double sigma_;
290 public:
292  double tolerance_factor, double sigma=0.1);
294  double tolerance_factor, double sigma=0.1);
295 
296 #ifndef IMP_DOXYGEN
297  void add_particle(Particle *p);
298  void add_particles(const ParticlesTemp &ps);
299  void set_particles(const ParticlesTemp &ps);
300 #endif
301 
302  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
304 
306 };
307 
308 
309 //! Try to keep particle surfaces in contact in a chain
310 /** The particles (each of which should be a core::XYZR) are harmonically
311  restrained such that each particle's sphere surface is in contact
312  with the surface of the previous particle.
313  */
314 class IMPNPCEXPORT ProteinChainRestraint : public Restraint
315 {
317  double sigma_;
318 public:
320  double sigma=0.1);
322  double sigma=0.1);
323 
324 #ifndef IMP_DOXYGEN
325  void add_particle(Particle *p);
326  void add_particles(const ParticlesTemp &ps);
327  void set_particles(const ParticlesTemp &ps);
328 #endif
329 
330  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
332 
334 };
335 
336 
337 //! Try to keep particles localized on a membrane surface
338 /** The membrane is defined in this case to be a half torus in the xy
339  plane with center at the origin.
340  */
341 class IMPNPCEXPORT MembraneSurfaceLocationRestraint : public Restraint
342 {
344  double R_;
345  double r_;
346  double sigma_;
347  double thickness_;
348 public:
350  double R, double r, double thickness, double sigma=2);
352  double R, double r, double thickness, double sigma=2);
353 
354 #ifndef IMP_DOXYGEN
355  void add_particle(Particle *p);
356  void add_particles(const ParticlesTemp &ps);
357  void set_particles(const ParticlesTemp &ps);
358 #endif
359 
360  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
362 
364 };
365 
366 
367 //! Try to keep one set of particles localized on a membrane surface
368 /** The membrane is defined in this case to be a half torus in the xy
369  plane with center at the origin. One of the two sets of particles
370  (whichever is closer) is restrained to the membrane surface.
371  */
373 {
376  double R_;
377  double r_;
378  double sigma_;
379  double thickness_;
380 public:
382  double R, double r, double thickness, double sigma=2);
384  double R, double r, double thickness, double sigma=2);
385 
386 #ifndef IMP_DOXYGEN
387  void add_particle1(Particle *p);
388  void add_particle2(Particle *p);
389  void add_particles1(const ParticlesTemp &ps);
390  void add_particles2(const ParticlesTemp &ps);
391  void set_particles1(const ParticlesTemp &ps);
392  void set_particles2(const ParticlesTemp &ps);
393 #endif
394 
395  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
397 
399 };
400 
401 
402 //! Try to keep particles away from a membrane
403 /** The membrane is defined in this case to be a half torus in the xy
404  plane with center at the origin.
405  */
406 class IMPNPCEXPORT MembraneExclusionRestraint : public Restraint
407 {
409  double R_;
410  double r_;
411  double sigma_;
412  double thickness_;
413 public:
415  double R, double r, double thickness, double sigma=2);
417  double R, double r, double thickness, double sigma=2);
418 
419 #ifndef IMP_DOXYGEN
420  void add_particle(Particle *p);
421  void add_particles(const ParticlesTemp &ps);
422  void set_particles(const ParticlesTemp &ps);
423 #endif
424 
425  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
427 
429 };
430 
431 
432 //! Try to keep particles on the pore side of a membrane
433 /** The membrane is defined in this case to be a half torus in the xy
434  plane with center at the origin.
435  */
436 class IMPNPCEXPORT PoreSideVolumeLocationRestraint : public Restraint
437 {
439  double R_;
440  double r_;
441  double sigma_;
442  double thickness_;
443  bool consider_radius_;
444 public:
446  double R, double r, double thickness, bool consider_radius, double sigma=2);
448  double R, double r, double thickness, bool consider_radius, double sigma=2);
449 
450 #ifndef IMP_DOXYGEN
451  void add_particle(Particle *p);
452  void add_particles(const ParticlesTemp &ps);
453  void set_particles(const ParticlesTemp &ps);
454 #endif
455 
456  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
458 
460 };
461 
462 
463 //! Try to keep particles on the perinuclear side of a membrane
464 /** The membrane is defined in this case to be a half torus in the xy
465  plane with center at the origin.
466  */
468 {
470  double R_;
471  double r_;
472  double sigma_;
473  double thickness_;
474  bool consider_radius_;
475 public:
477  double R, double r, double thickness, bool consider_radius, double sigma=2);
479  double R, double r, double thickness, bool consider_radius, double sigma=2);
480 
481 #ifndef IMP_DOXYGEN
482  void add_particle(Particle *p);
483  void add_particles(const ParticlesTemp &ps);
484  void set_particles(const ParticlesTemp &ps);
485 #endif
486 
487  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
489 
491 };
492 
493 
494 //! Restrain two interparticle distances to be the same
495 /** This restraint must be given 4 particles. They are restrained to
496  be symmetric, by enforcing a harmonic penalty on the difference
497  between the distance between the first 2 particles and the distance
498  between the last two.
499  */
501 {
503  double sigma_;
504 public:
506  double sigma=4);
508  double sigma=4);
509 
510 #ifndef IMP_DOXYGEN
511  void add_particle(Particle *p);
512  void add_particles(const ParticlesTemp &ps);
513  void set_particles(const ParticlesTemp &ps);
514 #endif
515 
516  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
518 
520 };
521 
522 
523 //! Restrain two interparticle dihedrals to be the same
524 /** This restraint must be given 8 particles. They are restrained to
525  be symmetric, by enforcing a harmonic penalty on the difference
526  between the dihedral angle between the first 4 particles and the dihedral
527  between the last 4.
528  */
530  : public Restraint
531 {
533  double sigma_;
534 public:
536  double sigma=0.1);
538  double sigma=0.1);
539 
540 #ifndef IMP_DOXYGEN
541  void add_particle(Particle *p);
542  void add_particles(const ParticlesTemp &ps);
543  void set_particles(const ParticlesTemp &ps);
544 #endif
545 
546  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
548 
550 };
551 
552 //! Restrain a set of particles to be proximate to each other
553 /** Each particle is harmonically restrained to be no more than
554  `max_dist` away from every other particle.
555  */
556 class IMPNPCEXPORT ProteinProximityRestraint
557  : public Restraint
558 {
560  double sigma_;
561  double max_dist_;
562 public:
564  double max_dist, double sigma=0.1);
566  double max_dist, double sigma=0.1);
567 
568 #ifndef IMP_DOXYGEN
569  void add_particle(Particle *p);
570  void add_particles(const ParticlesTemp &ps);
571  void set_particles(const ParticlesTemp &ps);
572 #endif
573 
574  double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const;
576 
578 };
579 
580 
581 
582 IMPNPC_END_NAMESPACE
583 
584 #endif /* IMPNPC_PROTEIN_LOCALIZATION_RESTRAINT_H */
Try to keep particles on the perinuclear side of a membrane.
Restrain particles by their z coordinate.
void add_particles(RMF::FileHandle fh, const ParticlesTemp &hs)
A container for Singletons.
Restrain two interparticle dihedrals to be the same.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Restrain particles by their y coordinate.
Restrain particles by their distance from the z axis in the xy plane.
void add_particle(RMF::FileHandle fh, Particle *hs)
Try to keep particles on the pore side of a membrane.
Try to keep one set of particles localized on a membrane surface.
Restrain particles by their z coordinate.
Restrain two interparticle distances to be the same.
Try to keep all particle surfaces in contact.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Try to keep particles away from a membrane.
Try to keep particle surfaces in contact in a chain.
Restrain particles by their distance from the z axis in the xy plane.
Try to keep particles localized on a membrane surface.
A nullptr-initialized pointer to an IMP Object.
Restrain a set of particles to be proximate to each other.
Class to handle individual particles of a Model object.
Definition: Particle.h:41
Abstract base class for all restraints.
Restrain particles by their z coordinate.
Restrain particles by their distance from the z axis in the xy plane.
Restrain particles by their y coordinate.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
Restrain particles by their y coordinate.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:54