BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MillerIndexOrientation Class Reference
Inheritance diagram for MillerIndexOrientation:
Collaboration diagram for MillerIndexOrientation:

Public Types

enum  QComponent { QX , QY , QZ }
 

Public Member Functions

 MillerIndexOrientation (QComponent q1, MillerIndex index1, QComponent q2, MillerIndex index2)
 
 ~MillerIndexOrientation () override
 
MillerIndexOrientationclone () const override
 
void usePrimitiveLattice (const Lattice &lattice) override
 
Transform3D transformationMatrix () const override
 

Private Member Functions

bool checkAlignment () const
 

Private Attributes

Lattice m_prim_lattice
 
QComponent m_q1
 
QComponent m_q2
 
MillerIndex m_ind1
 
MillerIndex m_ind2
 

Detailed Description

Specifies a rotation of a lattice through the Miller indices of two coordinate axes.

Definition at line 41 of file ILatticeOrientation.h.

Member Enumeration Documentation

◆ QComponent

Constructor & Destructor Documentation

◆ MillerIndexOrientation()

MillerIndexOrientation::MillerIndexOrientation ( MillerIndexOrientation::QComponent  q1,
MillerIndex  index1,
MillerIndexOrientation::QComponent  q2,
MillerIndex  index2 
)

This constructor is best explained by an example.

Arguments QX, (1,1,0), QY, (0,2,1) mean: Rotate the lattice such that the axis [110] points into x direction, and the axis [021], projected into the yz plane, points into z direction.

Definition at line 33 of file ILatticeOrientation.cpp.

37  : m_prim_lattice(), m_q1(q1), m_q2(q2), m_ind1{index1}, m_ind2{index2}
38 {
39  if (!checkAlignment())
40  throw std::runtime_error("MillerIndexOrientation constructor: "
41  "invalid alignment parameters");
42 }

References checkAlignment().

Referenced by clone().

Here is the call graph for this function:

◆ ~MillerIndexOrientation()

MillerIndexOrientation::~MillerIndexOrientation ( )
overridedefault

Member Function Documentation

◆ clone()

MillerIndexOrientation * MillerIndexOrientation::clone ( ) const
overridevirtual

Implements ILatticeOrientation.

Definition at line 44 of file ILatticeOrientation.cpp.

45 {
46  auto* result = new MillerIndexOrientation(m_q1, m_ind1, m_q2, m_ind2);
47  result->usePrimitiveLattice(m_prim_lattice);
48  return result;
49 }
MillerIndexOrientation(QComponent q1, MillerIndex index1, QComponent q2, MillerIndex index2)
This constructor is best explained by an example.

References m_ind1, m_ind2, m_prim_lattice, m_q1, m_q2, and MillerIndexOrientation().

Here is the call graph for this function:

◆ usePrimitiveLattice()

void MillerIndexOrientation::usePrimitiveLattice ( const Lattice lattice)
overridevirtual

Implements ILatticeOrientation.

Definition at line 53 of file ILatticeOrientation.cpp.

54 {
56  lattice.getBasisVectorC());
57 }
void resetBasis(const kvector_t a1, const kvector_t a2, const kvector_t a3)
Resets the basis vectors.
Definition: Lattice.cpp:72
kvector_t getBasisVectorB() const
Returns basis vector b.
Definition: Lattice.h:47
kvector_t getBasisVectorC() const
Returns basis vector c.
Definition: Lattice.h:50
kvector_t getBasisVectorA() const
Returns basis vector a.
Definition: Lattice.h:44

References Lattice::getBasisVectorA(), Lattice::getBasisVectorB(), Lattice::getBasisVectorC(), m_prim_lattice, and Lattice::resetBasis().

Here is the call graph for this function:

◆ transformationMatrix()

Transform3D MillerIndexOrientation::transformationMatrix ( ) const
overridevirtual

Implements ILatticeOrientation.

Definition at line 59 of file ILatticeOrientation.cpp.

60 {
63  auto dir_2_parallel = dir_2.project(dir_1);
64  dir_2 = (dir_2 - dir_2_parallel).unit();
65  auto dir_3 = SignForCrossProduct(m_q1, m_q2) * dir_1.cross(dir_2);
66  auto q3 = ThirdQComponent(m_q1, m_q2);
67  Eigen::Matrix3d rot_matrix;
68  FillVectorInRow(rot_matrix, dir_1, m_q1);
69  FillVectorInRow(rot_matrix, dir_2, m_q2);
70  FillVectorInRow(rot_matrix, dir_3, q3);
71  return Transform3D(rot_matrix);
72 }
BasicVector3D< T > project(const BasicVector3D< T > &v) const
Returns projection of this onto other vector: (this*v)*v/|v|^2.
kvector_t getMillerDirection(double h, double k, double l) const
Returns normalized direction corresponding to the given Miller indices.
Definition: Lattice.cpp:80
Vector transformations in three dimensions.
Definition: Transform3D.h:28
MillerIndexOrientation::QComponent ThirdQComponent(MillerIndexOrientation::QComponent q1, MillerIndexOrientation::QComponent q2)
double SignForCrossProduct(MillerIndexOrientation::QComponent q1, MillerIndexOrientation::QComponent q2)
void FillVectorInRow(Eigen::Matrix3d &matrix, kvector_t vec, MillerIndexOrientation::QComponent row)

References anonymous_namespace{ILatticeOrientation.cpp}::FillVectorInRow(), Lattice::getMillerDirection(), MillerIndex::h, MillerIndex::k, MillerIndex::l, m_ind1, m_ind2, m_prim_lattice, m_q1, m_q2, BasicVector3D< T >::project(), anonymous_namespace{ILatticeOrientation.cpp}::SignForCrossProduct(), and anonymous_namespace{ILatticeOrientation.cpp}::ThirdQComponent().

Here is the call graph for this function:

◆ checkAlignment()

bool MillerIndexOrientation::checkAlignment ( ) const
private

Definition at line 74 of file ILatticeOrientation.cpp.

75 {
76  if (m_q1 == m_q2)
77  return false;
79  return false;
81  return false;
82  return true;
83 }
bool ParallelMillerIndices(MillerIndex index1, MillerIndex index2)

References m_ind1, m_ind2, m_q1, m_q2, anonymous_namespace{ILatticeOrientation.cpp}::ParallelMillerIndices(), and anonymous_namespace{ILatticeOrientation.cpp}::ValidMillerIndex().

Referenced by MillerIndexOrientation().

Here is the call graph for this function:

Member Data Documentation

◆ m_prim_lattice

Lattice MillerIndexOrientation::m_prim_lattice
private

Definition at line 61 of file ILatticeOrientation.h.

Referenced by clone(), transformationMatrix(), and usePrimitiveLattice().

◆ m_q1

QComponent MillerIndexOrientation::m_q1
private

Definition at line 62 of file ILatticeOrientation.h.

Referenced by checkAlignment(), clone(), and transformationMatrix().

◆ m_q2

QComponent MillerIndexOrientation::m_q2
private

Definition at line 62 of file ILatticeOrientation.h.

Referenced by checkAlignment(), clone(), and transformationMatrix().

◆ m_ind1

MillerIndex MillerIndexOrientation::m_ind1
private

Definition at line 63 of file ILatticeOrientation.h.

Referenced by checkAlignment(), clone(), and transformationMatrix().

◆ m_ind2

MillerIndex MillerIndexOrientation::m_ind2
private

Definition at line 63 of file ILatticeOrientation.h.

Referenced by checkAlignment(), clone(), and transformationMatrix().


The documentation for this class was generated from the following files: