BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Interference2DParaCrystal.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Aggregate/Interference2DParaCrystal.h
6 //! @brief Defines class Interference2DParaCrystal.
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_SAMPLE_AGGREGATE_INTERFERENCE2DPARACRYSTAL_H
16 #define BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCE2DPARACRYSTAL_H
17 
21 #include <heinz/Complex.h>
22 #include <memory>
23 
24 class IProfile2D;
25 
26 //! Interference function of a 2D paracrystal.
27 //! @ingroup interference
28 
30 public:
31  Interference2DParaCrystal(const Lattice2D& lattice, double damping_length, double domain_size_1,
32  double domain_size_2);
33 
35 
36  Interference2DParaCrystal* clone() const override;
37  std::string className() const final { return "Interference2DParaCrystal"; }
38  std::vector<ParaMeta> parDefs() const final
39  {
40  return {{"DampingLength", "nm", "damping length Lambda", 0, +INF, 0},
41  {"DomainSize 1", "nm", "domain size in lattice direction 1", 0, +INF, 0},
42  {"DomainSize 2", "nm", "domain size in lattice direction 2", 0, +INF, 0}};
43  }
44 
45  void setDomainSizes(double size_1, double size_2);
46 
47  void setProbabilityDistributions(const IProfile2D& pdf_1, const IProfile2D& pdf_2);
48 
49  void setDampingLength(double damping_length);
50 
51  std::vector<double> domainSizes() const;
52 
53  void setIntegrationOverXi(bool integrate_xi);
54  bool integrationOverXi() const { return m_integrate_xi; }
55  double dampingLength() const { return m_damping_length; }
56 
57  const Lattice2D& lattice() const;
58 
59  double particleDensity() const override;
60 
61  std::vector<const INode*> nodeChildren() const override;
62 
63  const IProfile2D* pdf1() const { return m_pdf1.get(); }
64 
65  const IProfile2D* pdf2() const { return m_pdf2.get(); }
66 
67 private:
68  double iff_without_dw(R3 q) const override;
69 
70  double interferenceForXi(double xi, double qx, double qy) const;
71  double interference1D(double qx, double qy, double xi, size_t index) const;
72  complex_t FTPDF(double qx, double qy, double xi, size_t index) const;
73  void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double& q_pa_1,
74  double& q_pa_2) const;
75 
76  bool m_integrate_xi; //!< Integrate over the orientation xi
77  std::unique_ptr<IProfile2D> m_pdf1, m_pdf2;
78  std::unique_ptr<Lattice2D> m_lattice; // TODO ASAP name as in other i-fcts
79  double m_damping_length; //!< Damping length for removing delta function singularity at q=0.
80  double m_domain_sizes[2]; //!< Coherence domain sizes
81 };
82 
83 #endif // BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCE2DPARACRYSTAL_H
Defines and implements the interface class IInterference.
const double INF
Definition: INode.h:26
Defines classes of Lattice2D family.
Defines interface class IProfile2D, and children thereof.
Abstract base class of interference functions.
Definition: IInterference.h:24
Interface for two-dimensional distributions in Fourier space.
Definition: Profiles2D.h:29
Interference function of a 2D paracrystal.
~Interference2DParaCrystal() override
double interferenceForXi(double xi, double qx, double qy) const
Returns interference function for fixed angle xi.
Interference2DParaCrystal * clone() const override
bool m_integrate_xi
Integrate over the orientation xi.
std::unique_ptr< Lattice2D > m_lattice
const IProfile2D * pdf1() const
double iff_without_dw(R3 q) const override
Calculates the structure factor without Debye-Waller factor.
const Lattice2D & lattice() 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.
std::vector< const INode * > nodeChildren() const override
Returns all children.
void setDampingLength(double damping_length)
Sets the damping length.
double m_domain_sizes[2]
Coherence domain sizes.
complex_t FTPDF(double qx, double qy, double xi, size_t index) const
double particleDensity() const override
If defined by this interference function's parameters, returns the particle density (per area)....
void transformToPrincipalAxes(double qx, double qy, double gamma, double delta, double &q_pa_1, double &q_pa_2) const
void setProbabilityDistributions(const IProfile2D &pdf_1, const IProfile2D &pdf_2)
Sets the probability distributions (Fourier transformed) for the two lattice directions.
Interference2DParaCrystal(const Lattice2D &lattice, double damping_length, double domain_size_1, double domain_size_2)
std::unique_ptr< IProfile2D > m_pdf1
const IProfile2D * pdf2() const
std::unique_ptr< IProfile2D > m_pdf2
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
void setDomainSizes(double size_1, double size_2)
Sets the sizes of coherence domains.
double m_damping_length
Damping length for removing delta function singularity at q=0.
void setIntegrationOverXi(bool integrate_xi)
Enables/disables averaging over the lattice rotation angle.
std::vector< double > domainSizes() const
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
A two-dimensional Bravais lattice.
Definition: Lattice2D.h:23
double gamma(double x)