Commit 86a1e482 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #22420 correct indexing

parent fb7a38bb
......@@ -135,12 +135,13 @@ void FindUBUsingIndexedPeakswithSatellites::logLattice(
}
}
int FindUBUsingIndexedPeakswithSatellites::getModulationDimension(V3D &mnp) {
// Find the number of modulation vectors that are nonzero
int ModDim = 0;
if (mnp[0] != 0 && ModDim == 0)
if (mnp[0] != 0)
ModDim = 1;
if (mnp[1] != 0 && ModDim == 1)
if (mnp[1] != 0)
ModDim = 2;
if (mnp[2] != 0 && ModDim == 2)
if (mnp[2] != 0)
ModDim = 3;
return ModDim;
}
......
......@@ -173,12 +173,10 @@ void PredictSatellitePeaks::exec() {
auto orientedUB = goniometer * UB;
HKLFilterWavelength lambdaFilter(orientedUB, lambdaMin, lambdaMax);
int seqNum = 0;
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset1", offsets1,
true);
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset2", offsets2,
true);
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset3", offsets3,
true);
Sample &sampleOut = OutPeaks->mutableSample();
sampleOut.getOrientedLattice().setModVec1(offsets1);
sampleOut.getOrientedLattice().setModVec2(offsets2);
sampleOut.getOrientedLattice().setModVec3(offsets3);
for (auto it = possibleHKLs.begin(); it != possibleHKLs.end(); ++it) {
V3D hkl = *it;
if (crossTerms) {
......@@ -235,12 +233,10 @@ void PredictSatellitePeaks::exec_peaks() {
vector<vector<int>> AlreadyDonePeaks;
int seqNum = 0;
HKLFilterWavelength lambdaFilter(DblMatrix(3, 3, true), 0.1, 100.);
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset1", offsets1,
true);
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset2", offsets2,
true);
OutPeaks->mutableRun().addProperty<std::vector<double>>("Offset3", offsets3,
true);
Sample &sampleOut = OutPeaks->mutableSample();
sampleOut.getOrientedLattice().setModVec1(offsets1);
sampleOut.getOrientedLattice().setModVec2(offsets2);
sampleOut.getOrientedLattice().setModVec3(offsets3);
std::vector<Peak> peaks = Peaks->getPeaks();
for (auto it = peaks.begin(); it != peaks.end(); ++it) {
auto peak = *it;
......
......@@ -2,6 +2,8 @@
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentValidator.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"
#include "MantidDataObjects/Peak.h"
#include "MantidDataObjects/PeaksWorkspace.h"
#include "MantidDataObjects/Workspace2D.h"
......@@ -274,10 +276,10 @@ void SaveIsawPeaks::exec() {
// Go in order of run numbers
std::vector<double> offset1, offset2, offset3;
if (m_isModulatedStructure) {
auto run = ws->mutableRun();
offset1 = run.getPropertyValueAsType<std::vector<double>>("Offset1");
offset2 = run.getPropertyValueAsType<std::vector<double>>("Offset2");
offset3 = run.getPropertyValueAsType<std::vector<double>>("Offset3");
Sample &sample = ws->mutableSample();
offset1 = sample.getOrientedLattice().getModVec(0);
offset2 = sample.getOrientedLattice().getModVec(1);
offset3 = sample.getOrientedLattice().getModVec(2);
out << "9 MODVECTOR ";
writeOffsets(out, qSign, offset1);
writeOffsets(out, qSign, offset2);
......
......@@ -116,6 +116,10 @@ public:
void setModerr1(double _dh1err, double _dk1err, double _dl1err);
void setModerr2(double _dh2err, double _dk2err, double _dl2err);
void setModerr3(double _dh3err, double _dk3err, double _dl3err);
void setMaxOrder(int MaxO);
void setCrossTerm(bool CT);
int getMaxOrder();
bool getCrossTerm();
const Kernel::V3D getModVec(int j) const;
const Kernel::V3D getVecErr(int j) const;
......@@ -209,6 +213,8 @@ protected:
Kernel::DblMatrix ModHKL;
Kernel::DblMatrix errorModHKL;
int MaxOrder;
bool CrossTerm;
// Private functions
......
......@@ -2909,9 +2909,9 @@ int IndexingUtils::GetModulationVectors(const DblMatrix &UB,
o_lattice.setUB(UB);
o_lattice.setModUB(ModUB);
ModVec1 = o_lattice.getModVec(1);
ModVec2 = o_lattice.getModVec(2);
ModVec3 = o_lattice.getModVec(3);
ModVec1 = o_lattice.getModVec(0);
ModVec2 = o_lattice.getModVec(1);
ModVec3 = o_lattice.getModVec(2);
int ModDim = 0;
if (o_lattice.getDh(1) != 0.0 || o_lattice.getDk(1) != 0.0 ||
......
......@@ -19,7 +19,7 @@ using Mantid::Kernel::V3D;
\f$ a = b = c = 1 \mbox{\AA, } \alpha = \beta = \gamma = 90^\circ \f$ */
UnitCell::UnitCell()
: da(6), ra(6), errorda(6), G(3, 3), Gstar(3, 3), B(3, 3), ModHKL(3, 3),
errorModHKL(3, 3) {
errorModHKL(3, 3), MaxOrder(0), CrossTerm(false) {
da[0] = da[1] = da[2] = 1.;
da[3] = da[4] = da[5] = deg2rad * 90.0;
errorda[0] = errorda[1] = errorda[2] = errorda[3] = errorda[4] = errorda[5] =
......@@ -32,7 +32,7 @@ UnitCell::UnitCell()
with \f$\alpha = \beta = \gamma = 90^\circ \f$*/
UnitCell::UnitCell(double _a, double _b, double _c)
: da(6), ra(6), errorda(6), G(3, 3), Gstar(3, 3), B(3, 3), ModHKL(3, 3),
errorModHKL(3, 3) {
errorModHKL(3, 3), MaxOrder(0), CrossTerm(false) {
da[0] = _a;
da[1] = _b;
da[2] = _c;
......@@ -50,7 +50,7 @@ UnitCell::UnitCell(double _a, double _b, double _c)
UnitCell::UnitCell(double _a, double _b, double _c, double _alpha, double _beta,
double _gamma, const int angleunit)
: da(6), ra(6), errorda(6), G(3, 3), Gstar(3, 3), B(3, 3), ModHKL(3, 3),
errorModHKL(3, 3) {
errorModHKL(3, 3), MaxOrder(0), CrossTerm(false) {
da[0] = _a;
da[1] = _b;
da[2] = _c;
......@@ -452,6 +452,25 @@ double UnitCell::getDlErr(int j) const { return errorModHKL[2][j - 1]; }
/** Set lattice parameter
@param _a :: lattice parameter \f$ a \f$ (in \f$ \mbox{\AA} \f$ )*/
void UnitCell::setMaxOrder(int MaxO)
{
MaxOrder = MaxO;
}
void UnitCell::setCrossTerm(bool CT)
{
CrossTerm = CT;
}
int UnitCell::getMaxOrder()
{
return MaxOrder;
}
bool UnitCell::getCrossTerm()
{
return CrossTerm;
}
void UnitCell::seta(double _a) {
da[0] = _a;
recalculate();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment