IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
AmbiguousRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/isd/AmbiguousRestraint.h
3 * \brief An implementation of the d-norm to make an ambiguous restraint.
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPISD_AMBIGUOUS_RESTRAINT_H
10#define IMPISD_AMBIGUOUS_RESTRAINT_H
11
12#include <IMP/isd/isd_config.h>
13#include <IMP/Restraint.h>
14#include <IMP/Particle.h>
15#include <IMP/generic.h>
16
17IMPISD_BEGIN_NAMESPACE
18
19//! Apply an ambiguous restraint by computing the d-norm.
20// d is an integer.
21// If d>0, behaves like an "and" function.
22// If d<0, behaves like an "or" function.
23// Limits are fuzzy "and" (min) and fuzzy "or" (max) when d is infinite.
24/*
25 The source code is as follows:
26 \include AmbiguousRestraint.h
27 \include AmbiguousRestraint.cpp
28*/
29class IMPISDEXPORT AmbiguousRestraint : public Restraint {
30 int d_;
31 Restraints rs_;
32
33 friend class cereal::access;
34
35 template<class Archive> void serialize(Archive &ar) {
36 ar(cereal::base_class<Restraint>(this), d_, rs_);
37 }
38
40
41 public:
42 //! Create the restraint.
43 /** Two ways to call it: pass it two restraints, or a list of restraints.
44 */
45 AmbiguousRestraint(Model *m, int d, Restraint *r0,
46 Restraint *r1);
47 AmbiguousRestraint(Model *m, int d, Restraints rs);
49
50 double get_probability() const { return exp(-unprotected_evaluate(nullptr)); }
51
53 const override;
54 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
56};
57
58IMPISD_END_NAMESPACE
59
60#endif /* IMPISD_AMBIGUOUS_RESTRAINT_H */
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Abstract base class for all restraints.
Class for adding derivatives from restraints to the model.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
AmbiguousRestraint(Model *m, int d, Restraint *r0, Restraint *r1)
Create the restraint.
Compile-time generic restraint and constraint support.
IMP::Vector< IMP::Pointer< Restraint > > Restraints
Definition base_types.h:120
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.