23 const double p = 7.0 / 3.0 - 4.0 * std::sqrt(3.0) / M_PI;
24 double Czero(
double packing);
25 double S2(
double packing);
29 InterferenceFunctionHardDisk::InterferenceFunctionHardDisk(
double radius,
double density,
33 setName(
"InterferenceHardDisk");
34 if (m_radius < 0.0 || m_density < 0.0 || packingRatio() > 0.65)
35 throw std::runtime_error(
"InterferenceFunctionHardDisk::validateParameters: "
36 "radius and density must be positive and packing ratio between "
38 registerParameter(
"Radius", &m_radius).setUnit(
"nm").setNonnegative();
39 registerParameter(
"TotalParticleDensity", &m_density).setUnit(
"nm").setNonnegative();
53 double InterferenceFunctionHardDisk::radius()
const
58 double InterferenceFunctionHardDisk::density()
const
63 double InterferenceFunctionHardDisk::iff_without_dw(
const kvector_t q)
const
67 m_q = 2.0 * std::sqrt(qx * qx + qy * qy) * m_radius;
68 m_packing = packingRatio();
69 m_c_zero = Czero(m_packing);
73 *
RealIntegrator().integrate([&](
double x) ->
double {
return integrand(x); }, 0.0, 1.0);
74 double rho = 4.0 * m_packing / M_PI;
75 return 1.0 / (1.0 - rho * c_q);
78 double InterferenceFunctionHardDisk::packingRatio()
const
80 return M_PI * m_radius * m_radius * m_density;
83 double InterferenceFunctionHardDisk::integrand(
double x)
const
85 double cx = m_c_zero * (1.0 + 4.0 * m_packing * (W2(x / 2.0) - 1.0) + m_s2 * x);
91 double Czero(
double packing)
93 double numerator = 1.0 + packing + 3.0 * p * packing * packing - p * std::pow(packing, 3);
94 double denominator = std::pow(1.0 - packing, 3);
95 return -numerator / denominator;
98 double S2(
double packing)
100 double factor = 3.0 * packing * packing / 8.0;
101 double numerator = 8.0 * (1.0 - 2.0 * p) + (25.0 - 9.0 * p) * p * packing
102 - (7.0 - 3.0 * p) * p * packing * packing;
103 double denominator = 1.0 + packing + 3.0 * p * packing * packing - p * std::pow(packing, 3);
104 return factor * numerator / denominator;
109 return 2.0 * (std::acos(x) - x * std::sqrt(1.0 - x * x)) / M_PI;
Defines classes RealIntegrator, ComplexIntegrator.
Defines class InterferenceFunctionHardDisk.
Defines namespace MathFunctions.
Defines class RealParameter.
T y() const
Returns y-component in cartesian coordinate system.
T x() const
Returns x-component in cartesian coordinate system.
Pure virtual base class of interference functions.
Percus-Yevick hard disk interference function.
InterferenceFunctionHardDisk * clone() const override final
Returns a clone of this ISample object.
double getParticleDensity() const override final
If defined by this interference function's parameters, returns the particle density (per area).
To integrate a real function of a real variable.
double Bessel_J0(double x)
Bessel function of the first kind and order 0.