BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ILatticeOrientation.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/Lattice/ILatticeOrientation.h
6 //! @brief Defines interface ILatticeOrientation and subclasses.
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_LATTICE_ILATTICEORIENTATION_H
16 #define BORNAGAIN_CORE_LATTICE_ILATTICEORIENTATION_H
17 
19 #include "Sample/Lattice/Lattice.h"
20 
22 {
23 public:
24  virtual ~ILatticeOrientation();
25 
26  virtual ILatticeOrientation* clone() const = 0;
27 
28  virtual void usePrimitiveLattice(const Lattice& lattice) = 0;
29 
30  virtual Transform3D transformationMatrix() const = 0;
31 };
32 
33 //! A direction in reciprocal space, specified by double-valued indices hkl.
34 struct MillerIndex {
35  MillerIndex(double h_, double k_, double l_);
36  double h, k, l;
37 };
38 
39 //! Specifies a rotation of a lattice through the Miller indices of two coordinate axes.
40 
42 {
43 public:
44  enum QComponent { QX, QY, QZ };
45 
46  //! This constructor is best explained by an example.
47  //! Arguments QX, (1,1,0), QY, (0,2,1) mean:
48  //! Rotate the lattice such that the axis [110] points into x direction,
49  //! and the axis [021], projected into the yz plane, points into z direction.
50  MillerIndexOrientation(QComponent q1, MillerIndex index1, QComponent q2, MillerIndex index2);
51  ~MillerIndexOrientation() override;
52 
53  MillerIndexOrientation* clone() const override;
54 
55  void usePrimitiveLattice(const Lattice& lattice) override;
56 
57  Transform3D transformationMatrix() const override;
58 
59 private:
60  bool checkAlignment() const;
61  Lattice m_prim_lattice;
62  QComponent m_q1, m_q2;
63  MillerIndex m_ind1, m_ind2;
64 };
65 
66 #endif // BORNAGAIN_CORE_LATTICE_ILATTICEORIENTATION_H
Defines class Lattice.
Declares class Transform3D.
A lattice with three basis vectors.
Definition: Lattice.h:28
Specifies a rotation of a lattice through the Miller indices of two coordinate axes.
MillerIndexOrientation(QComponent q1, MillerIndex index1, QComponent q2, MillerIndex index2)
This constructor is best explained by an example.
Vector transformations in three dimensions.
Definition: Transform3D.h:28
A direction in reciprocal space, specified by double-valued indices hkl.