IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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>
19#include <cereal/access.hpp>
20#include <cereal/types/base_class.hpp>
21
22IMPNPC_BEGIN_NAMESPACE
23
24//! Restrain particles by their z coordinate
25/** Each particle's z coordinate is harmonically restrained to lie between
26 the given lower and upper bounds.
27 */
28class IMPNPCEXPORT ZAxialPositionRestraint : public Restraint
29{
31 double lower_bound_;
32 double upper_bound_;
33 double sigma_;
34 bool consider_radius_;
35
36 friend class cereal::access;
37 template<class Archive> void serialize(Archive &ar) {
38 ar(cereal::base_class<Restraint>(this),
39 sc_, lower_bound_, upper_bound_, sigma_, consider_radius_);
40 }
41 IMP_OBJECT_SERIALIZE_DECL(ZAxialPositionRestraint);
42
43public:
44 ZAxialPositionRestraint(Model *m, SingletonContainerAdaptor sc,
45 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
46 ZAxialPositionRestraint(Model *m,
47 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
48 ZAxialPositionRestraint() {}
49
50#ifndef IMP_DOXYGEN
51 void add_particle(Particle *p);
52 void add_particles(const ParticlesTemp &ps);
53 void set_particles(const ParticlesTemp &ps);
54#endif
55
57 IMP::DerivativeAccumulator *accum) const override;
59
60 //! \return Information for writing to RMF files
61 RestraintInfo *get_static_info() const override;
62
63 IMP_OBJECT_METHODS(ZAxialPositionRestraint);;
64};
65
66//! Restrain particles by their z coordinate
67/** Each particle's z coordinate is harmonically restrained to lie above
68 the given lower bound.
69 */
70class IMPNPCEXPORT ZAxialPositionLowerRestraint : public Restraint
71{
73 double lower_bound_;
74 double sigma_;
75 bool consider_radius_;
76
77 friend class cereal::access;
78 template<class Archive> void serialize(Archive &ar) {
79 ar(cereal::base_class<Restraint>(this),
80 sc_, lower_bound_, sigma_, consider_radius_);
81 }
82 IMP_OBJECT_SERIALIZE_DECL(ZAxialPositionLowerRestraint);
83
84public:
85 ZAxialPositionLowerRestraint(Model *m, SingletonContainerAdaptor sc,
86 double lower_bound, bool consider_radius, double sigma=1);
87 ZAxialPositionLowerRestraint(Model *m,
88 double lower_bound, bool consider_radius, double sigma=1);
89 ZAxialPositionLowerRestraint() {}
90
91#ifndef IMP_DOXYGEN
92 void add_particle(Particle *p);
93 void add_particles(const ParticlesTemp &ps);
94 void set_particles(const ParticlesTemp &ps);
95#endif
96
98 IMP::DerivativeAccumulator *accum) const override;
100
101 //! \return Information for writing to RMF files
103
104 IMP_OBJECT_METHODS(ZAxialPositionLowerRestraint);;
105};
106
107//! Restrain particles by their z coordinate
108/** Each particle's z coordinate is harmonically restrained to lie below
109 the given upper bound.
110 */
111class IMPNPCEXPORT ZAxialPositionUpperRestraint : public Restraint
112{
114 double upper_bound_;
115 double sigma_;
116 bool consider_radius_;
117
118 friend class cereal::access;
119 template<class Archive> void serialize(Archive &ar) {
120 ar(cereal::base_class<Restraint>(this),
121 sc_, upper_bound_, sigma_, consider_radius_);
122 }
123 IMP_OBJECT_SERIALIZE_DECL(ZAxialPositionUpperRestraint);
124
125public:
126 ZAxialPositionUpperRestraint(Model *m, SingletonContainerAdaptor sc,
127 double upper_bound, bool consider_radius, double sigma=1);
128 ZAxialPositionUpperRestraint(Model *m,
129 double upper_bound, bool consider_radius, double sigma=1);
130 ZAxialPositionUpperRestraint() {}
131
132#ifndef IMP_DOXYGEN
133 void add_particle(Particle *p);
134 void add_particles(const ParticlesTemp &ps);
135 void set_particles(const ParticlesTemp &ps);
136#endif
137
139 IMP::DerivativeAccumulator *accum) const override;
141
142 //! \return Information for writing to RMF files
144
145 IMP_OBJECT_METHODS(ZAxialPositionUpperRestraint);;
146};
147
148
149//! Restrain particles by their y coordinate
150/** Each particle's y coordinate is harmonically restrained to lie between
151 the given lower and upper bounds.
152 */
153class IMPNPCEXPORT YAxialPositionRestraint : public Restraint
154{
156 double lower_bound_;
157 double upper_bound_;
158 double sigma_;
159 bool consider_radius_;
160
161 friend class cereal::access;
162 template<class Archive> void serialize(Archive &ar) {
163 ar(cereal::base_class<Restraint>(this),
164 sc_, lower_bound_, upper_bound_, sigma_, consider_radius_);
165 }
166 IMP_OBJECT_SERIALIZE_DECL(YAxialPositionRestraint);
167
168public:
169 YAxialPositionRestraint(Model *m, SingletonContainerAdaptor sc,
170 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
171 YAxialPositionRestraint(Model *m,
172 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
173 YAxialPositionRestraint() {}
174
175#ifndef IMP_DOXYGEN
176 void add_particle(Particle *p);
177 void add_particles(const ParticlesTemp &ps);
178 void set_particles(const ParticlesTemp &ps);
179#endif
180
182 IMP::DerivativeAccumulator *accum) const override;
184
185 //! \return Information for writing to RMF files
187
188 IMP_OBJECT_METHODS(YAxialPositionRestraint);;
189};
190
191//! Restrain particles by their y coordinate
192/** Each particle's y coordinate is harmonically restrained to lie above
193 the given lower bound.
194 */
195class IMPNPCEXPORT YAxialPositionLowerRestraint : public Restraint
196{
198 double lower_bound_;
199 double sigma_;
200 bool consider_radius_;
201
202 friend class cereal::access;
203 template<class Archive> void serialize(Archive &ar) {
204 ar(cereal::base_class<Restraint>(this),
205 sc_, lower_bound_, sigma_, consider_radius_);
206 }
207 IMP_OBJECT_SERIALIZE_DECL(YAxialPositionLowerRestraint);
208
209public:
210 YAxialPositionLowerRestraint(Model *m, SingletonContainerAdaptor sc,
211 double lower_bound, bool consider_radius, double sigma=1);
212 YAxialPositionLowerRestraint(Model *m,
213 double lower_bound, bool consider_radius, double sigma=1);
214 YAxialPositionLowerRestraint() {}
215
216#ifndef IMP_DOXYGEN
217 void add_particle(Particle *p);
218 void add_particles(const ParticlesTemp &ps);
219 void set_particles(const ParticlesTemp &ps);
220#endif
221
223 IMP::DerivativeAccumulator *accum) const override;
225
226 //! \return Information for writing to RMF files
228
229 IMP_OBJECT_METHODS(YAxialPositionLowerRestraint);;
230};
231
232//! Restrain particles by their y coordinate
233/** Each particle's y coordinate is harmonically restrained to lie below
234 the given upper bound.
235 */
236class IMPNPCEXPORT YAxialPositionUpperRestraint : public Restraint
237{
239 double upper_bound_;
240 double sigma_;
241 bool consider_radius_;
242
243 friend class cereal::access;
244 template<class Archive> void serialize(Archive &ar) {
245 ar(cereal::base_class<Restraint>(this),
246 sc_, upper_bound_, sigma_, consider_radius_);
247 }
248 IMP_OBJECT_SERIALIZE_DECL(YAxialPositionUpperRestraint);
249
250public:
251 YAxialPositionUpperRestraint(Model *m, SingletonContainerAdaptor sc,
252 double upper_bound, bool consider_radius, double sigma=1);
253 YAxialPositionUpperRestraint(Model *m,
254 double upper_bound, bool consider_radius, double sigma=1);
255 YAxialPositionUpperRestraint() {}
256
257#ifndef IMP_DOXYGEN
258 void add_particle(Particle *p);
259 void add_particles(const ParticlesTemp &ps);
260 void set_particles(const ParticlesTemp &ps);
261#endif
262
264 IMP::DerivativeAccumulator *accum) const override;
266
267 //! \return Information for writing to RMF files
269
270 IMP_OBJECT_METHODS(YAxialPositionUpperRestraint);;
271};
272
273
274//! Restrain particles by their distance from the z axis in the xy plane
275/** Each particle's distance to the z axis is harmonically restrained to
276 lie between the given lower and upper bounds.
277 */
278class IMPNPCEXPORT XYRadialPositionRestraint : public Restraint
279{
281 double lower_bound_;
282 double upper_bound_;
283 double sigma_;
284 bool consider_radius_;
285
286 friend class cereal::access;
287 template<class Archive> void serialize(Archive &ar) {
288 ar(cereal::base_class<Restraint>(this),
289 sc_, lower_bound_, upper_bound_, sigma_, consider_radius_);
290 }
291 IMP_OBJECT_SERIALIZE_DECL(XYRadialPositionRestraint);
292
293public:
294 XYRadialPositionRestraint(Model *m, SingletonContainerAdaptor sc,
295 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
296 XYRadialPositionRestraint(Model *m,
297 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
298 XYRadialPositionRestraint() {}
299
300#ifndef IMP_DOXYGEN
301 void add_particle(Particle *p);
302 void add_particles(const ParticlesTemp &ps);
303 void set_particles(const ParticlesTemp &ps);
304#endif
305
307 IMP::DerivativeAccumulator *accum) const override;
309
310 //! \return Information for writing to RMF files
312
313 IMP_OBJECT_METHODS(XYRadialPositionRestraint);;
314};
315
316//! Restrain particles by their distance from the z axis in the xy plane
317/** Each particle's distance to the z axis is harmonically restrained to
318 lie above the given lower bound.
319 */
320class IMPNPCEXPORT XYRadialPositionLowerRestraint : public Restraint
321{
323 double lower_bound_;
324 double sigma_;
325 bool consider_radius_;
326
327 friend class cereal::access;
328 template<class Archive> void serialize(Archive &ar) {
329 ar(cereal::base_class<Restraint>(this),
330 sc_, lower_bound_, sigma_, consider_radius_);
331 }
332 IMP_OBJECT_SERIALIZE_DECL(XYRadialPositionLowerRestraint);
333
334public:
335 XYRadialPositionLowerRestraint(Model *m, SingletonContainerAdaptor sc,
336 double lower_bound, bool consider_radius, double sigma=1);
337 XYRadialPositionLowerRestraint(Model *m,
338 double lower_bound, bool consider_radius, double sigma=1);
339 XYRadialPositionLowerRestraint() {}
340
341#ifndef IMP_DOXYGEN
342 void add_particle(Particle *p);
343 void add_particles(const ParticlesTemp &ps);
344 void set_particles(const ParticlesTemp &ps);
345#endif
346
348 IMP::DerivativeAccumulator *accum) const override;
350
351 //! \return Information for writing to RMF files
353
354 IMP_OBJECT_METHODS(XYRadialPositionLowerRestraint);;
355};
356
357//! Restrain particles by their distance from the z axis in the xy plane
358/** Each particle's distance to the z axis is harmonically restrained to
359 lie below the given upper bound.
360 */
361class IMPNPCEXPORT XYRadialPositionUpperRestraint : public Restraint
362{
364 double upper_bound_;
365 double sigma_;
366 bool consider_radius_;
367
368 friend class cereal::access;
369 template<class Archive> void serialize(Archive &ar) {
370 ar(cereal::base_class<Restraint>(this),
371 sc_, upper_bound_, sigma_, consider_radius_);
372 }
373 IMP_OBJECT_SERIALIZE_DECL(XYRadialPositionUpperRestraint);
374
375public:
376 XYRadialPositionUpperRestraint(Model *m, SingletonContainerAdaptor sc,
377 double upper_bound, bool consider_radius, double sigma=1);
378 XYRadialPositionUpperRestraint(Model *m,
379 double upper_bound, bool consider_radius, double sigma=1);
380 XYRadialPositionUpperRestraint() {}
381
382#ifndef IMP_DOXYGEN
383 void add_particle(Particle *p);
384 void add_particles(const ParticlesTemp &ps);
385 void set_particles(const ParticlesTemp &ps);
386#endif
387
389 IMP::DerivativeAccumulator *accum) const override;
391
392 //! \return Information for writing to RMF files
394
395 IMP_OBJECT_METHODS(XYRadialPositionUpperRestraint);;
396};
397
398
399//! Try to keep all particle surfaces in contact
400/** The particles (each of which should be a core::XYZR) are harmonically
401 restrained such that each particle's sphere surface is in contact
402 with every other surface.
403 */
404class IMPNPCEXPORT ProteinContactRestraint : public Restraint
405{
407 double tolerance_factor_;
408 double sigma_;
409
410 friend class cereal::access;
411 template<class Archive> void serialize(Archive &ar) {
412 ar(cereal::base_class<Restraint>(this), sc_, tolerance_factor_, sigma_);
413 }
414 IMP_OBJECT_SERIALIZE_DECL(ProteinContactRestraint);
415
416public:
417 ProteinContactRestraint(Model *m, SingletonContainerAdaptor sc,
418 double tolerance_factor, double sigma=0.1);
419 ProteinContactRestraint(Model *m,
420 double tolerance_factor, double sigma=0.1);
421 ProteinContactRestraint() {}
422
423#ifndef IMP_DOXYGEN
424 void add_particle(Particle *p);
425 void add_particles(const ParticlesTemp &ps);
426 void set_particles(const ParticlesTemp &ps);
427#endif
428
430 IMP::DerivativeAccumulator *accum) const override;
432
433 IMP_OBJECT_METHODS(ProteinContactRestraint);;
434};
435
436
437//! Try to keep particle surfaces in contact in a chain
438/** The particles (each of which should be a core::XYZR) are harmonically
439 restrained such that each particle's sphere surface is in contact
440 with the surface of the previous particle.
441 */
442class IMPNPCEXPORT ProteinChainRestraint : public Restraint
443{
445 double sigma_;
446
447 friend class cereal::access;
448 template<class Archive> void serialize(Archive &ar) {
449 ar(cereal::base_class<Restraint>(this), sc_, sigma_);
450 }
451 IMP_OBJECT_SERIALIZE_DECL(ProteinChainRestraint);
452
453public:
454 ProteinChainRestraint(Model *m, SingletonContainerAdaptor sc,
455 double sigma=0.1);
456 ProteinChainRestraint(Model *m,
457 double sigma=0.1);
458 ProteinChainRestraint() {}
459
460#ifndef IMP_DOXYGEN
461 void add_particle(Particle *p);
462 void add_particles(const ParticlesTemp &ps);
463 void set_particles(const ParticlesTemp &ps);
464#endif
465
467 IMP::DerivativeAccumulator *accum) const override;
469
470 IMP_OBJECT_METHODS(ProteinChainRestraint);;
471};
472
473
474//! Try to keep particles localized on a membrane surface
475/** The membrane is defined in this case to be a half torus in the xy
476 plane with center at the origin.
477 */
478class IMPNPCEXPORT MembraneSurfaceLocationRestraint : public Restraint
479{
481 double R_;
482 double r_;
483 double sigma_;
484 double thickness_;
485
486 friend class cereal::access;
487 template<class Archive> void serialize(Archive &ar) {
488 ar(cereal::base_class<Restraint>(this), sc_, R_, r_, sigma_, thickness_);
489 }
490 IMP_OBJECT_SERIALIZE_DECL(MembraneSurfaceLocationRestraint);
491
492public:
493 MembraneSurfaceLocationRestraint(Model *m, SingletonContainerAdaptor sc,
494 double R, double r, double thickness, double sigma=2);
495 MembraneSurfaceLocationRestraint(Model *m,
496 double R, double r, double thickness, double sigma=2);
497 MembraneSurfaceLocationRestraint() {}
498
499#ifndef IMP_DOXYGEN
500 void add_particle(Particle *p);
501 void add_particles(const ParticlesTemp &ps);
502 void set_particles(const ParticlesTemp &ps);
503#endif
504
506 IMP::DerivativeAccumulator *accum) const override;
508
509 //! \return Information for writing to RMF files
511
512 IMP_OBJECT_METHODS(MembraneSurfaceLocationRestraint);;
513};
514
515
516//! Try to keep one set of particles localized on a membrane surface
517/** The membrane is defined in this case to be a half torus in the xy
518 plane with center at the origin. One of the two sets of particles
519 (whichever is closer) is restrained to the membrane surface.
520 */
521class IMPNPCEXPORT MembraneSurfaceLocationConditionalRestraint : public Restraint
522{
525 double R_;
526 double r_;
527 double sigma_;
528 double thickness_;
529
530 friend class cereal::access;
531 template<class Archive> void serialize(Archive &ar) {
532 ar(cereal::base_class<Restraint>(this),
533 sc1_, sc2_, R_, r_, sigma_, thickness_);
534 }
535 IMP_OBJECT_SERIALIZE_DECL(MembraneSurfaceLocationConditionalRestraint);
536
537public:
538 MembraneSurfaceLocationConditionalRestraint(Model *m, SingletonContainerAdaptor sc1, SingletonContainerAdaptor sc2,
539 double R, double r, double thickness, double sigma=2);
540 MembraneSurfaceLocationConditionalRestraint(Model *m,
541 double R, double r, double thickness, double sigma=2);
542 MembraneSurfaceLocationConditionalRestraint() {}
543
544#ifndef IMP_DOXYGEN
545 void add_particle1(Particle *p);
546 void add_particle2(Particle *p);
547 void add_particles1(const ParticlesTemp &ps);
548 void add_particles2(const ParticlesTemp &ps);
549 void set_particles1(const ParticlesTemp &ps);
550 void set_particles2(const ParticlesTemp &ps);
551#endif
552
554 IMP::DerivativeAccumulator *accum) const override;
556
557 //! \return Information for writing to RMF files
559
560 IMP_OBJECT_METHODS(MembraneSurfaceLocationConditionalRestraint);;
561};
562
563
564//! Try to keep particles away from a membrane
565/** The membrane is defined in this case to be a half torus in the xy
566 plane with center at the origin.
567 */
568class IMPNPCEXPORT MembraneExclusionRestraint : public Restraint
569{
571 double R_;
572 double r_;
573 double sigma_;
574 double thickness_;
575
576 friend class cereal::access;
577 template<class Archive> void serialize(Archive &ar) {
578 ar(cereal::base_class<Restraint>(this), sc_, R_, r_, sigma_, thickness_);
579 }
580 IMP_OBJECT_SERIALIZE_DECL(MembraneExclusionRestraint);
581
582public:
583 MembraneExclusionRestraint(Model *m, SingletonContainerAdaptor sc,
584 double R, double r, double thickness, double sigma=2);
585 MembraneExclusionRestraint(Model *m,
586 double R, double r, double thickness, double sigma=2);
587 MembraneExclusionRestraint() {}
588
589#ifndef IMP_DOXYGEN
590 void add_particle(Particle *p);
591 void add_particles(const ParticlesTemp &ps);
592 void set_particles(const ParticlesTemp &ps);
593#endif
594
596 IMP::DerivativeAccumulator *accum) const override;
598
599 //! \return Information for writing to RMF files
601
602 IMP_OBJECT_METHODS(MembraneExclusionRestraint);;
603};
604
605
606//! Try to keep particles on the pore side of a membrane
607/** The membrane is defined in this case to be a half torus in the xy
608 plane with center at the origin.
609 */
610class IMPNPCEXPORT PoreSideVolumeLocationRestraint : public Restraint
611{
613 double R_;
614 double r_;
615 double sigma_;
616 double thickness_;
617 bool consider_radius_;
618
619 friend class cereal::access;
620 template<class Archive> void serialize(Archive &ar) {
621 ar(cereal::base_class<Restraint>(this),
622 sc_, R_, r_, sigma_, thickness_, consider_radius_);
623 }
624 IMP_OBJECT_SERIALIZE_DECL(PoreSideVolumeLocationRestraint);
625
626public:
627 PoreSideVolumeLocationRestraint(Model *m, SingletonContainerAdaptor sc,
628 double R, double r, double thickness, bool consider_radius, double sigma=2);
629 PoreSideVolumeLocationRestraint(Model *m,
630 double R, double r, double thickness, bool consider_radius, double sigma=2);
631 PoreSideVolumeLocationRestraint() {}
632
633#ifndef IMP_DOXYGEN
634 void add_particle(Particle *p);
635 void add_particles(const ParticlesTemp &ps);
636 void set_particles(const ParticlesTemp &ps);
637#endif
638
640 IMP::DerivativeAccumulator *accum) const override;
642
643 IMP_OBJECT_METHODS(PoreSideVolumeLocationRestraint);;
644};
645
646
647//! Try to keep particles on the perinuclear side of a membrane
648/** The membrane is defined in this case to be a half torus in the xy
649 plane with center at the origin.
650 */
651class IMPNPCEXPORT PerinuclearVolumeLocationRestraint : public Restraint
652{
654 double R_;
655 double r_;
656 double sigma_;
657 double thickness_;
658 bool consider_radius_;
659
660 friend class cereal::access;
661 template<class Archive> void serialize(Archive &ar) {
662 ar(cereal::base_class<Restraint>(this),
663 sc_, R_, r_, sigma_, thickness_, consider_radius_);
664 }
665 IMP_OBJECT_SERIALIZE_DECL(PerinuclearVolumeLocationRestraint);
666
667public:
668 PerinuclearVolumeLocationRestraint(Model *m, SingletonContainerAdaptor sc,
669 double R, double r, double thickness, bool consider_radius, double sigma=2);
670 PerinuclearVolumeLocationRestraint(Model *m,
671 double R, double r, double thickness, bool consider_radius, double sigma=2);
672 PerinuclearVolumeLocationRestraint() {}
673
674#ifndef IMP_DOXYGEN
675 void add_particle(Particle *p);
676 void add_particles(const ParticlesTemp &ps);
677 void set_particles(const ParticlesTemp &ps);
678#endif
679
681 IMP::DerivativeAccumulator *accum) const override;
683
684 IMP_OBJECT_METHODS(PerinuclearVolumeLocationRestraint);;
685};
686
687
688//! Restrain two interparticle distances to be the same
689/** This restraint must be given 4 particles. They are restrained to
690 be symmetric, by enforcing a harmonic penalty on the difference
691 between the distance between the first 2 particles and the distance
692 between the last two.
693 */
694class IMPNPCEXPORT AssemblySymmetryByDistanceRestraint : public Restraint
695{
697 double sigma_;
698
699 friend class cereal::access;
700 template<class Archive> void serialize(Archive &ar) {
701 ar(cereal::base_class<Restraint>(this), sc_, sigma_);
702 }
703 IMP_OBJECT_SERIALIZE_DECL(AssemblySymmetryByDistanceRestraint);
704
705public:
706 AssemblySymmetryByDistanceRestraint(Model *m, SingletonContainerAdaptor sc,
707 double sigma=4);
708 AssemblySymmetryByDistanceRestraint(Model *m,
709 double sigma=4);
710 AssemblySymmetryByDistanceRestraint() {}
711
712#ifndef IMP_DOXYGEN
713 void add_particle(Particle *p);
714 void add_particles(const ParticlesTemp &ps);
715 void set_particles(const ParticlesTemp &ps);
716#endif
717
719 IMP::DerivativeAccumulator *accum) const override;
721
722 IMP_OBJECT_METHODS(AssemblySymmetryByDistanceRestraint);;
723};
724
725
726//! Restrain two interparticle dihedrals to be the same
727/** This restraint must be given 8 particles. They are restrained to
728 be symmetric, by enforcing a harmonic penalty on the difference
729 between the dihedral angle between the first 4 particles and the dihedral
730 between the last 4.
731 */
732class IMPNPCEXPORT AssemblySymmetryByDihedralRestraint
733 : public Restraint
734{
736 double sigma_;
737
738 friend class cereal::access;
739 template<class Archive> void serialize(Archive &ar) {
740 ar(cereal::base_class<Restraint>(this), sc_, sigma_);
741 }
742 IMP_OBJECT_SERIALIZE_DECL(AssemblySymmetryByDihedralRestraint);
743
744public:
745 AssemblySymmetryByDihedralRestraint(Model *m, SingletonContainerAdaptor sc,
746 double sigma=0.1);
747 AssemblySymmetryByDihedralRestraint(Model *m,
748 double sigma=0.1);
749 AssemblySymmetryByDihedralRestraint() {}
750
751#ifndef IMP_DOXYGEN
752 void add_particle(Particle *p);
753 void add_particles(const ParticlesTemp &ps);
754 void set_particles(const ParticlesTemp &ps);
755#endif
756
758 IMP::DerivativeAccumulator *accum) const override;
760
761 IMP_OBJECT_METHODS(AssemblySymmetryByDihedralRestraint);;
762};
763
764//! Restrain a set of particles to be proximate to each other
765/** Each particle is harmonically restrained to be no more than
766 `max_dist` away from every other particle.
767 */
768class IMPNPCEXPORT ProteinProximityRestraint
769 : public Restraint
770{
772 double sigma_;
773 double max_dist_;
774
775 friend class cereal::access;
776 template<class Archive> void serialize(Archive &ar) {
777 ar(cereal::base_class<Restraint>(this), sc_, sigma_, max_dist_);
778 }
779 IMP_OBJECT_SERIALIZE_DECL(ProteinProximityRestraint);
780
781public:
782 ProteinProximityRestraint(Model *m, SingletonContainerAdaptor sc,
783 double max_dist, double sigma=0.1);
784 ProteinProximityRestraint(Model *m,
785 double max_dist, double sigma=0.1);
786 ProteinProximityRestraint() {}
787
788#ifndef IMP_DOXYGEN
789 void add_particle(Particle *p);
790 void add_particles(const ParticlesTemp &ps);
791 void set_particles(const ParticlesTemp &ps);
792#endif
793
795 IMP::DerivativeAccumulator *accum) const override;
797
798 IMP_OBJECT_METHODS(ProteinProximityRestraint);;
799};
800
801//! Restrain particles by their x coordinate
802/** Each particle's x coordinate is harmonically restrained to lie between
803 the given lower and upper bounds.
804 */
805class IMPNPCEXPORT XAxialPositionRestraint : public Restraint
806{
808 double lower_bound_;
809 double upper_bound_;
810 double sigma_;
811 bool consider_radius_;
812 friend class cereal::access;
813 template<class Archive> void serialize(Archive &ar) {
814 ar(cereal::base_class<Restraint>(this),
815 sc_, lower_bound_, upper_bound_, sigma_, consider_radius_);
816 }
817 IMP_OBJECT_SERIALIZE_DECL(XAxialPositionRestraint);
818
819public:
820 XAxialPositionRestraint(Model *m, SingletonContainerAdaptor sc,
821 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
822 XAxialPositionRestraint(Model *m,
823 double lower_bound, double upper_bound, bool consider_radius, double sigma=1);
824 XAxialPositionRestraint() {}
825
826#ifndef IMP_DOXYGEN
827 void add_particle(Particle *p);
828 void add_particles(const ParticlesTemp &ps);
829 void set_particles(const ParticlesTemp &ps);
830#endif
831
833 IMP::DerivativeAccumulator *accum) const override;
835
836 //! \return Information for writing to RMF files
838
839 IMP_OBJECT_METHODS(XAxialPositionRestraint);;
840};
841
842//! Restrain particles by their x coordinate
843/** Each particle's x coordinate is harmonically restrained to lie above
844 the given lower bound.
845 */
846class IMPNPCEXPORT XAxialPositionLowerRestraint : public Restraint
847{
849 double lower_bound_;
850 double sigma_;
851 bool consider_radius_;
852
853 friend class cereal::access;
854 template<class Archive> void serialize(Archive &ar) {
855 ar(cereal::base_class<Restraint>(this),
856 sc_, lower_bound_, sigma_, consider_radius_);
857 }
858 IMP_OBJECT_SERIALIZE_DECL(XAxialPositionLowerRestraint);
859
860public:
861 XAxialPositionLowerRestraint(Model *m, SingletonContainerAdaptor sc,
862 double lower_bound, bool consider_radius, double sigma=1);
863 XAxialPositionLowerRestraint(Model *m,
864 double lower_bound, bool consider_radius, double sigma=1);
865 XAxialPositionLowerRestraint() {}
866
867#ifndef IMP_DOXYGEN
868 void add_particle(Particle *p);
869 void add_particles(const ParticlesTemp &ps);
870 void set_particles(const ParticlesTemp &ps);
871#endif
872
874 IMP::DerivativeAccumulator *accum) const override;
876
877 //! \return Information for writing to RMF files
879
880 IMP_OBJECT_METHODS(XAxialPositionLowerRestraint);;
881};
882
883//! Restrain particles by their x coordinate
884/** Each particle's x coordinate is harmonically restrained to lie below
885 the given upper bound.
886 */
887class IMPNPCEXPORT XAxialPositionUpperRestraint : public Restraint
888{
890 double upper_bound_;
891 double sigma_;
892 bool consider_radius_;
893
894 friend class cereal::access;
895 template<class Archive> void serialize(Archive &ar) {
896 ar(cereal::base_class<Restraint>(this),
897 sc_, upper_bound_, sigma_, consider_radius_);
898 }
899 IMP_OBJECT_SERIALIZE_DECL(XAxialPositionUpperRestraint);
900
901public:
902 XAxialPositionUpperRestraint(Model *m, SingletonContainerAdaptor sc,
903 double upper_bound, bool consider_radius, double sigma=1);
904 XAxialPositionUpperRestraint(Model *m,
905 double upper_bound, bool consider_radius, double sigma=1);
906 XAxialPositionUpperRestraint() {}
907
908
909
910
911#ifndef IMP_DOXYGEN
912 void add_particle(Particle *p);
913 void add_particles(const ParticlesTemp &ps);
914 void set_particles(const ParticlesTemp &ps);
915#endif
916
918 IMP::DerivativeAccumulator *accum) const override;
920
921 //! \return Information for writing to RMF files
923
924 IMP_OBJECT_METHODS(XAxialPositionUpperRestraint);;
925};
926
927//! Restrain particle to a specific position
928/** All distances are in Angstrom
929While SphereDistanceToSingletonScore creates a score based on a UnaryFunction object,
930OverallPositionRestraint assumes a harmonic restraint.
931\param[in] x_start x position to restrain to
932\param[in] y_start y position to restrain to
933\param[in] z_start z position to restrain to
934\param[in] tolerance range of distances where restraint=0
935\param[in] consider_radius bool, consider the radius of the particle
936\param[in] sigma inverse strength of harmonic potential
937 */
938class IMPNPCEXPORT OverallPositionRestraint : public Restraint
939{
941 double x_start_;
942 double y_start_;
943 double z_start_;
944 double tolerance_;
945 double sigma_;
946 bool consider_radius_;
947
948 friend class cereal::access;
949 template<class Archive> void serialize(Archive &ar) {
950 ar(cereal::base_class<Restraint>(this),
951 sc_, x_start_, y_start_, z_start_, tolerance_, sigma_, consider_radius_);
952 }
953 IMP_OBJECT_SERIALIZE_DECL(OverallPositionRestraint);
954
955public:
956
957 OverallPositionRestraint(Model *m,
959 double x_start, double y_start, double z_start, double tolerance, bool consider_radius, double sigma=1);
960 OverallPositionRestraint(Model *m,
961 double x_start, double y_start, double z_start, double tolerance, bool consider_radius, double sigma=1);
962 OverallPositionRestraint() {}
963
964
965#ifndef IMP_DOXYGEN
966 void add_particle(Particle *p);
967 void add_particles(const ParticlesTemp &ps);
968 void set_particles(const ParticlesTemp &ps);
969#endif
970
972 IMP::DerivativeAccumulator *accum) const override;
974
975 //! \return Information for writing to RMF files
977
978 IMP_OBJECT_METHODS(OverallPositionRestraint);;
979};
980
981
982
983
984IMPNPC_END_NAMESPACE
985
986#endif /* IMPNPC_PROTEIN_LOCALIZATION_RESTRAINT_H */
A nullptr-initialized pointer to an IMP Object.
Abstract base class for all restraints.
A container for Singletons.
Class for adding derivatives from restraints to the model.
Class to handle individual particles of a Model object.
Definition Particle.h:45
Report key:value information on restraints.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
RestraintInfo * get_static_info() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
ModelObjectsTemp do_get_inputs() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
RestraintInfo * get_static_info() const override
RestraintInfo * get_static_info() const override
ModelObjectsTemp do_get_inputs() const override
double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a ref-counted Object that is a class member.
Definition Pointer.h:144