File: IPeakShape.h

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (207 lines) | stat: -rw-r--r-- 6,484 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/Correlation/IPeakShape.h
//! @brief     Defines the interface IPeakShape and subclasses.
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#ifndef BORNAGAIN_SAMPLE_CORRELATION_IPEAKSHAPE_H
#define BORNAGAIN_SAMPLE_CORRELATION_IPEAKSHAPE_H

#include "Base/Type/ICloneable.h"
#include "Param/Node/INode.h"
#include <heinz/Vectors3D.h>

//! Abstract base class class that defines the peak shape of a Bragg peak.

class IPeakShape : public ICloneable, public INode {
public:
    IPeakShape() = default;
    IPeakShape(const std::vector<double>& PValues);

    ~IPeakShape() override;

#ifndef SWIG
    IPeakShape* clone() const override = 0;
#endif // SWIG

    //! Peak shape at q from a reciprocal lattice point at q_lattice_point
    virtual double peakDistribution(const R3& q, const R3& q_lattice_point) const = 0;

    //! Indicates if the peak shape encodes angular disorder, in which case all peaks in a
    //! spherical shell are needed
    virtual bool angularDisorder() const { return false; }
};

//! Class that implements an isotropic Gaussian peak shape of a Bragg peak.

class IsotropicGaussPeakShape : public IPeakShape {
public:
    IsotropicGaussPeakShape(double max_intensity, double domainsize);
    ~IsotropicGaussPeakShape() override;

#ifndef SWIG
    IsotropicGaussPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "IsotropicGaussPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"DomainSize", "nm"}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

private:
    double peakDistribution(const R3& q) const;
    double m_max_intensity;
    double m_domainsize;
};

//! An isotropic Lorentzian peak shape of a Bragg peak.

class IsotropicLorentzPeakShape : public IPeakShape {
public:
    IsotropicLorentzPeakShape(double max_intensity, double domainsize);
    ~IsotropicLorentzPeakShape() override;

#ifndef SWIG
    IsotropicLorentzPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "IsotropicLorentzPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"DomainSize", "nm"}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

private:
    double peakDistribution(const R3& q) const;
    double m_max_intensity;
    double m_domainsize;
};

//! A peak shape that is Gaussian in the radial direction and
//! uses the Mises-Fisher distribution in the angular direction.

class GaussFisherPeakShape : public IPeakShape {
public:
    GaussFisherPeakShape(double max_intensity, double radial_size, double kappa);
    ~GaussFisherPeakShape() override;

#ifndef SWIG
    GaussFisherPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "GaussFisherPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"DomainSize", "nm"}, {"Kappa", ""}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

    bool angularDisorder() const override { return true; }

private:
    double m_max_intensity;
    double m_radial_size;
    double m_kappa;
};

//! A peak shape that is Lorentzian in the radial direction and uses the
//! Mises-Fisher distribution in the angular direction.

class LorentzFisherPeakShape : public IPeakShape {
public:
    LorentzFisherPeakShape(double max_intensity, double radial_size, double kappa);
    ~LorentzFisherPeakShape() override;

#ifndef SWIG
    LorentzFisherPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "LorentzFisherPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"DomainSize", "nm"}, {"Kappa", ""}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

    bool angularDisorder() const override { return true; }

private:
    double m_max_intensity;
    double m_radial_size;
    double m_kappa;
};

//! A peak shape that is Gaussian in the radial direction and a convolution of a
//! Mises-Fisher distribution with a Mises distribution on the two-sphere.

class MisesFisherGaussPeakShape : public IPeakShape {
public:
    MisesFisherGaussPeakShape(double max_intensity, double radial_size, const R3& zenith,
                              double kappa_1, double kappa_2);
    ~MisesFisherGaussPeakShape() override;

#ifndef SWIG
    MisesFisherGaussPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "MisesFisherGaussPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"Radial Size", "nm"}, {"Kappa1", ""}, {"Kappa2", ""}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

    bool angularDisorder() const override { return true; }

private:
    double m_max_intensity;
    double m_radial_size;
    R3 m_zenith;
    double m_kappa_1, m_kappa_2;
};

//! A peak shape that is a convolution of a Mises-Fisher distribution with a 3d Gaussian.

class MisesGaussPeakShape : public IPeakShape {
public:
    MisesGaussPeakShape(double max_intensity, double radial_size, const R3& zenith, double kappa);
    ~MisesGaussPeakShape() override;

#ifndef SWIG
    MisesGaussPeakShape* clone() const override;
#endif // SWIG

    std::string className() const final { return "MisesGaussPeakShape"; }
    std::vector<ParaMeta> parDefs() const final
    {
        return {{"MaxIntensity", ""}, {"Radial Size", "nm"}, {"Kappa", ""}};
    }

    double peakDistribution(const R3& q, const R3& q_lattice_point) const override;

    bool angularDisorder() const override { return true; }

private:
    double m_max_intensity;
    double m_radial_size;
    R3 m_zenith;
    double m_kappa;
};

#endif // BORNAGAIN_SAMPLE_CORRELATION_IPEAKSHAPE_H