IMP logo
IMP Reference Guide  2.20.0
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>
14 #include <IMP/container_macros.h>
15 #include <IMP/PairContainer.h>
16 #include <IMP/Restraint.h>
17 
18 IMPISD_BEGIN_NAMESPACE
19 
20 //! Restrain atom pairs based on a set of crosslinks.
21 class IMPISDEXPORT AtomicCrossLinkMSRestraint : public Restraint {
22 public:
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  */
34  AtomicCrossLinkMSRestraint(IMP::Model* m, double length,
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 
46  void add_contribution(const ParticleIndexPair& ppi,
47  const ParticleIndexPair& sigmas);
48 
49 
50  //! Evaluate the restraint just for a subset of contribution indexes
51  Float evaluate_for_contributions(Ints c,DerivativeAccumulator *accum) const;
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 "
69  <<get_number_of_contributions()
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_;
80  ParticleIndexPairs ppis_;
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 
94 IMPISD_END_NAMESPACE
95 
96 #endif /* IMPISD_ATOMIC_CROSS_LINK_MSRESTRAINT_H */
Store a list of ParticleIndexes.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
virtual double unprotected_evaluate(DerivativeAccumulator *da) const
Return the unweighted score for the restraint.
Restrain atom pairs based on a set of crosslinks.
Macros to define containers of objects.
ParticleIndexPair get_contribution(int i) const
Get the particles in a contribution.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
A container for Pairs.
ParticleIndex get_psi() const
Get the psi nuisance in a contribution.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
Abstract base class for all restraints.
ParticleIndexPair get_contribution_sigmas(int i) const
Get the sigma nuisances in a contribution.
unsigned int get_number_of_contributions() const
Get number of contributions added to the restraint.
virtual ModelObjectsTemp do_get_inputs() const =0
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:56