BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
LongBoxLorentz.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/HardParticle/LongBoxLorentz.cpp
6 //! @brief Implements class LongBoxLorentz.
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/BoxNet.h"
18 
19 LongBoxLorentz::LongBoxLorentz(const std::vector<double> P)
20  : IFormFactor(P)
21  , m_length(m_P[0])
22  , m_width(m_P[1])
23  , m_height(m_P[2])
24 {
25  checkNodeArgs();
26  m_shape3D = std::make_unique<BoxNet>(m_length, m_width, m_height);
27 }
28 
29 LongBoxLorentz::LongBoxLorentz(double length, double width, double height)
30  : LongBoxLorentz(std::vector<double>{length, width, height})
31 {
32 }
33 
35 {
36  complex_t qxL2 = 2.5 * std::pow(m_length * q.x(), 2);
37  complex_t qyWdiv2 = m_width * q.y() / 2.0;
38  complex_t qzHdiv2 = m_height * q.z() / 2.0;
39 
40  return m_height * m_length * m_width * std::exp(complex_t(0., 1.) * qzHdiv2) / (1.0 + qxL2)
41  * Math::sinc(qyWdiv2) * Math::sinc(qzHdiv2);
42 }
Defines class BoxNet.
Defines namespace Math.
Defines class LongBoxLorentz.
Abstract base class for Born form factors.
Definition: IFormFactor.h:36
std::unique_ptr< IShape3D > m_shape3D
IShape3D object, used to retrieve vertices (which may be approximate in the case of round shapes)....
Definition: IFormFactor.h:74
void checkNodeArgs() const
Raises exception if a parameter value is invalid.
Definition: INode.cpp:27
The form factor for a long rectangular box.
const double & m_length
complex_t formfactor_at_bottom(C3 q) const override
double width() const
const double & m_width
const double & m_height
LongBoxLorentz(double length, double width, double height)
double height() const
double length() const
double sinc(double x)
sinc function:
Definition: Functions.cpp:52