BornAgain  1.18.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 scattering at grazing incidence
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 
17 #include "Sample/Shapes/Box.h"
18 
20  : IFormFactorBorn({"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]), m_width(m_P[1]), m_height(m_P[2])
27 {
28  onChange();
29 }
30 
32  : FormFactorLongBoxLorentz(std::vector<double>{length, width, height})
33 {
34 }
35 
37 {
38  complex_t qxL2 = 2.5 * std::pow(m_length * q.x(), 2);
39  complex_t qyWdiv2 = m_width * q.y() / 2.0;
40  complex_t qzHdiv2 = m_height * q.z() / 2.0;
41 
42  return m_height * m_length * m_width * std::exp(complex_t(0., 1.) * qzHdiv2) / (1.0 + qxL2)
43  * MathFunctions::sinc(qyWdiv2) * MathFunctions::sinc(qzHdiv2);
44 }
45 
47  kvector_t translation) const
48 {
49  auto effects = computeSlicingEffects(limits, translation, m_height);
51  m_height - effects.dz_bottom - effects.dz_top);
52  return createTransformedFormFactor(slicedff, rot, effects.position);
53 }
54 
56 {
57  mP_shape = std::make_unique<Box>(m_length, m_width, m_height);
58 }
Defines class Box.
std::complex< double > complex_t
Definition: Complex.h:20
Defines class FormFactorLongBoxLorentz.
IFormFactor * createTransformedFormFactor(const IFormFactor &formfactor, const IRotation &rot, kvector_t translation)
Definition: IFormFactor.cpp:77
const double INF
Definition: INode.h:24
Defines namespace MathFunctions.
T z() const
Returns z-component in cartesian coordinate system.
Definition: BasicVector3D.h:68
T y() const
Returns y-component in cartesian coordinate system.
Definition: BasicVector3D.h:66
T x() const
Returns x-component in cartesian coordinate system.
Definition: BasicVector3D.h:64
The form factor for a long rectangular box.
void onChange() override final
Action to be taken in inherited class when a parameter has changed.
FormFactorLongBoxLorentz(const std::vector< double > P)
IFormFactor * sliceFormFactor(ZLimits limits, const IRotation &rot, kvector_t translation) const override final
Actually slices the form factor or throws an exception.
complex_t evaluate_for_q(cvector_t q) const override final
Returns scattering amplitude for complex scattering wavevector q=k_i-k_f.
Pure virtual base class for Born form factors.
SlicingEffects computeSlicingEffects(ZLimits limits, const kvector_t &position, double height) const
Helper method for slicing.
std::unique_ptr< IShape > mP_shape
IShape object, used to retrieve vertices (which may be approximate in the case of round shapes).
Pure virtual base class for all form factors.
Definition: IFormFactor.h:40
Pure virtual interface for rotations.
Definition: Rotations.h:27
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
Definition: ZLimits.h:41
double sinc(double x)
sinc function: