BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InterferenceFunction2DParaCrystal.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Aggregate/InterferenceFunction2DParaCrystal.h
6 //! @brief Defines class InterferenceFunction2DParaCrystal.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTION2DPARACRYSTAL_H
16 #define BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTION2DPARACRYSTAL_H
17 
18 #include "Base/Types/Complex.h"
22 #include <memory>
23 
24 class IFTDistribution2D;
25 
26 //! Interference function of a 2D paracrystal.
27 //! @ingroup interference
28 
30 {
31 public:
32  InterferenceFunction2DParaCrystal(const Lattice2D& lattice, double damping_length,
33  double domain_size_1, double domain_size_2);
34 
35  InterferenceFunction2DParaCrystal(double length_1, double length_2, double alpha, double xi,
36  double damping_length);
37 
39 
40  InterferenceFunction2DParaCrystal* clone() const override final;
41 
42  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
43 
44  static InterferenceFunction2DParaCrystal* createSquare(double lattice_length,
45  double damping_length,
46  double domain_size_1,
47  double domain_size_2);
48  static InterferenceFunction2DParaCrystal* createHexagonal(double lattice_length,
49  double damping_length,
50  double domain_size_1,
51  double domain_size_2);
52 
53  void setDomainSizes(double size_1, double size_2);
54 
56  const IFTDistribution2D& pdf_2);
57 
58  void setDampingLength(double damping_length);
59 
60  std::vector<double> domainSizes() const;
61 
62  void setIntegrationOverXi(bool integrate_xi);
63  bool integrationOverXi() const { return m_integrate_xi; }
64  double dampingLength() const { return m_damping_length; }
65 
66  const Lattice2D& lattice() const;
67 
68  double getParticleDensity() const override final;
69 
70  std::vector<const INode*> getChildren() const override final;
71 
72  const IFTDistribution2D* pdf1() const { return m_pdf1.get(); }
73 
74  const IFTDistribution2D* pdf2() const { return m_pdf2.get(); }
75 
76 private:
77  double iff_without_dw(const kvector_t q) const override final;
78  void setLattice(const Lattice2D& lattice);
79 
80  double interferenceForXi(double xi) const;
81  double interference1D(double qx, double qy, double xi, size_t index) const;
82  complex_t FTPDF(double qx, double qy, double xi, size_t index) const;
83  void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double& q_pa_1,
84  double& q_pa_2) const;
85 
86  bool m_integrate_xi; //!< Integrate over the orientation xi
87  std::unique_ptr<IFTDistribution2D> m_pdf1, m_pdf2;
88  std::unique_ptr<Lattice2D> m_lattice; // TODO ASAP name as in other i-fcts
89  double m_damping_length; //!< Damping length for removing delta function singularity at q=0.
90  double m_domain_sizes[2]; //!< Coherence domain sizes
91  mutable double m_qx;
92  mutable double m_qy;
93 };
94 
95 #endif // BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTION2DPARACRYSTAL_H
Defines complex_t, and a few elementary functions.
std::complex< double > complex_t
Definition: Complex.h:20
Defines interface class IFTDistribution2D, and children thereof.
Defines and implements the interface class IInterferenceFunction.
Defines classes of Lattice2D family.
Interface for two-dimensional distributions in Fourier space.
Pure virtual base class of interference functions.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Interference function of a 2D paracrystal.
double getParticleDensity() const override final
If defined by this interference function's parameters, returns the particle density (per area).
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
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)
static InterferenceFunction2DParaCrystal * createHexagonal(double lattice_length, double damping_length, double domain_size_1, double domain_size_2)
Creates hexagonal lattice.
double m_domain_sizes[2]
Coherence domain sizes.
double iff_without_dw(const kvector_t q) const override final
Calculates the structure factor without Debye-Waller factor.
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.
InterferenceFunction2DParaCrystal * clone() const override final
Returns a clone of this ISample object.
void setDampingLength(double damping_length)
Sets the damping length.
std::unique_ptr< IFTDistribution2D > m_pdf2
static InterferenceFunction2DParaCrystal * createSquare(double lattice_length, double damping_length, double domain_size_1, double domain_size_2)
Creates square lattice.
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.
std::vector< const INode * > getChildren() const override final
Returns a vector of children (const).
void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double &q_pa_1, double &q_pa_2) const
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.