32 "Input Peaks Workspace");
34 std::vector<std::string> type_list;
43 declareProperty(
"CellType", type_list[0], std::make_shared<Kernel::StringListValidator>(type_list),
44 "The conventional cell type to use");
46 std::vector<std::string> centering_list;
53 declareProperty(
"Centering", centering_list[3], std::make_shared<Kernel::StringListValidator>(centering_list),
54 "The centering for the conventional cell");
56 this->
declareProperty(
"Apply",
false,
"Update UB and re-index the peaks");
60 "The number of indexed peaks if apply==true.");
63 "The average HKL indexing error if apply==true.");
65 this->
declareProperty(
"AllowPermutations",
true,
"Allow permutations of conventional cells");
68 "The transformation matrix");
76 throw std::runtime_error(
"Could not read the peaks workspace");
83 throw std::runtime_error(
"ERROR: The stored UB is not a valid orientation matrix");
86 std::string cell_type = this->
getProperty(
"CellType");
87 std::string centering = this->
getProperty(
"Centering");
90 bool allowPermutations = this->
getProperty(
"AllowPermutations");
92 std::vector<ConventionalCell> list =
ScalarUtils::GetCells(UB, cell_type, centering, allowPermutations);
103 g_log.
notice() <<
"Reduced to Conventional Cell Transformation Matrix = " << T.
str() <<
'\n';
108 double average_error = 0.0;
113 g_log.
notice() <<
"Re-indexed the peaks with the new UB. \n";
114 g_log.
notice() <<
"Now, " << num_indexed <<
" are indexed with average error " << average_error <<
'\n';
#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.
Instances of this class represent information about a selected conventional cell based on a specified...
std::string GetDescription() const
get string listing form number, error, cell type and centering
Kernel::DblMatrix GetNewUB() const
get the transformed orientation matrix for the conventional cell
Kernel::DblMatrix GetHKL_Tran() const
get the transform to change HKL to new conventional cell HKL
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 const std::string HEXAGONAL()
static const std::string MONOCLINIC()
static const std::string RHOMBOHEDRAL()
static const std::string CUBIC()
static const std::string F_CENTERED()
static const std::string TRICLINIC()
static const std::string R_CENTERED()
static const std::string TETRAGONAL()
static const std::string ORTHORHOMBIC()
static const std::string P_CENTERED()
static const std::string I_CENTERED()
static const std::string C_CENTERED()
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 ConventionalCell GetCellBestError(const std::vector< ConventionalCell > &list, bool use_triclinic)
Get the cell from the list with the smallest error, possibly excluding triclinic cells.
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
std::string str() const
Convert the matrix into a simple linear string expression.
The concrete, templated class for properties.
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
@ InOut
Both an input & output workspace.
@ Output
An output workspace.