27 if (convention ==
"Crystallography") {
44 auto mustBeLengthThree = std::make_shared<ArrayLengthValidator<double>>(3);
47 "Modulation Vector 1: dh, dk, dl");
50 "Modulation Vector 2: dh, dk, dl");
53 "Modulation Vector 3: dh, dk, dl");
54 auto mustBePositiveOrZero = std::make_shared<BoundedValidator<int>>();
55 mustBePositiveOrZero->setLower(0);
59 "Include combinations of modulation vectors in satellite search",
Direction::Input);
87 const std::vector<double> &modVector2,
88 const std::vector<double> &modVector3) {
90 auto addIfNonZero = [&
modVectors](
const auto &modVec) {
91 if (std::fabs(modVec[0]) > 0 || std::fabs(modVec[1]) > 0 || std::fabs(modVec[2]) > 0)
92 modVectors.emplace_back(
V3D(modVec[0], modVec[1], modVec[2]));
94 addIfNonZero(modVector1);
95 addIfNonZero(modVector2);
96 addIfNonZero(modVector3);
108 const std::vector<double> &modVector2,
109 const std::vector<double> &modVector3) {
111 auto addVec = [&
modVectors](
const auto &modVec) {
modVectors.emplace_back(
V3D(modVec[0], modVec[1], modVec[2])); };
132 std::vector<MNPOffset> offsets;
142 if (
m == 0 &&
n == 0)
144 offsets.emplace_back(std::make_tuple(
m,
n, 0, modVector0 *
m + modVector1 *
n));
155 if (
m == 0 &&
n == 0 && p == 0)
157 offsets.emplace_back(
m,
n, p, modVector0 *
m + modVector1 *
n + modVector2 * p);
166 for (
auto i = 0u; i <
modVectors.size(); ++i) {
171 V3D offset{modVector * order};
174 offsets.emplace_back(order, 0, 0, offset);
177 offsets.emplace_back(0, order, 0, offset);
180 offsets.emplace_back(0, 0, order, offset);
200std::vector<MNPOffset>
generateOffsetVectors(
const std::vector<double> &hOffsets,
const std::vector<double> &kOffsets,
201 const std::vector<double> &lOffsets) {
202 std::vector<MNPOffset> offsets;
203 for (
double hOffset : hOffsets) {
204 for (
double kOffset : kOffsets) {
205 std::transform(lOffsets.begin(), lOffsets.end(), std::back_inserter(offsets),
206 [&hOffset, &kOffset](
double lOffset) {
209 return std::make_tuple(0, 0, 0, V3D(hOffset, kOffset, lOffset));
const std::vector< V3D > modVectors
IAlgorithm is the interface implemented by the Algorithm base class.
ArrayLenghtValidator : Validate length of an array property.
Support for a property that holds an array of values.
BoundedValidator is a validator that requires the values to be between upper or lower bounds,...
virtual void declareProperty(std::unique_ptr< Property > p, const std::string &doc="")=0
Function to declare properties (i.e. store them)
virtual TypedValue getProperty(const std::string &name) const =0
Get the value of a property.
Manage the lifetime of a class intended to be a singleton.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::vector< Kernel::V3D > addModulationVectors(const std::vector< double > &modVector1, const std::vector< double > &modVector2, const std::vector< double > &modVector3)
Create a list of valid modulation vectors from the input.
std::vector< MNPOffset > generateOffsetVectors(const std::vector< Kernel::V3D > &modVectors, const int maxOrder, const bool crossTerms)
Calculate a list of HKL offsets from the given modulation vectors.
double qConventionFactor()
convenience overload to pull the convention from the config service
std::vector< Kernel::V3D > validModulationVectors(const std::vector< double > &modVector1, const std::vector< double > &modVector2, const std::vector< double > &modVector3)
Create a list of valid modulation vectors from the input.
Tie together the names of the properties for the modulation vectors.
static const std::string ModVector3
static const std::string MaxOrder
static const std::string ModVector2
std::vector< MNPOffset > offsets
static ModulationProperties create(const API::IAlgorithm &alg)
Create a ModulationProperties object from an algorithm.
static const std::string CrossTerms
static const std::string ModVector1
static void appendTo(API::IAlgorithm *alg)
Append the common set of properties that relate to modulation vectors to the given algorithm.
Describes the direction (within an algorithm) of a Property.
@ Input
An input workspace.