BornAgain  1.19.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 reflection and scattering
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_SAMPLE_AGGREGATE_INTERFERENCEFUNCTION2DLATTICE_H
16 #define BORNAGAIN_SAMPLE_AGGREGATE_INTERFERENCEFUNCTION2DLATTICE_H
17 
22 
23 //! Interference function of a 2D lattice.
24 //! @ingroup interference
25 
27 public:
30 
31  InterferenceFunction2DLattice* clone() const override;
32 
33  void accept(INodeVisitor* visitor) const override { visitor->visit(this); }
34 
35  void setDecayFunction(const IFTDecayFunction2D& decay);
36 
37  void setIntegrationOverXi(bool integrate_xi);
38  bool integrationOverXi() const { return m_integrate_xi; }
39 
40  const Lattice2D& lattice() const;
41 
42  //! Returns the particle density associated with this 2d lattice
43  double getParticleDensity() const override;
44 
45  std::vector<const INode*> getChildren() const override;
46 
47  void onChange() override;
48 
49 private:
50  double iff_without_dw(const kvector_t q) const override;
51 
52  double interferenceForXi(double xi) const;
53 
54  //! Returns interference from a single reciprocal lattice vector
55  double interferenceAtOneRecLatticePoint(double qx, double qy) const;
56 
57  //! Returns reciprocal coordinates in the coordinate system rotated by the angle gamma
58  std::pair<double, double> rotateOrthonormal(double qx, double qy, double gamma) const;
59 
60  //! Returns qx,qy coordinates of q - qint, where qint is a reciprocal lattice vector
61  //! bounding the reciprocal unit cell to which q belongs
62  std::pair<double, double> calculateReciprocalVectorFraction(double qx, double qy,
63  double xi) const;
64 
65  //! Initializes the x,y coordinates of the a*,b* reciprocal bases
67 
68  //! Initializes factors needed in each calculation
70 
71  bool m_integrate_xi; //!< Integrate over the orientation xi
72  std::unique_ptr<IFTDecayFunction2D> m_decay;
73  std::unique_ptr<Lattice2D> m_lattice;
74  Lattice2D::ReciprocalBases m_sbase; //!< reciprocal lattice is stored without xi
75  int m_na, m_nb; //!< determines the number of reciprocal lattice points to use
76  mutable double m_qx;
77  mutable double m_qy;
78 };
79 
80 #endif // BORNAGAIN_SAMPLE_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:27
Abstract base class of interference functions.
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151
Interference function of a 2D lattice.
void accept(INodeVisitor *visitor) const override
Calls the INodeVisitor's visit method.
void initialize_calc_factors()
Initializes factors needed in each calculation.
std::vector< const INode * > getChildren() const override
Returns a vector of children.
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.
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...
double getParticleDensity() const override
Returns the particle density associated with this 2d lattice.
~InterferenceFunction2DLattice() override
bool m_integrate_xi
Integrate over the orientation xi.
InterferenceFunction2DLattice(const Lattice2D &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.
std::unique_ptr< IFTDecayFunction2D > m_decay
InterferenceFunction2DLattice * clone() const override
Returns a clone of this ISampleNode object.
int m_nb
determines the number of reciprocal lattice points to use
double iff_without_dw(const kvector_t q) const override
Calculates the structure factor without Debye-Waller factor.
double interferenceAtOneRecLatticePoint(double qx, double qy) const
Returns interference from a single reciprocal lattice vector.
std::unique_ptr< Lattice2D > m_lattice
void setDecayFunction(const IFTDecayFunction2D &decay)
Sets two-dimensional decay function.
void onChange() override
Action to be taken in inherited class when a parameter has changed.
A two-dimensional Bravais lattice.
Definition: Lattice2D.h:23