BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
IPeakShape.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Correlations/IPeakShape.h
6 //! @brief Defines the interface IPeakShape and subclasses.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef USER_API
16 #ifndef BORNAGAIN_SAMPLE_CORRELATIONS_IPEAKSHAPE_H
17 #define BORNAGAIN_SAMPLE_CORRELATIONS_IPEAKSHAPE_H
18 
19 #include "Base/Types/ICloneable.h"
20 #include "Param/Node/INode.h"
21 #include <heinz/Vectors3D.h>
22 
23 //! Abstract base class class that defines the peak shape of a Bragg peak.
24 
25 class IPeakShape : public ICloneable, public INode {
26 public:
27  IPeakShape() = default;
28  IPeakShape(const std::vector<double>& PValues);
29 
30  ~IPeakShape() override;
31 
32  IPeakShape* clone() const override = 0;
33 
34  //! Peak shape at q from a reciprocal lattice point at q_lattice_point
35  virtual double peakDistribution(R3 q, R3 q_lattice_point) const = 0;
36 
37  //! Indicates if the peak shape encodes angular disorder, in which case all peaks in a
38  //! spherical shell are needed
39  virtual bool angularDisorder() const { return false; }
40 };
41 
42 //! Class that implements an isotropic Gaussian peak shape of a Bragg peak.
43 
45 public:
46  IsotropicGaussPeakShape(double max_intensity, double domainsize);
48 
49  IsotropicGaussPeakShape* clone() const override;
50  std::string className() const final { return "IsotropicGaussPeakShape"; }
51  std::vector<ParaMeta> parDefs() const final
52  {
53  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
54  {"DomainSize", "nm", "domain size", 0, +INF, -1}};
55  }
56 
57  double peakDistribution(R3 q, R3 q_lattice_point) const override;
58 
59 private:
60  double peakDistribution(R3 q) const;
62  double m_domainsize;
63 };
64 
65 //! An isotropic Lorentzian peak shape of a Bragg peak.
66 
68 public:
69  IsotropicLorentzPeakShape(double max_intensity, double domainsize);
71 
72  IsotropicLorentzPeakShape* clone() const override;
73  std::string className() const final { return "IsotropicLorentzPeakShape"; }
74  std::vector<ParaMeta> parDefs() const final
75  {
76  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
77  {"DomainSize", "nm", "domain size", 0, +INF, -1}};
78  }
79 
80  double peakDistribution(R3 q, R3 q_lattice_point) const override;
81 
82 private:
83  double peakDistribution(R3 q) const;
85  double m_domainsize;
86 };
87 
88 //! A peak shape that is Gaussian in the radial direction and
89 //! uses the Mises-Fisher distribution in the angular direction.
90 
92 public:
93  GaussFisherPeakShape(double max_intensity, double radial_size, double kappa);
95 
96  GaussFisherPeakShape* clone() const override;
97  std::string className() const final { return "GaussFisherPeakShape"; }
98  std::vector<ParaMeta> parDefs() const final
99  {
100  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
101  {"DomainSize", "nm", "domain size", 0, +INF, -1},
102  {"Kappa", "", "?", 0, +INF, -1}};
103  }
104 
105  double peakDistribution(R3 q, R3 q_lattice_point) const override;
106 
107  bool angularDisorder() const override { return true; }
108 
109 private:
112  double m_kappa;
113 };
114 
115 //! A peak shape that is Lorentzian in the radial direction and uses the
116 //! Mises-Fisher distribution in the angular direction.
117 
119 public:
120  LorentzFisherPeakShape(double max_intensity, double radial_size, double kappa);
122 
123  LorentzFisherPeakShape* clone() const override;
124  std::string className() const final { return "LorentzFisherPeakShape"; }
125  std::vector<ParaMeta> parDefs() const final
126  {
127  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
128  {"DomainSize", "nm", "domain size", 0, +INF, -1},
129  {"Kappa", "", "?", 0, +INF, -1}};
130  }
131 
132  double peakDistribution(R3 q, R3 q_lattice_point) const override;
133 
134  bool angularDisorder() const override { return true; }
135 
136 private:
139  double m_kappa;
140 };
141 
142 //! A peak shape that is Gaussian in the radial direction and a convolution of a
143 //! Mises-Fisher distribution with a Mises distribution on the two-sphere.
144 
146 public:
147  MisesFisherGaussPeakShape(double max_intensity, double radial_size, R3 zenith, double kappa_1,
148  double kappa_2);
150 
151  MisesFisherGaussPeakShape* clone() const override;
152  std::string className() const final { return "MisesFisherGaussPeakShape"; }
153  std::vector<ParaMeta> parDefs() const final
154  {
155  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
156  {"Radial Size", "nm", "radial size", 0, +INF, -1},
157  {"Kappa1", "", "?", 0, +INF, -1},
158  {"Kappa2", "", "?", 0, +INF, -1}};
159  }
160 
161  double peakDistribution(R3 q, R3 q_lattice_point) const override;
162 
163  bool angularDisorder() const override { return true; }
164 
165 private:
170 };
171 
172 //! A peak shape that is a convolution of a Mises-Fisher distribution with a 3d Gaussian.
173 
175 public:
176  MisesGaussPeakShape(double max_intensity, double radial_size, R3 zenith, double kappa);
178 
179  MisesGaussPeakShape* clone() const override;
180  std::string className() const final { return "MisesGaussPeakShape"; }
181  std::vector<ParaMeta> parDefs() const final
182  {
183  return {{"MaxIntensity", "", "maximum intensity", 0, +INF, -1},
184  {"Radial Size", "nm", "radial size", 0, +INF, -1},
185  {"Kappa", "", "?", 0, +INF, -1}};
186  }
187 
188  double peakDistribution(R3 q, R3 q_lattice_point) const override;
189 
190  bool angularDisorder() const override { return true; }
191 
192 private:
196  double m_kappa;
197 };
198 
199 #endif // BORNAGAIN_SAMPLE_CORRELATIONS_IPEAKSHAPE_H
200 #endif // USER_API
Defines and implements the standard mix-in ICloneable.
Defines interface INode.
const double INF
Definition: INode.h:26
A peak shape that is Gaussian in the radial direction and uses the Mises-Fisher distribution in the a...
Definition: IPeakShape.h:91
bool angularDisorder() const override
Indicates if the peak shape encodes angular disorder, in which case all peaks in a spherical shell ar...
Definition: IPeakShape.h:107
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:98
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:154
GaussFisherPeakShape(double max_intensity, double radial_size, double kappa)
Definition: IPeakShape.cpp:140
GaussFisherPeakShape * clone() const override
Definition: IPeakShape.cpp:149
~GaussFisherPeakShape() override
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:97
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Definition: ICloneable.h:23
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:40
Abstract base class class that defines the peak shape of a Bragg peak.
Definition: IPeakShape.h:25
virtual double peakDistribution(R3 q, R3 q_lattice_point) const =0
Peak shape at q from a reciprocal lattice point at q_lattice_point.
~IPeakShape() override
virtual bool angularDisorder() const
Indicates if the peak shape encodes angular disorder, in which case all peaks in a spherical shell ar...
Definition: IPeakShape.h:39
IPeakShape * clone() const override=0
IPeakShape()=default
Class that implements an isotropic Gaussian peak shape of a Bragg peak.
Definition: IPeakShape.h:44
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:51
IsotropicGaussPeakShape * clone() const override
Definition: IPeakShape.cpp:92
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:50
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:103
~IsotropicGaussPeakShape() override
IsotropicGaussPeakShape(double max_intensity, double domainsize)
Definition: IPeakShape.cpp:84
An isotropic Lorentzian peak shape of a Bragg peak.
Definition: IPeakShape.h:67
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:131
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:73
IsotropicLorentzPeakShape(double max_intensity, double domainsize)
Definition: IPeakShape.cpp:112
IsotropicLorentzPeakShape * clone() const override
Definition: IPeakShape.cpp:120
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:74
~IsotropicLorentzPeakShape() override
A peak shape that is Lorentzian in the radial direction and uses the Mises-Fisher distribution in the...
Definition: IPeakShape.h:118
LorentzFisherPeakShape(double max_intensity, double radial_size, double kappa)
Definition: IPeakShape.cpp:175
~LorentzFisherPeakShape() override
LorentzFisherPeakShape * clone() const override
Definition: IPeakShape.cpp:185
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:190
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:125
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:124
bool angularDisorder() const override
Indicates if the peak shape encodes angular disorder, in which case all peaks in a spherical shell ar...
Definition: IPeakShape.h:134
A peak shape that is Gaussian in the radial direction and a convolution of a Mises-Fisher distributio...
Definition: IPeakShape.h:145
MisesFisherGaussPeakShape(double max_intensity, double radial_size, R3 zenith, double kappa_1, double kappa_2)
Definition: IPeakShape.cpp:210
MisesFisherGaussPeakShape * clone() const override
Definition: IPeakShape.cpp:222
bool angularDisorder() const override
Indicates if the peak shape encodes angular disorder, in which case all peaks in a spherical shell ar...
Definition: IPeakShape.h:163
~MisesFisherGaussPeakShape() override
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:153
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:152
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:228
A peak shape that is a convolution of a Mises-Fisher distribution with a 3d Gaussian.
Definition: IPeakShape.h:174
~MisesGaussPeakShape() override
double peakDistribution(R3 q, R3 q_lattice_point) const override
Peak shape at q from a reciprocal lattice point at q_lattice_point.
Definition: IPeakShape.cpp:286
MisesGaussPeakShape(double max_intensity, double radial_size, R3 zenith, double kappa)
Definition: IPeakShape.cpp:270
bool angularDisorder() const override
Indicates if the peak shape encodes angular disorder, in which case all peaks in a spherical shell ar...
Definition: IPeakShape.h:190
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Definition: IPeakShape.h:180
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
Definition: IPeakShape.h:181
MisesGaussPeakShape * clone() const override
Definition: IPeakShape.cpp:281