BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Interference2DSuperLattice.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Sample/Aggregate/Interference2DSuperLattice.h
6 //! @brief Defines class Interference2DSuperLattice.
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_INTERFERENCE2DSUPERLATTICE_H
16 #define BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCE2DSUPERLATTICE_H
17 
20 
21 //! Interference function of a 2D superlattice with a configurable interference function for
22 //! each lattice site.
23 //! @ingroup interference
24 
26 public:
27  Interference2DSuperLattice(const Lattice2D& lattice, unsigned size_1, unsigned size_2);
28  Interference2DSuperLattice(double length_1, double length_2, double alpha, double xi,
29  unsigned size_1, unsigned size_2);
31 
32  Interference2DSuperLattice* clone() const override;
33  std::string className() const final { return "Interference2DSuperLattice"; }
34  std::vector<ParaMeta> parDefs() const final
35  {
36  return {{"Length1", "nm", "lattice constant 1", 0, +INF, 0},
37  {"Length2", "nm", "lattice constant 2", 0, +INF, 0},
38  {"Alpha", "rad", "angle between lattice vectors 1 and 2", -INF, +INF, 0},
39  {"Xi", "rad", "angle between x axis and lattice vector 1", -INF, +INF, 0}};
40  }
41 
42  void setSubstructureIFF(const IInterference& sub_iff);
43  const IInterference& substructureIFF() const;
44 
45  double structureFactor(R3 q, double outer_iff = 1.0) const override;
46  unsigned domainSize1() const { return m_size_1; }
47  unsigned domainSize2() const { return m_size_2; }
48 
49  void setIntegrationOverXi(bool integrate_xi);
50  bool integrationOverXi() const { return m_integrate_xi; }
51 
52  const Lattice2D& lattice() const;
53 
54  std::vector<const INode*> nodeChildren() const override;
55 
56 private:
57  double iff_without_dw(R3 q) const override;
58  double iff_without_dw(R3 q, double xi) const;
59 
60  double interferenceForXi(double xi, double qx, double qy, double outer_iff) const;
61 
62  bool m_integrate_xi; //!< Integrate over the orientation xi
63  std::unique_ptr<Lattice2D> m_lattice;
64  std::unique_ptr<IInterference> m_substructure; //!< IFF of substructure
65  unsigned m_size_1, m_size_2; //!< Size of the finite lattice in lattice units
66 };
67 
68 #endif // BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCE2DSUPERLATTICE_H
Defines and implements the interface class IInterference.
const double INF
Definition: INode.h:26
Defines classes of Lattice2D family.
Abstract base class of interference functions.
Definition: IInterference.h:24
Interference function of a 2D superlattice with a configurable interference function for each lattice...
~Interference2DSuperLattice() override
void setSubstructureIFF(const IInterference &sub_iff)
std::vector< const INode * > nodeChildren() const override
Returns all children.
std::vector< ParaMeta > parDefs() const final
Returns the parameter definitions, to be hard-coded in each leaf class.
double iff_without_dw(R3 q) const override
Calculates the structure factor without Debye-Waller factor.
Interference2DSuperLattice * clone() const override
std::unique_ptr< IInterference > m_substructure
IFF of substructure.
void setIntegrationOverXi(bool integrate_xi)
unsigned m_size_2
Size of the finite lattice in lattice units.
bool m_integrate_xi
Integrate over the orientation xi.
double interferenceForXi(double xi, double qx, double qy, double outer_iff) const
const IInterference & substructureIFF() const
Interference2DSuperLattice(const Lattice2D &lattice, unsigned size_1, unsigned size_2)
std::string className() const final
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
std::unique_ptr< Lattice2D > m_lattice
double structureFactor(R3 q, double outer_iff=1.0) const override
The interference function for a given wavevector transfer.
A two-dimensional Bravais lattice.
Definition: Lattice2D.h:23