BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
InterferenceFunction2DLattice.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Aggregate/InterferenceFunction2DLattice.h
6 //! @brief Defines class InterferenceFunction2DLattice.
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_INTERFERENCEFUNCTION2DLATTICE_H
16 #define BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTION2DLATTICE_H
17 
22 
23 //! Interference function of a 2D lattice.
24 //! @ingroup interference
25 
27 {
28 public:
29  InterferenceFunction2DLattice(double length_1, double length_2, double alpha, double xi);
32 
33  InterferenceFunction2DLattice* clone() const override final;
34 
35  void accept(INodeVisitor* visitor) const override final { visitor->visit(this); }
36 
37  static InterferenceFunction2DLattice* createSquare(double lattice_length, double xi);
38  static InterferenceFunction2DLattice* createHexagonal(double lattice_length, double xi);
39 
40  void setDecayFunction(const IFTDecayFunction2D& decay);
41 
42  void setIntegrationOverXi(bool integrate_xi);
43  bool integrationOverXi() const { return m_integrate_xi; }
44 
45  const Lattice2D& lattice() const;
46 
47  //! Returns the particle density associated with this 2d lattice
48  double getParticleDensity() const override final;
49 
50  std::vector<const INode*> getChildren() const override final;
51 
52  void onChange() override final;
53 
54 private:
55  double iff_without_dw(const kvector_t q) const override final;
56  void setLattice(const Lattice2D& lattice);
57 
58  double interferenceForXi(double xi) const;
59 
60  //! Returns interference from a single reciprocal lattice vector
61  double interferenceAtOneRecLatticePoint(double qx, double qy) const;
62 
63  //! Returns reciprocal coordinates in the coordinate system rotated by the angle gamma
64  std::pair<double, double> rotateOrthonormal(double qx, double qy, double gamma) const;
65 
66  //! Returns qx,qy coordinates of q - qint, where qint is a reciprocal lattice vector
67  //! bounding the reciprocal unit cell to which q belongs
68  std::pair<double, double> calculateReciprocalVectorFraction(double qx, double qy,
69  double xi) const;
70 
71  //! Initializes the x,y coordinates of the a*,b* reciprocal bases
73 
74  //! Initializes factors needed in each calculation
76 
77  bool m_integrate_xi; //!< Integrate over the orientation xi
78  std::unique_ptr<IFTDecayFunction2D> m_decay;
79  std::unique_ptr<Lattice2D> m_lattice;
80  Lattice2D::ReciprocalBases m_sbase; //!< reciprocal lattice is stored without xi
81  int m_na, m_nb; //!< determines the number of reciprocal lattice points to use
82  mutable double m_qx;
83  mutable double m_qy;
84 };
85 
86 #endif // BORNAGAIN_CORE_AGGREGATE_INTERFERENCEFUNCTION2DLATTICE_H
Defines classes IFTDecayFunction1D, IFTDecayFunction2D,.
Defines classes IFTDecayFunction1D, IFTDecayFunction2D,.
Defines and implements the interface class IInterferenceFunction.
Defines classes of Lattice2D family.
Interface for two-dimensional decay function in reciprocal space.
Definition: FTDecay2D.h:26
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 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.
static InterferenceFunction2DLattice * createSquare(double lattice_length, double xi)
Creates square lattice.
std::pair< double, double > rotateOrthonormal(double qx, double qy, double gamma) const
Returns reciprocal coordinates in the coordinate system rotated by the angle gamma.
void accept(INodeVisitor *visitor) const override final
Calls the INodeVisitor's visit method.
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.