Skip to content
Snippets Groups Projects
Commit 967b2e2b authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Optimize TruncatedSphere ff

parent 56f2d18c
No related branches found
No related tags found
1 merge request!1145Optimize integrands in form factor quadrature
......@@ -43,13 +43,13 @@ complex_t TruncatedSphere::formfactor_at_bottom(C3 q) const
* (m_height * m_height * (3. * m_radius - m_height)
- m_dh * m_dh * (3. * m_radius - m_dh));
const complex_t Q2 = std::sqrt(q.x() * q.x() + q.y() * q.y()); // NOT the modulus!
const double R2 = m_radius * m_radius;
complex_t integral = ComplexIntegrator().integrate(
[=](double Z) {
double Rz = std::sqrt(m_radius * m_radius - Z * Z);
complex_t qx = q.x();
complex_t qy = q.y();
complex_t q_p = std::sqrt(qx * qx + qy * qy); // NOT the modulus!
return Rz * Rz * Math::Bessel::J1c(q_p * Rz) * exp_I(q.z() * Z);
const double R2Z2 = R2 - Z * Z;
return R2Z2 * Math::Bessel::J1c(Q2 * sqrt(R2Z2)) * exp_I(q.z() * Z);
},
m_radius - m_height, m_radius - m_dh);
return M_TWOPI * integral * exp_I(q.z() * (m_height - m_radius));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment