28 "An input workspace.");
29 std::shared_ptr<BoundedValidator<double>> mustBePositive = std::make_shared<BoundedValidator<double>>();
30 mustBePositive->setLower(0.0);
31 std::shared_ptr<BoundedValidator<double>> reasonable_angle = std::make_shared<BoundedValidator<double>>();
32 reasonable_angle->setLower(5.0);
33 reasonable_angle->setUpper(175.0);
36 this->
declareProperty(
"a", -1.0, mustBePositive,
"Lattice parameter a");
37 this->
declareProperty(
"b", -1.0, mustBePositive,
"Lattice parameter b");
38 this->
declareProperty(
"c", -1.0, mustBePositive,
"Lattice parameter c");
39 this->
declareProperty(
"alpha", -1.0, reasonable_angle,
"Lattice parameter alpha");
40 this->
declareProperty(
"beta", -1.0, reasonable_angle,
"Lattice parameter beta");
41 this->
declareProperty(
"gamma", -1.0, reasonable_angle,
"Lattice parameter gamma");
53 auto lattice = std::make_unique<OrientedLattice>(a, b, c, alpha, beta, gamma);
58 throw std::runtime_error(
"Problems reading the peaks workspace");
60 size_t nIndexedpeaks = 0;
61 bool found2nc =
false;
64 for (
int i = 0; i < ws->getNumberPeaks(); i++) {
69 if (H * H + K * K + L * L > 0) {
72 if (nIndexedpeaks == 1) {
79 V3D Qhkl = B *
V3D(H, K, L);
100 Si[0][2] = -Qgon.
Y();
101 Si[0][3] = -Qgon.
Z();
104 Si[1][2] = -Qgon.
Z();
109 Si[2][3] = -Qgon.
X();
111 Si[3][1] = -Qgon.
Y();
119 if ((nIndexedpeaks < 2) || !found2nc)
120 throw std::invalid_argument(
"Less then two non-colinear peaks indexed");
122 throw std::invalid_argument(
"Something really bad happened");
133 ws->mutableSample().setOrientedLattice(std::move(lattice));
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
A property class for workspaces.
void exec() override
Run the algorithm.
void init() override
Initialise the properties.
Structure describing a single-crystal peak.
virtual double getH() const =0
virtual double getK() const =0
virtual Mantid::Kernel::V3D getQSampleFrame() const =0
virtual double getL() const =0
Class to implement UB matrix.
void sortEigen(Matrix< T > &)
Sort eigenvectors.
int Diagonalise(Matrix< T > &, Matrix< T > &) const
(only Symmetric matrix)
std::vector< double > getRotation(bool check_normalisation=false, bool throw_on_errors=false) const
returns the rotation matrix defined by this quaternion as an 9-point
bool coLinear(const V3D &, const V3D &) const noexcept
Determines if this,B,C are colinear.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
@ InOut
Both an input & output workspace.