23 FormFactorTruncatedSpheroid::FormFactorTruncatedSpheroid(
const std::vector<double> P)
27 {{
"Radius",
"nm",
"horizontal radius", 0, +INF, 0},
28 {
"Height",
"nm",
"height before removal of cap", 0, +INF, 0},
29 {
"HeightFlattening",
"",
"ratio of vertical to horizontal radius", 0, +INF, 0},
30 {
"DeltaHeight",
"nm",
"height of removed cap", 0, +INF, 0}}},
32 m_radius(m_P[0]), m_height(m_P[1]), m_height_flattening(m_P[2]), m_dh(m_P[3])
34 check_initialization();
38 FormFactorTruncatedSpheroid::FormFactorTruncatedSpheroid(
double radius,
double height,
39 double height_flattening,
double dh)
44 bool FormFactorTruncatedSpheroid::check_initialization()
const
47 if (m_height > 2. * m_radius * m_height_flattening || m_dh > m_height) {
48 std::ostringstream ostr;
49 ostr <<
"::FormFactorTruncatedSpheroid() -> Error in class initialization with parameters ";
50 ostr <<
" radius:" << m_radius;
51 ostr <<
" height:" << m_height;
52 ostr <<
" height_flattening:" << m_height_flattening <<
"\n\n";
53 ostr <<
"Check for 'height <= 2.*radius*height_flattening' failed.";
60 complex_t FormFactorTruncatedSpheroid::Integrand(
double Z)
const
63 double fp = m_height_flattening;
65 double Rz = std::sqrt(R * R - Z * Z / (fp * fp));
66 complex_t qrRz = std::sqrt(m_q.
x() * m_q.
x() + m_q.
y() * m_q.
y()) * Rz;
69 return Rz * Rz * J1_qrRz_div_qrRz *
exp_I(m_q.
z() * Z);
76 double fp = m_height_flattening;
79 if (std::abs(m_q.
mag()) <= std::numeric_limits<double>::epsilon())
80 return M_PI / 3. / fp * (H * H * (3. * R - H / fp) - m_dh * m_dh * (3. * R - m_dh / fp));
81 complex_t z_part =
exp_I(m_q.
z() * (H - fp * R));
82 return M_TWOPI * z_part
83 *
ComplexIntegrator().integrate([&](
double Z) {
return Integrand(Z); }, fp * R - H,
90 double height = m_height - m_dh;
93 effects.dz_top + m_dh);
94 return createTransformedFormFactor(slicedff, rot, effects.position);
100 new TruncatedEllipsoid(m_radius, m_radius, m_height_flattening * m_radius, m_height, m_dh));
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Defines many exception classes in namespace Exceptionss.
Defines classes RealIntegrator, ComplexIntegrator.
Defines M_PI and some more mathematical constants.
Defines namespace MathFunctions.
Defines class TruncatedEllipsoid.
double mag() const
Returns magnitude of the vector.
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.
To integrate a complex function of a real variable.
Pure virtual interface for rotations.
Class that contains upper and lower limits of the z-coordinate for the slicing of form factors.
double Bessel_J1c(double x)
Bessel function Bessel_J1(x)/x.