IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
AtomicCrossLinkMSRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/isd/AtomicCrossLinkMSRestraint.h
3 * \brief A pmf based likelihood function
4 * with prior knowledge on the false positive rate.
5 *
6 * Copyright 2007-2022 IMP Inventors. All rights reserved.
7 *
8 */
9
10#ifndef IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H
11#define IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H
12#include <IMP/isd/isd_config.h>
15#include <IMP/PairContainer.h>
16#include <IMP/Restraint.h>
17
18IMPISD_BEGIN_NAMESPACE
19
20//! Restrain atom pairs based on a set of crosslinks.
21class IMPISDEXPORT AtomicCrossLinkMSRestraint : public Restraint {
22public:
23 //! Constructor
24 /**
25 \param[in] m The IMP model
26 \param[in] length The maximum length of the crosslinker
27 \param[in] psi The xlink uncertainty nuisance particle
28 \param[in] slope Exponential factor added to the score
29 \param[in] part_of_log_score If true, will return probability instead of
30 score (but the derivative will still be for a log)
31 \param[in] name The restraint name
32
33 */
35 ParticleIndex psi, Float slope = 0.0,
36 bool part_of_log_score=false,
37 std::string name = "AtomicCrossLinkMSRestraint%1%");
39
40 //! Add a contribution to this xlink
41 /**
42 \param[in] ppi The particles to which you will apply the restraint
43 \param[in] sigmas Nuisance parameters (one per residue involved in the XL)
44 */
45
47 const ParticleIndexPair& sigmas);
48
49
50 //! Evaluate the restraint just for a subset of contribution indexes
52
53 //! Get number of contributions added to the restraint
54 unsigned int get_number_of_contributions() const { return ppis_.size(); }
55
56 //! Get the particles in a contribution
57 ParticleIndexPair get_contribution(int i) const { return ppis_[i]; }
58
59 //! Get the sigma nuisances in a contribution
60 ParticleIndexPair get_contribution_sigmas(int i) const { return sigmass_[i]; }
61
62 //! Get the psi nuisance in a contribution
63 ParticleIndex get_psi() const { return psi_; }
64
65 virtual double unprotected_evaluate(
66 IMP::DerivativeAccumulator* accum) const override;
67 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
68 void show(std::ostream &out) const { out << "Atomic XL restraint with "
70 <<" contributions"; }
71 void set_slope(Float slope) { slope_=slope; }
72 void set_part_of_log_score(bool hey) { part_of_log_score_=hey; }
73
75 private:
76 Float xlen_;
77 ParticleIndex psi_;
78 Float slope_;
79 bool part_of_log_score_;
81 ParticleIndexPairs sigmass_;
82 Ints default_range_;
83
84 friend class cereal::access;
85
86 template<class Archive> void serialize(Archive &ar) {
87 ar(cereal::base_class<Restraint>(this), xlen_, psi_, slope_,
88 part_of_log_score_, ppis_, sigmass_, default_range_);
89 }
90
92};
93
94IMPISD_END_NAMESPACE
95
96#endif /* IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H */
Store a list of ParticleIndexes.
A container for Pairs.
Abstract base class for all restraints.
Class for adding derivatives from restraints to the model.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
Restrain atom pairs based on a set of crosslinks.
AtomicCrossLinkMSRestraint(IMP::Model *m, double length, ParticleIndex psi, Float slope=0.0, bool part_of_log_score=false, std::string name="AtomicCrossLinkMSRestraint%1%")
Constructor.
ParticleIndex get_psi() const
Get the psi nuisance in a contribution.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
void add_contribution(const ParticleIndexPair &ppi, const ParticleIndexPair &sigmas)
Add a contribution to this xlink.
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
unsigned int get_number_of_contributions() const
Get number of contributions added to the restraint.
ParticleIndexPair get_contribution(int i) const
Get the particles in a contribution.
ParticleIndexPair get_contribution_sigmas(int i) const
Get the sigma nuisances in a contribution.
Float evaluate_for_contributions(Ints c, DerivativeAccumulator *accum) const
Evaluate the restraint just for a subset of contribution indexes.
Macros to define containers of objects.
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
double Float
Basic floating-point value (could be float, double...).
Definition types.h:19
IMP::Vector< ParticleIndexPair, std::allocator< ParticleIndexPair > > ParticleIndexPairs
Definition base_types.h:208
IMP::Vector< Int > Ints
Standard way to pass a bunch of Int values.
Definition types.h:48
Array< 2, ParticleIndex > ParticleIndexPair
An ordered pair of particles, each identified by its ParticleIndex.
Definition base_types.h:202
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.