23 const double p = 7.0 / 3.0 - 4.0 * std::sqrt(3.0) /
M_PI;
25 double Czero(
double packing)
27 double numerator = 1.0 + packing + 3.0 * p * packing * packing - p * std::pow(packing, 3);
28 double denominator = std::pow(1.0 - packing, 3);
29 return -numerator / denominator;
32 double S2(
double packing)
34 double factor = 3.0 * packing * packing / 8.0;
35 double numerator = 8.0 * (1.0 - 2.0 * p) + (25.0 - 9.0 * p) * p * packing
36 - (7.0 - 3.0 * p) * p * packing * packing;
37 double denominator = 1.0 + packing + 3.0 * p * packing * packing - p * std::pow(packing, 3);
38 return factor * numerator / denominator;
43 return 2.0 * (std::acos(x) - x * std::sqrt(1.0 - x * x)) /
M_PI;
55 throw std::runtime_error(
"InterferenceHardDisk::validateParameters: "
56 "radius and density must be positive and packing ratio between "
85 const double qx = q.x();
86 const double qy = q.y();
87 const double q2r = 2.0 * std::sqrt(qx * qx + qy * qy) *
m_radius;
89 const double c_zero = Czero(packing);
90 const double s2 = S2(packing);
91 const double c_q = 2.0 *
M_PI
93 [=](
double x) ->
double {
95 c_zero * (1.0 + 4.0 * packing * (W2(x / 2.0) - 1.0) + s2 * x);
99 const double rho = 4.0 * packing /
M_PI;
100 return 1.0 / (1.0 - rho * c_q);
Defines Bessel functions in namespace Math.
Defines classes RealIntegrator, ComplexIntegrator.
Defines class InterferenceHardDisk.
Defines class RealLimits.
Abstract base class of interference functions.
Percus-Yevick hard disk interference function.
double iff_without_dw(R3 q) const override
Calculates the structure factor without Debye-Waller factor.
InterferenceHardDisk * clone() const override
InterferenceHardDisk(double radius, double density, double position_var=0)
double packingRatio() const
double particleDensity() const override
If defined by this interference function's parameters, returns the particle density (per area)....
To integrate a real function of a real variable.
double integrate(const std::function< double(double)> &f, double lmin, double lmax)
void check(const std::string &name, double value) const
Throws if value is outside limits. Parameter 'name' is for exception message.
static RealLimits nonnegative()
Creates an object which can have only positive values with 0. included.
double J0(double x)
Bessel function of the first kind and order 0.