22 double damping_length,
27 setName(
"Interference2DParaCrystal");
73 return area == 0.0 ? 0.0 : 1.0 / area;
103 double delta,
double& q_pa_1,
104 double& q_pa_2)
const
106 q_pa_1 = qx * std::cos(gamma) + qy * std::sin(gamma);
107 q_pa_2 = qx * std::cos(gamma + delta) + qy * std::sin(gamma + delta);
124 throw std::runtime_error(
"InterferenceFunction2DParaCrystal::"
125 "interference1D() -> Error! Index of interference function "
126 "probability must be < 2");
128 throw std::runtime_error(
"InterferenceFunction2DParaCrystal::"
129 "interference1D() -> Error! Probability distributions for "
130 "interference function not properly initialized");
133 int n =
static_cast<int>(std::abs(
m_domain_sizes[index] / length));
134 double nd =
static_cast<double>(n);
137 return ((1.0 + fp) / (1.0 - fp)).real();
138 if (std::norm(1.0 - fp) < std::numeric_limits<double>::epsilon())
141 if (std::abs(1.0 - fp) * nd < 2e-4) {
143 (nd - 1.0) / 2.0 + (nd * nd - 1.0) * (fp - 1.0) / 6.0
144 + (nd * nd * nd - 2.0 * nd * nd - nd + 2.0) * (fp - 1.0) * (fp - 1.0) / 24.0;
145 return 1.0 + 2.0 * intermediate.real();
148 if (std::abs(fp) == 0.0
149 || std::log(std::abs(fp)) * nd < std::log(std::numeric_limits<double>::min()))
152 tmp = std::pow(fp, n);
153 complex_t intermediate = fp / (1.0 - fp) - fp * (1.0 - tmp) / nd / (1.0 - fp) / (1.0 - fp);
154 return 1.0 + 2.0 * intermediate.real();
163 double qa = qx * length * std::cos(xi) + qy * length * std::sin(xi);
167 double gamma = xi + pdf->
gamma();
168 double delta = pdf->
delta();
170 double amplitude = pdf->
evaluate(qp1, qp2);
194 throw std::runtime_error(
"InterferenceFunction2DParaCrystal::lattice() -> Error. "
195 "No lattice defined.");
std::complex< double > complex_t
complex_t exp_I(complex_t z)
Returns exp(I*z), where I is the imaginary unit.
Defines classes RealIntegrator, ComplexIntegrator.
Defines class InterferenceFunction2DParaCrystal.
Defines class ParameterPool.
Defines class RealParameter.
T y() const
Returns y-component in cartesian coordinate system.
T x() const
Returns x-component in cartesian coordinate system.
Interface for two-dimensional distributions in Fourier space.
IFTDistribution2D * clone() const =0
double delta() const
Angle in direct space between X- and Y-axis of distribution.
virtual double evaluate(double qx, double qy) const =0
evaluate Fourier transformed distribution for q in X,Y coordinates the original distribution (in real...
Abstract base class of interference functions.
void registerChild(INode *node)
void setName(const std::string &name)
RealParameter & registerParameter(const std::string &name, double *parpointer)
Interference function of a 2D paracrystal.
double getParticleDensity() const override
If defined by this interference function's parameters, returns the particle density (per area).
void setProbabilityDistributions(const IFTDistribution2D &pdf_1, const IFTDistribution2D &pdf_2)
Sets the probability distributions (Fourier transformed) for the two lattice directions.
InterferenceFunction2DParaCrystal(const Lattice2D &lattice, double damping_length, double domain_size_1, double domain_size_2)
double iff_without_dw(const kvector_t q) const override
Calculates the structure factor without Debye-Waller factor.
std::vector< double > domainSizes() const
double m_domain_sizes[2]
Coherence domain sizes.
InterferenceFunction2DParaCrystal * clone() const override
Returns a clone of this ISampleNode object.
std::unique_ptr< IFTDistribution2D > m_pdf1
void setIntegrationOverXi(bool integrate_xi)
Enables/disables averaging over the lattice rotation angle.
bool m_integrate_xi
Integrate over the orientation xi.
double m_damping_length
Damping length for removing delta function singularity at q=0.
void setDampingLength(double damping_length)
Sets the damping length.
std::unique_ptr< IFTDistribution2D > m_pdf2
~InterferenceFunction2DParaCrystal() override
const Lattice2D & lattice() const
double interferenceForXi(double xi) const
Returns interference function for fixed angle xi.
complex_t FTPDF(double qx, double qy, double xi, size_t index) const
void setDomainSizes(double size_1, double size_2)
Sets the sizes of coherence domains.
void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double &q_pa_1, double &q_pa_2) const
std::vector< const INode * > getChildren() const override
Returns a vector of children.
std::unique_ptr< Lattice2D > m_lattice
double interference1D(double qx, double qy, double xi, size_t index) const
Returns interference function for fixed xi in the dimension determined by the given index.
A two-dimensional Bravais lattice.
virtual Lattice2D * clone() const =0
To integrate a real function of a real variable.
double integrate(const std::function< double(double)> &f, double lmin, double lmax)
RealParameter & setNonnegative()
RealParameter & setUnit(const std::string &name)