IMP logo
IMP Reference Guide  2.18.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-2022 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(
46  IMP::DerivativeAccumulator *accum) const override;
47  ModelObjectsTemp do_get_inputs() const override;
48 
50 };
51 
52 //! Restrain particles by their z coordinate
53 /** Each particle's z coordinate is harmonically restrained to lie above
54  the given lower bound.
55  */
56 class IMPNPCEXPORT ZAxialPositionLowerRestraint : public Restraint
57 {
59  double lower_bound_;
60  double sigma_;
61  bool consider_radius_;
62 public:
64  double lower_bound, bool consider_radius, double sigma=1);
66  double lower_bound, bool consider_radius, double sigma=1);
67 
68 #ifndef IMP_DOXYGEN
69  void add_particle(Particle *p);
70  void add_particles(const ParticlesTemp &ps);
71  void set_particles(const ParticlesTemp &ps);
72 #endif
73 
74  double unprotected_evaluate(
75  IMP::DerivativeAccumulator *accum) const override;
76  ModelObjectsTemp do_get_inputs() const override;
77 
79 };
80 
81 //! Restrain particles by their z coordinate
82 /** Each particle's z coordinate is harmonically restrained to lie below
83  the given upper bound.
84  */
85 class IMPNPCEXPORT ZAxialPositionUpperRestraint : public Restraint
86 {
88  double upper_bound_;
89  double sigma_;
90  bool consider_radius_;
91 public:
93  double upper_bound, bool consider_radius, double sigma=1);
95  double upper_bound, bool consider_radius, double sigma=1);
96 
97 #ifndef IMP_DOXYGEN
98  void add_particle(Particle *p);
99  void add_particles(const ParticlesTemp &ps);
100  void set_particles(const ParticlesTemp &ps);
101 #endif
102 
103  double unprotected_evaluate(
104  IMP::DerivativeAccumulator *accum) const override;
105  ModelObjectsTemp do_get_inputs() const override;
106 
108 };
109 
110 
111 //! Restrain particles by their y coordinate
112 /** Each particle's y coordinate is harmonically restrained to lie between
113  the given lower and upper bounds.
114  */
115 class IMPNPCEXPORT YAxialPositionRestraint : public Restraint
116 {
118  double lower_bound_;
119  double upper_bound_;
120  double sigma_;
121  bool consider_radius_;
122 public:
124  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
126  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
127 
128 #ifndef IMP_DOXYGEN
129  void add_particle(Particle *p);
130  void add_particles(const ParticlesTemp &ps);
131  void set_particles(const ParticlesTemp &ps);
132 #endif
133 
134  double unprotected_evaluate(
135  IMP::DerivativeAccumulator *accum) const override;
136  ModelObjectsTemp do_get_inputs() const override;
137 
139 };
140 
141 //! Restrain particles by their y coordinate
142 /** Each particle's y coordinate is harmonically restrained to lie above
143  the given lower bound.
144  */
145 class IMPNPCEXPORT YAxialPositionLowerRestraint : public Restraint
146 {
148  double lower_bound_;
149  double sigma_;
150  bool consider_radius_;
151 public:
153  double lower_bound, bool consider_radius, double sigma=1);
155  double lower_bound, bool consider_radius, double sigma=1);
156 
157 #ifndef IMP_DOXYGEN
158  void add_particle(Particle *p);
159  void add_particles(const ParticlesTemp &ps);
160  void set_particles(const ParticlesTemp &ps);
161 #endif
162 
163  double unprotected_evaluate(
164  IMP::DerivativeAccumulator *accum) const override;
165  ModelObjectsTemp do_get_inputs() const override;
166 
168 };
169 
170 //! Restrain particles by their y coordinate
171 /** Each particle's y coordinate is harmonically restrained to lie below
172  the given upper bound.
173  */
174 class IMPNPCEXPORT YAxialPositionUpperRestraint : public Restraint
175 {
177  double upper_bound_;
178  double sigma_;
179  bool consider_radius_;
180 public:
182  double upper_bound, bool consider_radius, double sigma=1);
184  double upper_bound, bool consider_radius, double sigma=1);
185 
186 #ifndef IMP_DOXYGEN
187  void add_particle(Particle *p);
188  void add_particles(const ParticlesTemp &ps);
189  void set_particles(const ParticlesTemp &ps);
190 #endif
191 
192  double unprotected_evaluate(
193  IMP::DerivativeAccumulator *accum) const override;
194  ModelObjectsTemp do_get_inputs() const override;
195 
197 };
198 
199 
200 //! Restrain particles by their distance from the z axis in the xy plane
201 /** Each particle's distance to the z axis is harmonically restrained to
202  lie between the given lower and upper bounds.
203  */
204 class IMPNPCEXPORT XYRadialPositionRestraint : public Restraint
205 {
207  double lower_bound_;
208  double upper_bound_;
209  double sigma_;
210  bool consider_radius_;
211 public:
213  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
215  double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
216 
217 #ifndef IMP_DOXYGEN
218  void add_particle(Particle *p);
219  void add_particles(const ParticlesTemp &ps);
220  void set_particles(const ParticlesTemp &ps);
221 #endif
222 
223  double unprotected_evaluate(
224  IMP::DerivativeAccumulator *accum) const override;
225  ModelObjectsTemp do_get_inputs() const override;
226 
228 };
229 
230 //! Restrain particles by their distance from the z axis in the xy plane
231 /** Each particle's distance to the z axis is harmonically restrained to
232  lie above the given lower bound.
233  */
234 class IMPNPCEXPORT XYRadialPositionLowerRestraint : public Restraint
235 {
237  double lower_bound_;
238  double sigma_;
239  bool consider_radius_;
240 public:
242  double lower_bound, bool consider_radius, double sigma=1);
244  double lower_bound, bool consider_radius, double sigma=1);
245 
246 #ifndef IMP_DOXYGEN
247  void add_particle(Particle *p);
248  void add_particles(const ParticlesTemp &ps);
249  void set_particles(const ParticlesTemp &ps);
250 #endif
251 
252  double unprotected_evaluate(
253  IMP::DerivativeAccumulator *accum) const override;
254  ModelObjectsTemp do_get_inputs() const override;
255 
257 };
258 
259 //! Restrain particles by their distance from the z axis in the xy plane
260 /** Each particle's distance to the z axis is harmonically restrained to
261  lie below the given upper bound.
262  */
263 class IMPNPCEXPORT XYRadialPositionUpperRestraint : public Restraint
264 {
266  double upper_bound_;
267  double sigma_;
268  bool consider_radius_;
269 public:
271  double upper_bound, bool consider_radius, double sigma=1);
273  double upper_bound, bool consider_radius, double sigma=1);
274 
275 #ifndef IMP_DOXYGEN
276  void add_particle(Particle *p);
277  void add_particles(const ParticlesTemp &ps);
278  void set_particles(const ParticlesTemp &ps);
279 #endif
280 
281  double unprotected_evaluate(
282  IMP::DerivativeAccumulator *accum) const override;
283  ModelObjectsTemp do_get_inputs() const override;
284 
286 };
287 
288 
289 //! Try to keep all particle surfaces in contact
290 /** The particles (each of which should be a core::XYZR) are harmonically
291  restrained such that each particle's sphere surface is in contact
292  with every other surface.
293  */
294 class IMPNPCEXPORT ProteinContactRestraint : public Restraint
295 {
297  double tolerance_factor_;
298  double sigma_;
299 public:
301  double tolerance_factor, double sigma=0.1);
303  double tolerance_factor, double sigma=0.1);
304 
305 #ifndef IMP_DOXYGEN
306  void add_particle(Particle *p);
307  void add_particles(const ParticlesTemp &ps);
308  void set_particles(const ParticlesTemp &ps);
309 #endif
310 
311  double unprotected_evaluate(
312  IMP::DerivativeAccumulator *accum) const override;
313  ModelObjectsTemp do_get_inputs() const override;
314 
316 };
317 
318 
319 //! Try to keep particle surfaces in contact in a chain
320 /** The particles (each of which should be a core::XYZR) are harmonically
321  restrained such that each particle's sphere surface is in contact
322  with the surface of the previous particle.
323  */
324 class IMPNPCEXPORT ProteinChainRestraint : public Restraint
325 {
327  double sigma_;
328 public:
330  double sigma=0.1);
332  double sigma=0.1);
333 
334 #ifndef IMP_DOXYGEN
335  void add_particle(Particle *p);
336  void add_particles(const ParticlesTemp &ps);
337  void set_particles(const ParticlesTemp &ps);
338 #endif
339 
340  double unprotected_evaluate(
341  IMP::DerivativeAccumulator *accum) const override;
342  ModelObjectsTemp do_get_inputs() const override;
343 
345 };
346 
347 
348 //! Try to keep particles localized on a membrane surface
349 /** The membrane is defined in this case to be a half torus in the xy
350  plane with center at the origin.
351  */
352 class IMPNPCEXPORT MembraneSurfaceLocationRestraint : public Restraint
353 {
355  double R_;
356  double r_;
357  double sigma_;
358  double thickness_;
359 public:
361  double R, double r, double thickness, double sigma=2);
363  double R, double r, double thickness, double sigma=2);
364 
365 #ifndef IMP_DOXYGEN
366  void add_particle(Particle *p);
367  void add_particles(const ParticlesTemp &ps);
368  void set_particles(const ParticlesTemp &ps);
369 #endif
370 
371  double unprotected_evaluate(
372  IMP::DerivativeAccumulator *accum) const override;
373  ModelObjectsTemp do_get_inputs() const override;
374 
376 };
377 
378 
379 //! Try to keep one set of particles localized on a membrane surface
380 /** The membrane is defined in this case to be a half torus in the xy
381  plane with center at the origin. One of the two sets of particles
382  (whichever is closer) is restrained to the membrane surface.
383  */
385 {
388  double R_;
389  double r_;
390  double sigma_;
391  double thickness_;
392 public:
394  double R, double r, double thickness, double sigma=2);
396  double R, double r, double thickness, double sigma=2);
397 
398 #ifndef IMP_DOXYGEN
399  void add_particle1(Particle *p);
400  void add_particle2(Particle *p);
401  void add_particles1(const ParticlesTemp &ps);
402  void add_particles2(const ParticlesTemp &ps);
403  void set_particles1(const ParticlesTemp &ps);
404  void set_particles2(const ParticlesTemp &ps);
405 #endif
406 
407  double unprotected_evaluate(
408  IMP::DerivativeAccumulator *accum) const override;
409  ModelObjectsTemp do_get_inputs() const override;
410 
412 };
413 
414 
415 //! Try to keep particles away from a membrane
416 /** The membrane is defined in this case to be a half torus in the xy
417  plane with center at the origin.
418  */
419 class IMPNPCEXPORT MembraneExclusionRestraint : public Restraint
420 {
422  double R_;
423  double r_;
424  double sigma_;
425  double thickness_;
426 public:
428  double R, double r, double thickness, double sigma=2);
430  double R, double r, double thickness, double sigma=2);
431 
432 #ifndef IMP_DOXYGEN
433  void add_particle(Particle *p);
434  void add_particles(const ParticlesTemp &ps);
435  void set_particles(const ParticlesTemp &ps);
436 #endif
437 
438  double unprotected_evaluate(
439  IMP::DerivativeAccumulator *accum) const override;
440  ModelObjectsTemp do_get_inputs() const override;
441 
443 };
444 
445 
446 //! Try to keep particles on the pore side of a membrane
447 /** The membrane is defined in this case to be a half torus in the xy
448  plane with center at the origin.
449  */
450 class IMPNPCEXPORT PoreSideVolumeLocationRestraint : public Restraint
451 {
453  double R_;
454  double r_;
455  double sigma_;
456  double thickness_;
457  bool consider_radius_;
458 public:
460  double R, double r, double thickness, bool consider_radius, double sigma=2);
462  double R, double r, double thickness, bool consider_radius, double sigma=2);
463 
464 #ifndef IMP_DOXYGEN
465  void add_particle(Particle *p);
466  void add_particles(const ParticlesTemp &ps);
467  void set_particles(const ParticlesTemp &ps);
468 #endif
469 
470  double unprotected_evaluate(
471  IMP::DerivativeAccumulator *accum) const override;
472  ModelObjectsTemp do_get_inputs() const override;
473 
475 };
476 
477 
478 //! Try to keep particles on the perinuclear side of a membrane
479 /** The membrane is defined in this case to be a half torus in the xy
480  plane with center at the origin.
481  */
483 {
485  double R_;
486  double r_;
487  double sigma_;
488  double thickness_;
489  bool consider_radius_;
490 public:
492  double R, double r, double thickness, bool consider_radius, double sigma=2);
494  double R, double r, double thickness, bool consider_radius, double sigma=2);
495 
496 #ifndef IMP_DOXYGEN
497  void add_particle(Particle *p);
498  void add_particles(const ParticlesTemp &ps);
499  void set_particles(const ParticlesTemp &ps);
500 #endif
501 
502  double unprotected_evaluate(
503  IMP::DerivativeAccumulator *accum) const override;
504  ModelObjectsTemp do_get_inputs() const override;
505 
507 };
508 
509 
510 //! Restrain two interparticle distances to be the same
511 /** This restraint must be given 4 particles. They are restrained to
512  be symmetric, by enforcing a harmonic penalty on the difference
513  between the distance between the first 2 particles and the distance
514  between the last two.
515  */
517 {
519  double sigma_;
520 public:
522  double sigma=4);
524  double sigma=4);
525 
526 #ifndef IMP_DOXYGEN
527  void add_particle(Particle *p);
528  void add_particles(const ParticlesTemp &ps);
529  void set_particles(const ParticlesTemp &ps);
530 #endif
531 
532  double unprotected_evaluate(
533  IMP::DerivativeAccumulator *accum) const override;
534  ModelObjectsTemp do_get_inputs() const override;
535 
537 };
538 
539 
540 //! Restrain two interparticle dihedrals to be the same
541 /** This restraint must be given 8 particles. They are restrained to
542  be symmetric, by enforcing a harmonic penalty on the difference
543  between the dihedral angle between the first 4 particles and the dihedral
544  between the last 4.
545  */
547  : public Restraint
548 {
550  double sigma_;
551 public:
553  double sigma=0.1);
555  double sigma=0.1);
556 
557 #ifndef IMP_DOXYGEN
558  void add_particle(Particle *p);
559  void add_particles(const ParticlesTemp &ps);
560  void set_particles(const ParticlesTemp &ps);
561 #endif
562 
563  double unprotected_evaluate(
564  IMP::DerivativeAccumulator *accum) const override;
565  ModelObjectsTemp do_get_inputs() const override;
566 
568 };
569 
570 //! Restrain a set of particles to be proximate to each other
571 /** Each particle is harmonically restrained to be no more than
572  `max_dist` away from every other particle.
573  */
574 class IMPNPCEXPORT ProteinProximityRestraint
575  : public Restraint
576 {
578  double sigma_;
579  double max_dist_;
580 public:
582  double max_dist, double sigma=0.1);
584  double max_dist, double sigma=0.1);
585 
586 #ifndef IMP_DOXYGEN
587  void add_particle(Particle *p);
588  void add_particles(const ParticlesTemp &ps);
589  void set_particles(const ParticlesTemp &ps);
590 #endif
591 
592  double unprotected_evaluate(
593  IMP::DerivativeAccumulator *accum) const override;
594  ModelObjectsTemp do_get_inputs() const override;
595 
597 };
598 
599 
600 
601 IMPNPC_END_NAMESPACE
602 
603 #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.
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
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:73
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:53