31 "An input workspace to which to add the lattice information.");
33 const std::vector<std::string> exts{
".mat",
".ub",
".txt"};
35 "Path to an ISAW-style UB matrix text file.");
38 "If True (default) then a check is "
39 "performed to ensure the U matrix is a "
40 "proper rotation matrix");
49 std::ifstream in(Filename.c_str());
56 for (
size_t row = 0; row < 3; row++) {
57 for (
size_t col = 0; col < 3; col++) {
60 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
73 bool crossterm =
false;
79 for (
size_t row = 0; row < 3; row++) {
80 for (
size_t col = 0; col < 3; col++) {
83 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
84 modub[row][col] = val;
87 if (modub[row][0] != 0.0 || modub[row][1] != 0.0 || modub[row][2] != 0.0)
95 for (
double &latVal : latVals) {
98 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
105 for (
int i = 0; i < ModDim; i++) {
107 for (
int j = 0; j < 4; j++)
109 for (
int j = 0; j < 3; j++) {
112 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
113 ModVecErr[i][j] = val;
119 for (
int j = 0; j < 3; j++)
122 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
123 maxorder =
static_cast<int>(val);
125 for (
int j = 0; j < 3; j++)
129 throw std::runtime_error(
"The string '" + s +
"' in the file was not understood as a number.");
139 auto latt = std::make_unique<OrientedLattice>();
141 latt->setError(latVals[0], latVals[1], latVals[2], latVals[3], latVals[4], latVals[5]);
142 latt->setModUB(modub);
144 for (
int i = 0; i < ModDim; i++)
145 latt->setModerr(i, ModVecErr[i][0], ModVecErr[i][1], ModVecErr[i][2]);
147 latt->setMaxOrder(maxorder);
148 latt->setCrossTerm(crossterm);
155 for (
size_t r = 0; r < 3; r++) {
162 latt->setU(U, !checkU);
169 if (MDWS !=
nullptr) {
170 ws = MDWS->getExperimentInfo(0);
172 ws = std::dynamic_pointer_cast<ExperimentInfo>(ws1);
175 throw std::invalid_argument(
"Must specify either a MatrixWorkspace or a "
176 "PeaksWorkspace or a MDWorkspace.");
179 if ((MDWS !=
nullptr) && (MDWS->getNumExperimentInfo() > 1)) {
180 for (uint16_t i = 1; i < MDWS->getNumExperimentInfo(); i++) {
181 ws = MDWS->getExperimentInfo(i);
182 ws->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>(*latt));
186 ws->mutableSample().setOrientedLattice(std::move(latt));
#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.
@ Load
allowed here which will be passed to the algorithm
A property class for workspaces.
void init() override
Initialise the properties.
void readModulatedUB(std::ifstream &in, Kernel::DblMatrix &ub)
load the modulation UB
void exec() override
Run the algorithm.
Class to implement UB matrix.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
Matrix< T > & Transpose()
Transpose the matrix.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.
std::shared_ptr< MultipleExperimentInfos > MultipleExperimentInfos_sptr
Holds support functions for strings.
MANTID_KERNEL_DLL void readToEndOfLine(std::istream &in, bool ConsumeEOL)
Eat everything from the stream until the next EOL.
int convert(const std::string &A, T &out)
Convert a string into a number.
MANTID_KERNEL_DLL std::string getWord(std::istream &in, bool consumeEOL)
Returns the next word in the stream.
@ InOut
Both an input & output workspace.