32 setName(
"Interference2DLattice");
42 double alpha,
double xi)
55 ret->setDecayFunction(*
m_decay);
95 throw std::runtime_error(
"InterferenceFunction2DLattice::lattice() -> Error. "
96 "No lattice defined.");
103 return area == 0.0 ? 0.0 : 1.0 / area;
121 " -> Error! No decay function defined.");
143 for (
int i = -
m_na - 1; i <
m_na + 2; ++i) {
144 for (
int j = -
m_nb - 1; j <
m_nb + 2; ++j) {
157 "InterferenceFunction2DLattice::interferenceAtOneRecLatticePoint"
158 " -> Error! No decay function defined.");
159 double gamma =
m_decay->gamma();
161 return m_decay->evaluate(qXY.first, qXY.second);
168 double q_X = qx * std::cos(gamma) + qy * std::sin(gamma);
169 double q_Y = -qx * std::sin(gamma) + qy * std::cos(gamma);
176 std::pair<double, double>
182 double alpha =
m_lattice->latticeAngle();
184 double qx_rot = qx * std::cos(xi) + qy * std::sin(xi);
185 double qy_rot = -qx * std::sin(xi) + qy * std::cos(xi);
188 int qa_int =
static_cast<int>(std::lround(a * qx_rot /
M_TWOPI));
189 int qb_int =
static_cast<int>(
190 std::lround(b * (qx_rot * std::cos(alpha) + qy_rot * std::sin(alpha)) /
M_TWOPI));
194 return {qx_frac, qy_frac};
201 throw std::runtime_error(
"InterferenceFunction2DLattice::initialize_rec_vectors() -> "
202 "Error. No lattice defined yet");
213 "InterferenceFunction2DLattice::initialize_calc_factors"
214 " -> Error! No decay function defined.");
217 auto q_bounds =
m_decay->boundingReciprocalLatticeCoordinates(
220 m_na =
static_cast<int>(std::lround(q_bounds.first + 0.5));
221 m_nb =
static_cast<int>(std::lround(q_bounds.second + 0.5));
Defines many exception classes in namespace Exceptionss.
Defines classes RealIntegrator, ComplexIntegrator.
Defines class InterferenceFunction2DLattice.
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 decay function in reciprocal space.
virtual IFTDecayFunction2D * clone() const =0
Pure virtual base class of interference functions.
void registerChild(INode *node)
void setName(const std::string &name)
Interference function of a 2D lattice.
void onChange() override final
Action to be taken in inherited class when a parameter has changed.
void initialize_calc_factors()
Initializes factors needed in each calculation.
Lattice2D::ReciprocalBases m_sbase
reciprocal lattice is stored without xi
void initialize_rec_vectors()
Initializes the x,y coordinates of the a*,b* reciprocal bases.
double iff_without_dw(const kvector_t q) const override final
Calculates the structure factor without Debye-Waller factor.
std::pair< double, double > calculateReciprocalVectorFraction(double qx, double qy, double xi) const
Returns qx,qy coordinates of q - qint, where qint is a reciprocal lattice vector bounding the recipro...
bool m_integrate_xi
Integrate over the orientation xi.
bool integrationOverXi() const
static InterferenceFunction2DLattice * createSquare(double lattice_length, double xi)
Creates square lattice.
void setIntegrationOverXi(bool integrate_xi)
std::pair< double, double > rotateOrthonormal(double qx, double qy, double gamma) const
Returns reciprocal coordinates in the coordinate system rotated by the angle gamma.
std::unique_ptr< IFTDecayFunction2D > m_decay
static InterferenceFunction2DLattice * createHexagonal(double lattice_length, double xi)
Creates hexagonal lattice.
int m_nb
determines the number of reciprocal lattice points to use
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
double getParticleDensity() const override final
Returns the particle density associated with this 2d lattice.
double interferenceAtOneRecLatticePoint(double qx, double qy) const
Returns interference from a single reciprocal lattice vector.
std::unique_ptr< Lattice2D > m_lattice
InterferenceFunction2DLattice(double length_1, double length_2, double alpha, double xi)
Constructor of two-dimensional interference function.
void setDecayFunction(const IFTDecayFunction2D &decay)
Sets two-dimensional decay function.
void setLattice(const Lattice2D &lattice)
InterferenceFunction2DLattice * clone() const override final
Returns a clone of this ISample object.
~InterferenceFunction2DLattice() final
const Lattice2D & lattice() const
double interferenceForXi(double xi) const
ReciprocalBases reciprocalBases() const
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)
double m_asy
x,y coordinates of a*
double m_bsy
x,y coordinates of b*