Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Mantid::Geometry::NiggliCell Class Reference

Class to implement UB matrix. More...

#include <Geometry/Crystal/NiggliCell.h>

Inheritance diagram for Mantid::Geometry::NiggliCell:
Mantid::Geometry::UnitCell

Public Member Functions

 NiggliCell (const double _a, const double _b, const double _c, const double _alpha, const double _beta, const double _gamma, const Kernel::DblMatrix &Umatrix=Kernel::DblMatrix(3, 3, true), const int angleunit=angDegrees)
 Constructor. More...
 
 NiggliCell (const double _a, const double _b, const double _c, const Kernel::DblMatrix &Umatrix=Kernel::DblMatrix(3, 3, true))
 Constructor. More...
 
 NiggliCell (const Kernel::DblMatrix &Umatrix=Kernel::DblMatrix(3, 3, true))
 Default constructor. More...
 
 NiggliCell (const UnitCell &uc, const Kernel::DblMatrix &Umatrix=Kernel::DblMatrix(3, 3, true))
 UnitCell constructor. More...
 
- Public Member Functions inherited from Mantid::Geometry::UnitCell
double a () const
 Get lattice parameter. More...
 
double a (int nd) const
 Get lattice parameter a1-a3 as function of index (0-2) More...
 
double a1 () const
 Get lattice parameter. More...
 
double a2 () const
 Get lattice parameter. More...
 
double a3 () const
 Get lattice parameter. More...
 
double alpha () const
 Get lattice parameter. More...
 
double alpha1 () const
 Get lattice parameter. More...
 
double alpha2 () const
 Get lattice parameter. More...
 
double alpha3 () const
 Get lattice parameter. More...
 
double alphastar () const
 Get reciprocal lattice parameter. More...
 
double astar () const
 Get reciprocal lattice parameter. More...
 
double b () const
 Get lattice parameter. More...
 
double b1 () const
 Get reciprocal lattice parameter. More...
 
double b2 () const
 Get reciprocal lattice parameter. More...
 
double b3 () const
 Get reciprocal lattice parameter. More...
 
double beta () const
 Get lattice parameter. More...
 
double beta1 () const
 Get reciprocal lattice parameter. More...
 
double beta2 () const
 Get reciprocal lattice parameter. More...
 
double beta3 () const
 Get reciprocal lattice parameter. More...
 
double betastar () const
 Get reciprocal lattice parameter. More...
 
double bstar () const
 Get reciprocal lattice parameter. More...
 
double c () const
 Get lattice parameter. More...
 
double cstar () const
 Get reciprocal lattice parameter. More...
 
double d (const Kernel::V3D &hkl) const
 Return d-spacing ( \( \mbox{ \AA } \)) for a given h,k,l coordinate. More...
 
double d (double h, double k, double l) const
 Return d-spacing ( \( \mbox{ \AA } \)) for a given h,k,l coordinate. More...
 
double dstar (const Kernel::V3D &hkl) const
 Return d*=1/d ( \( \mbox{ \AA }^{-1} \)) for a given h,k,l coordinate. More...
 
double dstar (double h, double k, double l) const
 Return d*=1/d ( \( \mbox{ \AA }^{-1} \)) for a given h,k,l coordinate. More...
 
double errora () const
 Get lattice parameter error. More...
 
double erroralpha (const int angleunit=angDegrees) const
 Get lattice parameter error. More...
 
double errorb () const
 Get lattice parameter error. More...
 
double errorbeta (const int angleunit=angDegrees) const
 Get lattice parameter error. More...
 
double errorc () const
 Get lattice parameter error. More...
 
double errorgamma (const int angleunit=angDegrees) const
 Get lattice parameter error. More...
 
double errorvolume () const
 Get lattice parameter error. More...
 
double gamma () const
 Get lattice parameter. More...
 
double gammastar () const
 Get reciprocal lattice parameter. More...
 
const Kernel::DblMatrixgetB () const
 Get the B-matrix. More...
 
const Kernel::DblMatrixgetBinv () const
 Get the inverse of the B-matrix. More...
 
bool getCrossTerm () const
 Get cross term boolean. More...
 
double getdh (int j) const
 Get modulation vectors for satellites. More...
 
double getdherr (int j) const
 Get error of modulation vectors for satellites. More...
 
double getdk (int j) const
 Get modulation vectors for satellites. More...
 
double getdkerr (int j) const
 Get error of modulation vectors for satellites. More...
 
double getdl (int j) const
 Get modulation vectors for satellites. More...
 
double getdlerr (int j) const
 Get error of modulation vectors for satellites. More...
 
const Kernel::DblMatrixgetG () const
 Get the metric tensor. More...
 
const Kernel::DblMatrixgetGstar () const
 Get the reciprocal metric tensor. More...
 
int getMaxOrder () const
 Get max order. More...
 
const Kernel::DblMatrixgetModHKL () const
 Get modulation vectors for satellites. More...
 
const Kernel::V3D getModVec (int j) const
 Get modulation vectors for satellites. More...
 
const Kernel::V3D getVecErr (int j) const
 Get errors for modulation vectors for satellites. More...
 
bool operator!= (const UnitCell &other) const
 
bool operator== (const UnitCell &other) const
 
virtual void recalculateFromGstar (const Kernel::Matrix< double > &NewGstar)
 Recalculate lattice from reciprocal metric tensor (Gstar=transpose(UB)*UB) More...
 
double recAngle (double h1, double k1, double l1, double h2, double k2, double l2, const int angleunit=angDegrees) const
 Calculate the angle in degrees or radians between two reciprocal vectors (h1,k1,l1) and (h2,k2,l2) More...
 
double recVolume () const
 Volume of the reciprocal lattice. More...
 
void set (double _a, double _b, double _c, double _alpha, double _beta, double _gamma, const int angleunit=angDegrees)
 Set lattice parameters. More...
 
void seta (double _a)
 Set lattice parameter. More...
 
void setalpha (double _alpha, const int angleunit=angDegrees)
 Set lattice parameter. More...
 
void setb (double _b)
 Set lattice parameter. More...
 
void setbeta (double _beta, const int angleunit=angDegrees)
 Set lattice parameter. More...
 
void setc (double _c)
 Set lattice parameter. More...
 
void setCrossTerm (bool CT)
 Set modulation vectors for satellites. More...
 
void setError (double _aerr, double _berr, double _cerr, double _alphaerr, double _betaerr, double _gammaerr, const int angleunit=angDegrees)
 Set lattice parameter errors. More...
 
void setErrora (double _aerr)
 Set lattice parameter error. More...
 
void setErroralpha (double _alphaerr, const int angleunit=angDegrees)
 Set lattice parameter error. More...
 
void setErrorb (double _berr)
 Set lattice parameter error. More...
 
void setErrorbeta (double _betaerr, const int angleunit=angDegrees)
 Set lattice parameter error. More...
 
void setErrorc (double _cerr)
 Set lattice parameter error. More...
 
void setErrorgamma (double _gammaerr, const int angleunit=angDegrees)
 Set lattice parameter error. More...
 
void setErrorModHKL (const Kernel::DblMatrix &newErrorModHKL)
 Set modulation vectors for satellites. More...
 
void setErrorModHKL (double _dh1err, double _dk1err, double _dl1err, double _dh2err, double _dk2err, double _dl2err, double _dh3err, double _dk3err, double _dl3err)
 Set modulation vectors for satellites. More...
 
void setgamma (double _gamma, const int angleunit=angDegrees)
 Set lattice parameter. More...
 
void setMaxOrder (int MaxO)
 Set modulation vectors for satellites. More...
 
void setModerr (int i, double _dherr, double _dkerr, double _dlerr)
 Set modulation vectors for satellites. More...
 
void setModerr1 (double _dh1err, double _dk1err, double _dl1err)
 Set modulation vectors for satellites. More...
 
void setModerr2 (double _dh2err, double _dk2err, double _dl2err)
 Set modulation vectors for satellites. More...
 
void setModerr3 (double _dh3err, double _dk3err, double _dl3err)
 Set modulation vectors for satellites. More...
 
void setModHKL (const Kernel::DblMatrix &newModHKL)
 Set modulation vectors for satellites. More...
 
void setModHKL (double _dh1, double _dk1, double _dl1, double _dh2, double _dk2, double _dl2, double _dh3, double _dk3, double _dl3)
 Set modulation vectors for satellites. More...
 
void setModVec1 (const Kernel::V3D &newModVec)
 Set modulation vectors for satellites. More...
 
void setModVec1 (double _dh1, double _dk1, double _dl1)
 Set modulation vectors for satellites. More...
 
void setModVec2 (const Kernel::V3D &newModVec)
 Set modulation vectors for satellites. More...
 
void setModVec2 (double _dh2, double _dk2, double _dl2)
 Set modulation vectors for satellites. More...
 
void setModVec3 (const Kernel::V3D &newModVec)
 Set modulation vectors for satellites. More...
 
void setModVec3 (double _dh3, double _dk3, double _dl3)
 Set modulation vectors for satellites. More...
 
 UnitCell ()
 Default constructor. More...
 
 UnitCell (const double _a, const double _b, const double _c)
 Constructor. More...
 
 UnitCell (const double _a, const double _b, const double _c, const double _alpha, const double _beta, const double _gamma, const int angleunit=angDegrees)
 Constructor. More...
 
double volume () const
 Volume of the direct unit-cell. More...
 
virtual ~UnitCell ()=default
 

Static Public Member Functions

static bool HasNiggliAngles (const Kernel::V3D &a_dir, const Kernel::V3D &b_dir, const Kernel::V3D &c_dir, double epsilon)
 Check if a,b,c cell has angles satifying Niggli condition within epsilon. More...
 
static bool MakeNiggliUB (const Kernel::DblMatrix &UB, Kernel::DblMatrix &newUB)
 Construct a newUB corresponding to a Niggli cell from the given UB. More...
 

Private Attributes

Kernel::DblMatrix U
 
Kernel::DblMatrix UB
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::Geometry::UnitCell
void calculateB ()
 Private function to calculate B matrix. More...
 
void calculateG ()
 
void calculateGstar ()
 Private function to calculate Gstar matrix. More...
 
void calculateReciprocalLattice ()
 Private function to calculate reciprocal lattice parameters. More...
 
virtual void recalculate ()
 Private function, called at initialization or whenever lattice parameters are changed. More...
 
- Protected Attributes inherited from Mantid::Geometry::UnitCell
Kernel::DblMatrix B
 B matrix for a right-handed coordinate system, in Busing-Levy convention. More...
 
Kernel::DblMatrix Binv
 Inverse of the B matrix. More...
 
bool CrossTerm
 
std::vector< double > da
 Lattice parameter a,b,c,alpha,beta,gamma (in \( \mbox{ \AA } \) and radians) More...
 
std::vector< double > errorda
 Error in lattice parameters (in \( \mbox{ \AA } \) and radians) More...
 
Kernel::DblMatrix errorModHKL
 
Kernel::DblMatrix G
 Metric tensor. More...
 
Kernel::DblMatrix Gstar
 Reciprocal lattice tensor. More...
 
int MaxOrder
 
Kernel::DblMatrix ModHKL
 
std::vector< double > ra
 Reciprocal lattice parameters (in \( \mbox{ \AA }^{-1} \) and radians) More...
 

Detailed Description

Class to implement UB matrix.

See documentation about UB matrix in the Mantid repository.

Author
Andrei Savici, SNS, ORNL
Date
2011-04-15

Definition at line 21 of file NiggliCell.h.

Constructor & Destructor Documentation

◆ NiggliCell() [1/4]

Mantid::Geometry::NiggliCell::NiggliCell ( const Kernel::DblMatrix Umatrix = Kernel::DblMatrix(3, 3, true))

Default constructor.

Parameters
Umatrix:: orientation matrix U. By default this will be identity matrix

Definition at line 79 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::getB(), Mantid::Kernel::Matrix< T >::isRotation(), U, and UB.

◆ NiggliCell() [2/4]

Mantid::Geometry::NiggliCell::NiggliCell ( const double  _a,
const double  _b,
const double  _c,
const Kernel::DblMatrix Umatrix = Kernel::DblMatrix(3, 3, true) 
)

Constructor.

Parameters
_a:: lattice parameter \( a \) with \(\alpha = \beta = \gamma = 90^\circ \)
_b:: lattice parameter \( b \) with \(\alpha = \beta = \gamma = 90^\circ \)
_c:: lattice parameter \( c \) with \(\alpha = \beta = \gamma = 90^\circ \)
Umatrix:: orientation matrix U

Definition at line 96 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::getB(), Mantid::Kernel::Matrix< T >::isRotation(), U, and UB.

◆ NiggliCell() [3/4]

Mantid::Geometry::NiggliCell::NiggliCell ( const double  _a,
const double  _b,
const double  _c,
const double  _alpha,
const double  _beta,
const double  _gamma,
const Kernel::DblMatrix Umatrix = Kernel::DblMatrix(3, 3, true),
const int  angleunit = angDegrees 
)

Constructor.

Parameters
_a:: lattice parameter \( a \)
_b:: lattice parameter \( b \)
_c:: lattice parameter \( c \)
_alpha:: lattice parameter \( \alpha \)
_beta:: lattice parameter \( \beta \)
_gamma:: lattice parameter \( \gamma \)
angleunit:: units for angle, of type AngleUnits. Default is degrees.
Umatrix:: orientation matrix U

Definition at line 115 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::getB(), Mantid::Kernel::Matrix< T >::isRotation(), U, and UB.

◆ NiggliCell() [4/4]

Mantid::Geometry::NiggliCell::NiggliCell ( const UnitCell uc,
const Kernel::DblMatrix Umatrix = Kernel::DblMatrix(3, 3, true) 
)

UnitCell constructor.

Parameters
uc:: UnitCell
Umatrix:: orientation matrix U. By default this will be identity matrix

Definition at line 129 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::getB(), Mantid::Kernel::Matrix< T >::isRotation(), U, and UB.

Member Function Documentation

◆ HasNiggliAngles()

bool Mantid::Geometry::NiggliCell::HasNiggliAngles ( const Kernel::V3D a_dir,
const Kernel::V3D b_dir,
const Kernel::V3D c_dir,
double  epsilon 
)
static

Check if a,b,c cell has angles satifying Niggli condition within epsilon.

Specifically, check if all angles are strictly less than 90 degrees, or all angles are greater than or equal to 90 degrees. The inequality requirements are relaxed by an amount specified by the paramter epsilon to accommodate some experimental and/or rounding error in the calculated angles.

Parameters
a_dirVector in the direction of the real cell edge vector 'a'
b_dirVector in the direction of the real cell edge vector 'b'
c_dirVector in the direction of the real cell edge vector 'c'
epsilonTolerance (in degrees) around 90 degrees. For example an angle theta will be considered strictly less than 90 degrees, if it is less than 90+epsilon.
Returns
true if all angles are less than 90 degrees, or if all angles are greater than or equal to 90 degrees.

Definition at line 154 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::alpha(), Mantid::Kernel::V3D::angle(), Mantid::Geometry::UnitCell::beta(), and Mantid::Geometry::UnitCell::gamma().

Referenced by MakeNiggliUB().

◆ MakeNiggliUB()

bool Mantid::Geometry::NiggliCell::MakeNiggliUB ( const Kernel::DblMatrix UB,
Kernel::DblMatrix newUB 
)
static

Construct a newUB corresponding to a Niggli cell from the given UB.

Try to find a UB that is equivalent to the original UB, but corresponds to a Niggli reduced cell with the smallest sum of edge lengths and with angles that are farthest from 90 degrees.

Parameters
UBThe original UB
newUBReturns the newUB
Returns
True if a possibly constructive change was made and newUB has been set to a new matrix. It returns false if no constructive change was found and newUB is just set to the original UB.

Definition at line 183 of file NiggliCell.cpp.

References Mantid::Geometry::UnitCell::a(), Mantid::Geometry::UnitCell::b(), Mantid::Geometry::UnitCell::c(), Mantid::Geometry::CompareABCsum(), Mantid::Geometry::CompareDiffFrom90(), Mantid::Kernel::V3D::compareMagnitude(), fabs, Mantid::Geometry::OrientedLattice::GetABC(), Mantid::Geometry::OrientedLattice::GetUB(), HasNiggliAngles(), Mantid::Kernel::V3D::norm(), Mantid::Kernel::V3D::scalar_prod(), and UB.

Referenced by Mantid::Geometry::IndexingUtils::Find_UB().

Member Data Documentation

◆ U

Kernel::DblMatrix Mantid::Geometry::NiggliCell::U
private

Definition at line 43 of file NiggliCell.h.

Referenced by NiggliCell().

◆ UB

Kernel::DblMatrix Mantid::Geometry::NiggliCell::UB
private

Definition at line 44 of file NiggliCell.h.

Referenced by MakeNiggliUB(), and NiggliCell().


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