Skip to content
Snippets Groups Projects
Commit b1644227 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #14072 fix tests for b unique only

parent d776e34a
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ void OptimizeLatticeForCellType::init() { ...@@ -43,7 +43,7 @@ void OptimizeLatticeForCellType::init() {
cellTypes.push_back(ReducedCell::TETRAGONAL()); cellTypes.push_back(ReducedCell::TETRAGONAL());
cellTypes.push_back(ReducedCell::ORTHORHOMBIC()); cellTypes.push_back(ReducedCell::ORTHORHOMBIC());
cellTypes.push_back(ReducedCell::HEXAGONAL()); cellTypes.push_back(ReducedCell::HEXAGONAL());
cellTypes.push_back(ReducedCell::RHOMBOHEDRAL()); cellTypes.push_back("Trigonal"); // was RHOMBOHEDRAL
cellTypes.push_back(ReducedCell::MONOCLINIC()); cellTypes.push_back(ReducedCell::MONOCLINIC());
cellTypes.push_back(ReducedCell::TRICLINIC()); cellTypes.push_back(ReducedCell::TRICLINIC());
declareProperty("CellType", cellTypes[0], declareProperty("CellType", cellTypes[0],
...@@ -149,7 +149,29 @@ void OptimizeLatticeForCellType::exec() { ...@@ -149,7 +149,29 @@ void OptimizeLatticeForCellType::exec() {
std::vector<double> sigabc = outParams(cell_type, 2, ParamTable); std::vector<double> sigabc = outParams(cell_type, 2, ParamTable);
IAlgorithm_sptr ub_alg;
try {
ub_alg =
createChildAlgorithm("FindUBUsingLatticeParameters", -1, -1, false);
}
catch (Exception::NotFoundError &) {
g_log.error("Can't locate FindUBUsingLatticeParameters algorithm");
throw;
}
ub_alg->setProperty("PeaksWorkspace", peakWS);
ub_alg->setProperty("a", Params[0]);
ub_alg->setProperty("b", Params[1]);
ub_alg->setProperty("c", Params[2]);
ub_alg->setProperty("alpha", Params[3]);
ub_alg->setProperty("beta", Params[4]);
ub_alg->setProperty("gamma", Params[5]);
ub_alg->setProperty("NumInitial", 15);
ub_alg->setProperty("Tolerance", tolerance);
ub_alg->executeAsChildAlg();
DblMatrix UBnew = peakWS->mutableSample().getOrientedLattice().getUB();
OrientedLattice o_lattice; OrientedLattice o_lattice;
o_lattice.setUB(UBnew);
o_lattice.set(Params[0], Params[1], Params[2], Params[3], Params[4], o_lattice.set(Params[0], Params[1], Params[2], Params[3], Params[4],
Params[5]); Params[5]);
o_lattice.setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4], o_lattice.setError(sigabc[0], sigabc[1], sigabc[2], sigabc[3], sigabc[4],
...@@ -222,7 +244,7 @@ std::string OptimizeLatticeForCellType::inParams(std::string cell_type, ...@@ -222,7 +244,7 @@ std::string OptimizeLatticeForCellType::inParams(std::string cell_type,
fun_str << ",a=" << lat[0]; fun_str << ",a=" << lat[0];
fun_str << ",b=" << lat[1]; fun_str << ",b=" << lat[1];
fun_str << ",c=" << lat[2]; fun_str << ",c=" << lat[2];
} else if (cell_type == ReducedCell::RHOMBOHEDRAL()) { } else if (cell_type == "Trigonal") {
fun_str << ",a=" << lat[0]; fun_str << ",a=" << lat[0];
fun_str << ",Alpha=" << lat[3]; fun_str << ",Alpha=" << lat[3];
} else if (cell_type == ReducedCell::HEXAGONAL()) { } else if (cell_type == ReducedCell::HEXAGONAL()) {
...@@ -284,7 +306,7 @@ OptimizeLatticeForCellType::outParams(std::string cell_type, int icol, ...@@ -284,7 +306,7 @@ OptimizeLatticeForCellType::outParams(std::string cell_type, int icol,
lattice_parameters[3] = 90; lattice_parameters[3] = 90;
lattice_parameters[4] = 90; lattice_parameters[4] = 90;
lattice_parameters[5] = 90; lattice_parameters[5] = 90;
} else if (cell_type == ReducedCell::RHOMBOHEDRAL()) { } else if (cell_type == "Trigonal") {
lattice_parameters[0] = ParamTable->Double(0, icol); lattice_parameters[0] = ParamTable->Double(0, icol);
lattice_parameters[1] = ParamTable->Double(0, icol); lattice_parameters[1] = ParamTable->Double(0, icol);
lattice_parameters[2] = ParamTable->Double(0, icol); lattice_parameters[2] = ParamTable->Double(0, icol);
......
...@@ -68,8 +68,8 @@ public: ...@@ -68,8 +68,8 @@ public:
// Check that the UB matrix is the same as in TOPAZ_3007.mat // Check that the UB matrix is the same as in TOPAZ_3007.mat
OrientedLattice latt = ws->mutableSample().getOrientedLattice(); OrientedLattice latt = ws->mutableSample().getOrientedLattice();
double correct_UB[] = { -0.0477, 0.0413, -0.0005, -0.0055, -0.0090, double correct_UB[] = { 0.0454, 0.0406, 0.0122, -0.0014, -0.0031,
0.1250, 0.0610, 0.0314, 0.0110 }; -0.1165, -0.0574, 0.0322, -0.0273 };
std::vector<double> UB_calculated = latt.getUB().getVector(); std::vector<double> UB_calculated = latt.getUB().getVector();
......
...@@ -31,7 +31,7 @@ Usage ...@@ -31,7 +31,7 @@ Usage
FindUBUsingFFT(ws,MinD=8.0,MaxD=13.0) FindUBUsingFFT(ws,MinD=8.0,MaxD=13.0)
print "Before Optimization:" print "Before Optimization:"
print ws.sample().getOrientedLattice().getUB() print ws.sample().getOrientedLattice().getUB()
OptimizeLatticeForCellType(ws,CellType="Monoclinic ( a unique )") OptimizeLatticeForCellType(ws,CellType="Monoclinic")
print "\nAfter Optimization:" print "\nAfter Optimization:"
print ws.sample().getOrientedLattice().getUB() print ws.sample().getOrientedLattice().getUB()
...@@ -46,9 +46,9 @@ Output: ...@@ -46,9 +46,9 @@ Output:
[-0.02737294 -0.08973552 -0.02525994]] [-0.02737294 -0.08973552 -0.02525994]]
After Optimization: After Optimization:
[[-0.04772517 0.04134355 -0.00058175] [[ 0.04542062 0.04061954 0.01223576]
[-0.0055954 -0.00905383 0.12507404] [-0.00140377 -0.00318446 -0.11654506]
[ 0.06103109 0.03149982 0.01101201]] [-0.05749773 0.03223779 -0.02737294]]
.. categories:: .. categories::
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment