15#include "MantidJson/Json.h"
19#include <boost/algorithm/string/replace.hpp>
35 "Input Peaks Workspace");
37 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
38 mustBePositive->setLower(0.0);
42 "Max Scalar Error (0.2)");
44 this->
declareProperty(
"BestOnly",
true,
"Show at most one for each Bravais Lattice");
47 "Gets set with the number of possible cells.");
49 this->
declareProperty(
"AllowPermutations",
true,
"Allow permutations of conventional cells");
52 "A list of the different cells");
60 throw std::runtime_error(
"Could not read the peaks workspace");
67 throw std::runtime_error(
"ERROR: The stored UB is not a valid orientation matrix");
70 double max_scalar_error = this->
getProperty(
"MaxScalarError");
72 bool allowPermutations = this->
getProperty(
"AllowPermutations");
78 size_t num_cells = list.size();
81 g_log.
notice() <<
"Num Cells : " << num_cells <<
'\n';
83 std::vector<std::string> cells;
85 for (
size_t i = 0; i < num_cells; i++) {
92 root[
"Error"] = list[i].GetError();
93 root[
"FormNumber"] =
static_cast<uint32_t
>(list[i].GetFormNum());
94 root[
"CellType"] = list[i].GetCellType();
95 root[
"Centering"] = list[i].GetCentering();
101 std::vector<double> lattice_parameters;
103 root[
"a"] = lattice_parameters[0];
104 root[
"b"] = lattice_parameters[1];
105 root[
"c"] = lattice_parameters[2];
106 root[
"alpha"] = lattice_parameters[3];
107 root[
"beta"] = lattice_parameters[4];
108 root[
"gamma"] = lattice_parameters[5];
109 root[
"volume"] = lattice_parameters[6];
111 cells.push_back(Mantid::JsonHelpers::jsonToString(root));
114 this->
setProperty(
"NumberOfCells",
static_cast<int>(num_cells));
#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.
static std::string GetLatticeParameterString(const Kernel::DblMatrix &UB)
Get a formatted string listing the lattice parameters and cell volume.
static bool CheckUB(const Kernel::DblMatrix &UB)
Check that the specified UB is reasonable for an orientation matrix.
static bool GetLatticeParameters(const Kernel::DblMatrix &UB, std::vector< double > &lattice_par)
Get the lattice parameters for the specified orientation matrix.
Class to implement UB matrix.
const Kernel::DblMatrix & getUB() const
Get the UB matrix.
static std::vector< ConventionalCell > GetCells(const Kernel::DblMatrix &UB, bool best_only, bool allowPermutations=false)
Get list of all possible conventional cells for UB, regardless of errors, using this UB,...
static void RemoveHighErrorForms(std::vector< ConventionalCell > &list, double level)
Remove cells from list that have scalar errors above the specified level.
Support for a property that holds an array of values.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void notice(const std::string &msg)
Logs at notice level.
std::vector< T > getVector() const
The concrete, templated class for properties.
std::shared_ptr< const IPeaksWorkspace > IPeaksWorkspace_const_sptr
shared pointer to Mantid::API::IPeaksWorkspace (const version)
@ InOut
Both an input & output workspace.
@ Input
An input workspace.
@ Output
An output workspace.