21 FormFactorHollowSphere::FormFactorHollowSphere(
const std::vector<double> P)
24 {{
"MeanRadius",
"nm",
"para_tooltip", 0, +INF, 0},
25 {
"FullWidth",
"nm",
"para_tooltip", 0, +INF, 0}}},
27 m_mean(m_P[0]), m_full_width(m_P[1])
29 if (!checkParameters())
31 "FormFactorHollowSphere::FormFactorHollowSphere:"
32 " mean radius must be bigger than the half width");
36 FormFactorHollowSphere::FormFactorHollowSphere(
double mean,
double full_width)
44 double W = m_full_width;
45 double q2 = std::norm(q.
x()) + std::norm(q.
y()) + std::norm(q.
z());
46 double q_r = std::sqrt(q2);
47 if (q_r * R < std::numeric_limits<double>::epsilon())
48 return (4.0 * M_PI * R * R * R + M_PI * R * W * W) / 3.0;
53 * (4 * std::sin(qR) * std::sin(qW / 2.0) - qW * std::cos(qW / 2.0) * std::sin(qR)
54 - 2.0 * qR * std::cos(qR) * std::sin(qW / 2.0));
55 return nominator / (q2 * q2 * W);
60 mP_shape = std::make_unique<TruncatedEllipsoid>(m_mean, m_mean, m_mean, 2.0 * m_mean, 0.0);
63 bool FormFactorHollowSphere::checkParameters()
const
65 if (m_full_width <= 0.0)
67 if (2.0 * m_mean < m_full_width)
Defines many exception classes in namespace Exceptionss.
Defines M_PI and some more mathematical constants.
Defines class TruncatedEllipsoid.
T z() const
Returns z-component in cartesian coordinate system.
T y() const
Returns y-component in cartesian coordinate system.
T x() const
Returns x-component in cartesian coordinate system.