BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FormFactorLongBoxLorentz.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/FormFactorLongBoxLorentz.cpp
6 //! @brief Implements class FormFactorLongBoxLorentz.
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 
16 #include "Base/Math/Functions.h"
17 #include "Sample/Shapes/Box.h"
18 
20  : IBornFF({"FormFactorLongBoxLorentz",
21  "class_tooltip",
22  {{"Length", "nm", "para_tooltip", 0, +INF, 0},
23  {"Width", "nm", "para_tooltip", 0, +INF, 0},
24  {"Height", "nm", "para_tooltip", 0, +INF, 0}}},
25  P)
26  , m_length(m_P[0])
27  , m_width(m_P[1])
28  , m_height(m_P[2])
29 {
30  onChange();
31 }
32 
33 FormFactorLongBoxLorentz::FormFactorLongBoxLorentz(double length, double width, double height)
34  : FormFactorLongBoxLorentz(std::vector<double>{length, width, height})
35 {
36 }
37 
39 {
40  complex_t qxL2 = 2.5 * std::pow(m_length * q.x(), 2);
41  complex_t qyWdiv2 = m_width * q.y() / 2.0;
42  complex_t qzHdiv2 = m_height * q.z() / 2.0;
43 
44  return m_height * m_length * m_width * std::exp(complex_t(0., 1.) * qzHdiv2) / (1.0 + qxL2)
45  * Math::sinc(qyWdiv2) * Math::sinc(qzHdiv2);
46 }
47 
49  kvector_t translation) const
50 {
51  auto effects = computeSlicingEffects(limits, translation, m_height);
53  m_height - effects.dz_bottom - effects.dz_top);
54  return createTransformedFormFactor(slicedff, rot, effects.position);
55 }
56 
58 {
59  m_shape3D = std::make_unique<Box>(m_length, m_width, m_height);
60 }
Defines class Box.
std::complex< double > complex_t
Definition: Complex.h:20
Defines class FormFactorLongBoxLorentz.
Defines functions in namespace Math.
const double INF
Definition: INode.h:25
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:67
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:65
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:63
The form factor for a long rectangular box.
complex_t evaluate_for_q(cvector_t q) const final
Returns scattering amplitude for complex scattering wavevector q=k_i-k_f.
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const final
Actually slices the form factor or throws an exception.
FormFactorLongBoxLorentz(const std::vector< double > P)
void onChange() final
Action to be taken in inherited class when a parameter has changed.
Abstract base class for Born form factors.
Definition: IBornFF.h:41
std::unique_ptr< IShape3D > m_shape3D
IShape3D object, used to retrieve vertices (which may be approximate in the case of round shapes).
Definition: IBornFF.h:77
static SlicingEffects computeSlicingEffects(ZLimits limits, const kvector_t &position, double height)
Helper method for slicing.
Definition: IBornFF.cpp:66
Abstract base class for all form factors.
Definition: IFormFactor.h:36
static IFormFactor * createTransformedFormFactor(const IFormFactor &formfactor, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:99
Abstract base class for rotations.
Definition: Rotations.h:28
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:45
double sinc(double x)
sinc function:
Definition: Functions.cpp:53
Definition: filesystem.h:81