BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
FuzzySphere.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/SoftParticle/FuzzySphere.cpp
6 //! @brief Implements class FuzzySphere.
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 
18 
19 FuzzySphere::FuzzySphere(const std::vector<double> P)
20  : IFormFactor(P)
21  , m_radius(m_P[0])
22  , m_sigma(m_P[1])
23 {
24  checkNodeArgs();
25  m_shape3D =
26  std::make_unique<TruncatedEllipsoidNet>(m_radius, m_radius, m_radius, 2 * m_radius, 0);
27 }
28 
29 FuzzySphere::FuzzySphere(double mean, double sigma)
30  : FuzzySphere(std::vector<double>{mean, sigma})
31 {
32 }
33 
34 complex_t FuzzySphere::formfactor_at_bottom(C3 q) const
35 {
36  double q2 = std::norm(q.x()) + std::norm(q.y()) + std::norm(q.z());
37  double dw = std::exp(-q2 * m_sigma * m_sigma / 2.0);
39 }
Defines and implements class FuzzySphere.
Declares namespace someff with some form factor functions.
Defines class TruncatedEllipsoidNet.
A sphere with gaussian radius distribution.
Definition: FuzzySphere.h:24
const double & m_radius
Definition: FuzzySphere.h:43
complex_t formfactor_at_bottom(C3 q) const override
Definition: FuzzySphere.cpp:34
const double & m_sigma
Definition: FuzzySphere.h:44
FuzzySphere(std::vector< double > P)
Definition: FuzzySphere.cpp:19
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
complex_t ffSphere(C3 q, double R)
Returns the form factor of a sphere of radius R.