IMP  2.2.1
The Integrative Modeling Platform
DerivativeCalculator.h
Go to the documentation of this file.
1 /**
2  * \file IMP/saxs/DerivativeCalculator.h
3  * \brief A class for computing SAXS derivatives
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSAXS_DERIVATIVE_CALCULATOR_H
10 #define IMPSAXS_DERIVATIVE_CALCULATOR_H
11 
12 #include "Profile.h"
13 #include "Distribution.h"
14 #include <IMP/base/Object.h>
15 
16 IMPSAXS_BEGIN_NAMESPACE
17 
18 /**
19  A class for computing derivatives with respect to SAXS
20  Note: the calculation is expensive, make sure it helps if you use it!
21 */
22 class IMPSAXSEXPORT DerivativeCalculator : public base::Object {
23  public:
24  DerivativeCalculator(const Profile* exp_profile);
25 
26  //! compute derivatives for particles1 with respect to particles2
27  /**
28  This method is needed for rigid bodies when particles1 and particles2
29  are particles of two rigid bodies. In this case the particles of the
30  same rigid body are ignored.
31  \param[in] model_profile The current profile of particles
32  \param[in] particles1 Derivative will be computed for each particle
33  \param[in] particles2 Derivative will be computed relative to this set
34  \param[in] derivatives Output vector
35  \param[in] effect_size Effect size
36  */
37  void compute_chisquare_derivative(
38  const Profile* model_profile, const kernel::Particles& particles1,
39  const kernel::Particles& particles2,
40  std::vector<algebra::Vector3D>& derivatives,
41  const std::vector<double>& effect_size) const;
42 
43  //! compute derivatives for particles
44  /**
45  \param[in] model_profile The current profile of particles
46  \param[in] particles Derivative will be computed for each particle
47  \param[in] derivatives Output vector
48  \param[in] effect_size Effect size
49  */
51  const Profile* model_profile, const kernel::Particles& particles,
52  std::vector<algebra::Vector3D>& derivatives,
53  const std::vector<double>& effect_size) const {
54  return compute_chisquare_derivative(model_profile, particles, particles,
55  derivatives, effect_size);
56  }
57 
58  void compute_gaussian_effect_size(const Profile* model_profile, const Float c,
59  const Float offset,
60  std::vector<double>& effect_size) const;
61 
62  protected:
63  /*
64  * precompute sinc_cos function and derivative of distance distribution
65  */
66  DeltaDistributionFunction precompute_derivative_helpers(
67  const Profile* resampled_model_profile,
68  const kernel::Particles& particles1, const kernel::Particles& particles2,
69  std::vector<Floats>& sinc_cos_values) const;
70 
71  /* compute dI(q)/dx_k for given q and k
72  * dI(q)/dx_k = - 2 E^2(q) \sum_l (x_k-x_l)/d_{kl}^2 f_l f_k (sinc(q*d_{kl}) -
73  * * cos(q*d_{kl}))
74  */
75  void compute_intensity_derivatives(
76  const DeltaDistributionFunction& delta_dist,
77  const std::vector<Floats>& sinc_cos_values, unsigned int iq,
78  algebra::Vector3D& dIdx) const;
79 
80  protected:
81  const Profile* exp_profile_; // experimental saxs profile
82 
83  private:
84  void compute_sinc_cos(Float pr_resolution, Float max_distance,
85  const Profile* model_profile,
86  std::vector<Floats>& output_values) const;
87 };
88 
89 IMPSAXS_END_NAMESPACE
90 
91 #endif /* IMPSAXS_DERIVATIVE_CALCULATOR_H */
void compute_chisquare_derivative(const Profile *model_profile, const kernel::Particles &particles, std::vector< algebra::Vector3D > &derivatives, const std::vector< double > &effect_size) const
compute derivatives for particles
computes distribution functions
Common base class for heavy weight IMP objects.
Definition: base/Object.h:106
VectorD< 3 > Vector3D
Definition: VectorD.h:395
double Float
Basic floating-point value (could be float, double...)
Definition: base/types.h:20
A shared base class to help in debugging and things.
A class for profile storing and computation.