IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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/Object.h>
15
16IMPSAXS_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*/
22class IMPSAXSEXPORT DerivativeCalculator : public 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 */
38 const Profile* model_profile, const Particles& particles1,
39 const Particles& particles2,
40 Vector<algebra::Vector3D>& derivatives,
41 const 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 Particles& particles,
52 Vector<algebra::Vector3D>& derivatives,
53 const 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 double c,
59 const double offset,
60 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 Particles& particles1, const Particles& particles2,
69 Vector<Vector<double>>& 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 Vector<Vector<double>>& 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(double pr_resolution, double max_distance,
85 const Profile* model_profile,
86 Vector<Vector<double>>& output_values) const;
87};
88
89IMPSAXS_END_NAMESPACE
90
91#endif /* IMPSAXS_DERIVATIVE_CALCULATOR_H */
computes distribution functions
A shared base class to help in debugging and things.
A class for profile storing and computation.
Object(std::string name)
Construct an object with the given name.
A more IMP-like version of the std::vector.
Definition Vector.h:60
void compute_chisquare_derivative(const Profile *model_profile, const Particles &particles1, const Particles &particles2, Vector< algebra::Vector3D > &derivatives, const Vector< double > &effect_size) const
compute derivatives for particles1 with respect to particles2
void compute_chisquare_derivative(const Profile *model_profile, const Particles &particles, Vector< algebra::Vector3D > &derivatives, const Vector< double > &effect_size) const
compute derivatives for particles
Vector< Pointer< Particle > > Particles
A list of reference-counted Particle objects.
Definition base_types.h:138
VectorD< 3 > Vector3D
Definition VectorD.h:407