IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
MarginalHBondRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/isd/MarginalHBondRestraint.h
3 * \brief A lognormal restraint that uses the ISPA model to model HBond-derived
4 * distance fit.
5 *
6 * Copyright 2007-2022 IMP Inventors. All rights reserved.
7 *
8 */
9
10#ifndef IMPISD_MARGINAL_HBOND_RESTRAINT_H
11#define IMPISD_MARGINAL_HBOND_RESTRAINT_H
12
13#include <IMP/isd/isd_config.h>
14#include <IMP/Restraint.h>
15#include <IMP/PairContainer.h>
16
17IMPISD_BEGIN_NAMESPACE
18
19//! Apply a lognormal distance restraint between two particles.
20/** Marginal of the lognormal model for NOEs where only \f$\sigma\f$ was
21 marginalized, and \f$\gamma\f$ was set to 1.
22 Since the restraint is complicated, pass individual particles to
23 add_contribution() command.
24
25 \f[p(D|X,I) =
26 \left(\sum_{i=1}^N \log^2\left(\frac{V_i^{exp}}
27 {d_i^{-6}(X)}\right)\right)^{-\frac{N}{2}}
28 \f]
29 */
30class IMPISDEXPORT MarginalHBondRestraint : public Restraint {
31 PairContainers contribs_;
32 std::vector<double> volumes_;
33 double logsquares_;
34 void set_logsquares(double logsquares) { logsquares_ = logsquares; }
35
36 public:
37 //! Create the restraint.
39 : Restraint(m, "MarginalHBondRestraint%1%") {};
40
41 // add a contribution: simple case
42 void add_contribution(Particle *p1, Particle *p2,
43 double Iexp);
44
45 // add a contribution: general case
46 void add_contribution(PairContainer *pc, double Iexp);
47
48 // return the sum inside the parentheses
49 double get_logsquares() const { return logsquares_; }
50
51 unsigned get_number_of_contributions() const { return volumes_.size(); }
52
53 /* call for probability */
54 double get_probability() const { return exp(-unprotected_evaluate(nullptr)); }
55
57 const override;
58 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
60};
61
62IMPISD_END_NAMESPACE
63
64#endif /* IMPISD_MARGINAL_HBOND_RESTRAINT_H */
A container for Pairs.
Abstract base class for all restraints.
Class for adding derivatives from restraints to the model.
A shared container for Pairs.
Class to handle individual particles of a Model object.
Definition Particle.h:45
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
MarginalHBondRestraint(Model *m)
Create the restraint.
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
IMP::Vector< IMP::Pointer< PairContainer > > PairContainers
Definition base_types.h:146
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.