diff --git a/Framework/API/inc/MantidAPI/ILatticeFunction.h b/Framework/API/inc/MantidAPI/ILatticeFunction.h index ec65576109d6a10ba09412df9c207bad46897741..52be615d677acb375881ade81835cd93bcc1edfb 100644 --- a/Framework/API/inc/MantidAPI/ILatticeFunction.h +++ b/Framework/API/inc/MantidAPI/ILatticeFunction.h @@ -55,7 +55,7 @@ public: Jacobian &jacobian); /// A string that names the crystal system. - virtual void setCrystalSystem(const std::string &crystalSystem) = 0; + virtual void setLatticeSystem(const std::string &crystalSystem) = 0; /// Set the function parameters according to the supplied unit cell. virtual void setUnitCell(const std::string &unitCellString) = 0; diff --git a/Framework/API/inc/MantidAPI/IPawleyFunction.h b/Framework/API/inc/MantidAPI/IPawleyFunction.h index f560667902f0fcfd7acb7e3269363875c7e66791..ab3e39bd3474ed2f7542ec741780a601ed56549a 100644 --- a/Framework/API/inc/MantidAPI/IPawleyFunction.h +++ b/Framework/API/inc/MantidAPI/IPawleyFunction.h @@ -44,7 +44,7 @@ public: virtual ~IPawleyFunction() {} /// A string that names the crystal system. - virtual void setCrystalSystem(const std::string &crystalSystem) = 0; + virtual void setLatticeSystem(const std::string &crystalSystem) = 0; /// Sets the name of the profile function used for the reflections. virtual void setProfileFunction(const std::string &profileFunction) = 0; diff --git a/Framework/API/test/ILatticeFunctionTest.h b/Framework/API/test/ILatticeFunctionTest.h index a1d67bac27580d9c701bc043d5d49c8e42331582..78f3d8210145057b7eccf200391bc141ddb057bf 100644 --- a/Framework/API/test/ILatticeFunctionTest.h +++ b/Framework/API/test/ILatticeFunctionTest.h @@ -90,7 +90,7 @@ private: MOCK_METHOD2(functionDerivLattice, void(const LatticeDomain &, Jacobian &)); - MOCK_METHOD1(setCrystalSystem, void(const std::string &)); + MOCK_METHOD1(setLatticeSystem, void(const std::string &)); MOCK_METHOD1(setUnitCell, void(const std::string &)); MOCK_METHOD1(setUnitCell, void(const Mantid::Geometry::UnitCell &)); MOCK_CONST_METHOD0(getUnitCell, Mantid::Geometry::UnitCell()); diff --git a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp index 69601604f705d05258cb1838e948873095112d72..e1965f5f3e0cee0b388d1917de99851011b6871e 100644 --- a/Framework/Crystal/src/OptimizeLatticeForCellType.cpp +++ b/Framework/Crystal/src/OptimizeLatticeForCellType.cpp @@ -233,11 +233,7 @@ API::ILatticeFunction_sptr OptimizeLatticeForCellType::getLatticeFunction(const std::string &cellType, const UnitCell &cell) const { std::ostringstream fun_str; - // TODO remove next 3 lines when PointGroup is changed - if (cellType == "Rhombohedral") - fun_str << "name=LatticeFunction,CrystalSystem=Trigonal"; - else - fun_str << "name=LatticeFunction,CrystalSystem=" << cellType; + fun_str << "name=LatticeFunction,LatticeSystem=" << cellType; API::IFunction_sptr rawFunction = API::FunctionFactory::Instance().createInitialized(fun_str.str()); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h index a56373b31075af5abccf29966b2c68b123f557a1..b2da45f02b56a3c18fd7fbe411d2b88b244863f6 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/Functions/PawleyFunction.h @@ -36,7 +36,7 @@ public: void setAttribute(const std::string &attName, const Attribute &attValue); - Geometry::PointGroup::CrystalSystem getCrystalSystem() const; + Geometry::PointGroup::LatticeSystem getLatticeSystem() const; Geometry::UnitCell getUnitCellFromParameters() const; void setParametersFromUnitCell(const Geometry::UnitCell &cell); @@ -59,10 +59,10 @@ protected: void init(); void setProfileFunction(const std::string &profileFunction); - void setCrystalSystem(const std::string &crystalSystem); + void setLatticeSystem(const std::string &latticeSystem); - void createCrystalSystemParameters( - Geometry::PointGroup::CrystalSystem crystalSystem); + void createLatticeSystemParameters( + Geometry::PointGroup::LatticeSystem latticeSystem); void addLengthConstraint(const std::string ¶meterName); void addAngleConstraint(const std::string ¶meterName); @@ -70,7 +70,7 @@ protected: void setCenterParameterNameFromFunction( const API::IPeakFunction_sptr &profileFunction); - Geometry::PointGroup::CrystalSystem m_crystalSystem; + Geometry::PointGroup::LatticeSystem m_latticeSystem; std::string m_profileFunctionCenterParameterName; }; @@ -123,7 +123,7 @@ public: setMatrixWorkspace(boost::shared_ptr<const API::MatrixWorkspace> workspace, size_t wi, double startX, double endX); - void setCrystalSystem(const std::string &crystalSystem); + void setLatticeSystem(const std::string &latticeSystem); void setProfileFunction(const std::string &profileFunction); void setUnitCell(const std::string &unitCellString); diff --git a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h index 3c8886b0b648fe6475b0312904f2987fe694581e..10d92176be846df09948184274be814cb4469ee7 100644 --- a/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h +++ b/Framework/CurveFitting/inc/MantidCurveFitting/LatticeFunction.h @@ -51,7 +51,7 @@ public: void functionLattice(const API::LatticeDomain &latticeDomain, API::FunctionValues &values) const; - void setCrystalSystem(const std::string &crystalSystem); + void setLatticeSystem(const std::string &crystalSystem); void setUnitCell(const std::string &unitCellString); void setUnitCell(const Geometry::UnitCell &unitCell); Geometry::UnitCell getUnitCell() const; diff --git a/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp index 22b87ff3efafd815630d8527b13152414abfe9cc..eeef4c6d58ba6b6fe8e7e6798fbc35cc4dacc79e 100644 --- a/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp +++ b/Framework/CurveFitting/src/Algorithms/PawleyFit.cpp @@ -199,21 +199,21 @@ void PawleyFit::init() { declareProperty("StartX", 0.0, "Lower border of fitted data range."); declareProperty("EndX", 0.0, "Upper border of fitted data range."); - std::vector<std::string> crystalSystems; - crystalSystems.push_back("Cubic"); - crystalSystems.push_back("Tetragonal"); - crystalSystems.push_back("Hexagonal"); - crystalSystems.push_back("Trigonal"); - crystalSystems.push_back("Orthorhombic"); - crystalSystems.push_back("Monoclinic"); - crystalSystems.push_back("Triclinic"); - - auto crystalSystemValidator = - boost::make_shared<StringListValidator>(crystalSystems); - - declareProperty("CrystalSystem", crystalSystems.back(), - crystalSystemValidator, - "Crystal system to use for refinement."); + std::vector<std::string> latticeSystems; + latticeSystems.push_back("Cubic"); + latticeSystems.push_back("Tetragonal"); + latticeSystems.push_back("Hexagonal"); + latticeSystems.push_back("Rhombohedral"); + latticeSystems.push_back("Orthorhombic"); + latticeSystems.push_back("Monoclinic"); + latticeSystems.push_back("Triclinic"); + + auto latticeSystemValidator = + boost::make_shared<StringListValidator>(latticeSystems); + + declareProperty("LatticeSystem", latticeSystems.back(), + latticeSystemValidator, + "Lattice system to use for refinement."); declareProperty("InitialCell", "1.0 1.0 1.0 90.0 90.0 90.0", "Specification of initial unit cell, given as 'a, b, c, " @@ -282,9 +282,9 @@ void PawleyFit::exec() { g_log.information() << " Selected profile function: " << profileFunction << std::endl; - std::string crystalSystem = getProperty("CrystalSystem"); - pawleyFn->setCrystalSystem(crystalSystem); - g_log.information() << " Selected crystal system: " << crystalSystem + std::string latticeSystem = getProperty("LatticeSystem"); + pawleyFn->setLatticeSystem(latticeSystem); + g_log.information() << " Selected crystal system: " << latticeSystem << std::endl; pawleyFn->setUnitCell(getProperty("InitialCell")); diff --git a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp index d265aa9d56a750cae246b04e4ecc8936feb5d138..33ca783ae1cb436bc4919d2cda947888a670fec7 100644 --- a/Framework/CurveFitting/src/Functions/PawleyFunction.cpp +++ b/Framework/CurveFitting/src/Functions/PawleyFunction.cpp @@ -28,22 +28,22 @@ using namespace Kernel; /// Constructor PawleyParameterFunction::PawleyParameterFunction() - : ParamFunction(), m_crystalSystem(PointGroup::CrystalSystem::Triclinic), + : ParamFunction(), m_latticeSystem(PointGroup::LatticeSystem::Triclinic), m_profileFunctionCenterParameterName() {} /** * @brief Sets the supplied attribute value * * The function calls ParamFunction::setAttribute, but performs additional - * actions for CrystalSystem and ProfileFunction. + * actions for latticeSystem and ProfileFunction. * * @param attName :: Name of the attribute * @param attValue :: Value of the attribute */ void PawleyParameterFunction::setAttribute(const std::string &attName, const Attribute &attValue) { - if (attName == "CrystalSystem") { - setCrystalSystem(attValue.asString()); + if (attName == "LatticeSystem") { + setLatticeSystem(attValue.asString()); } else if (attName == "ProfileFunction") { setProfileFunction(attValue.asString()); } @@ -52,35 +52,35 @@ void PawleyParameterFunction::setAttribute(const std::string &attName, } /// Returns the crystal system -PointGroup::CrystalSystem PawleyParameterFunction::getCrystalSystem() const { - return m_crystalSystem; +PointGroup::LatticeSystem PawleyParameterFunction::getLatticeSystem() const { + return m_latticeSystem; } /// Returns a UnitCell object constructed from the function's parameters. UnitCell PawleyParameterFunction::getUnitCellFromParameters() const { - switch (m_crystalSystem) { - case PointGroup::CrystalSystem::Cubic: { + switch (m_latticeSystem) { + case PointGroup::LatticeSystem::Cubic: { double a = getParameter("a"); double aErr = getError(0); UnitCell uc(a, a, a); uc.setError(aErr, aErr, aErr, 0.0, 0.0, 0.0); return uc; } - case PointGroup::CrystalSystem::Tetragonal: { + case PointGroup::LatticeSystem::Tetragonal: { double a = getParameter("a"); double aErr = getError(0); UnitCell uc(a, a, getParameter("c")); uc.setError(aErr, aErr, getError(1), 0.0, 0.0, 0.0); return uc; } - case PointGroup::CrystalSystem::Hexagonal: { + case PointGroup::LatticeSystem::Hexagonal: { double a = getParameter("a"); double aErr = getError(0); UnitCell uc(a, a, getParameter("c"), 90, 90, 120); uc.setError(aErr, aErr, getError(1), 0.0, 0.0, 0.0); return uc; } - case PointGroup::CrystalSystem::Trigonal: { + case PointGroup::LatticeSystem::Rhombohedral: { double a = getParameter("a"); double alpha = getParameter("Alpha"); double aErr = getError(0); @@ -89,18 +89,18 @@ UnitCell PawleyParameterFunction::getUnitCellFromParameters() const { uc.setError(aErr, aErr, aErr, alphaErr, alphaErr, alphaErr); return uc; } - case PointGroup::CrystalSystem::Orthorhombic: { + case PointGroup::LatticeSystem::Orthorhombic: { UnitCell uc(getParameter("a"), getParameter("b"), getParameter("c")); uc.setError(getError(0), getError(1), getError(2), 0.0, 0.0, 0.0); return uc; } - case PointGroup::CrystalSystem::Monoclinic: { + case PointGroup::LatticeSystem::Monoclinic: { UnitCell uc(getParameter("a"), getParameter("b"), getParameter("c"), 90, getParameter("Beta"), 90); uc.setError(getError(0), getError(1), getError(2), 0.0, getError(3), 0.0); return uc; } - case PointGroup::CrystalSystem::Triclinic: { + case PointGroup::LatticeSystem::Triclinic: { UnitCell uc(getParameter("a"), getParameter("b"), getParameter("c"), getParameter("Alpha"), getParameter("Beta"), getParameter("Gamma")); @@ -163,10 +163,10 @@ void PawleyParameterFunction::functionDeriv(const FunctionDomain &domain, /// Declares attributes and generates parameters based on the defaults. void PawleyParameterFunction::init() { - declareAttribute("CrystalSystem", IFunction::Attribute("Triclinic")); + declareAttribute("LatticeSystem", IFunction::Attribute("Triclinic")); declareAttribute("ProfileFunction", IFunction::Attribute("Gaussian")); - setCrystalSystem("Triclinic"); + setLatticeSystem("Triclinic"); setProfileFunction("Gaussian"); } @@ -193,44 +193,44 @@ void PawleyParameterFunction::setProfileFunction( } /** - * Assigns the crystal system + * Assigns the lattice system * - * This method takes the name of a crystal system (case insensitive) and stores + * This method takes the name of a lattice system (case insensitive) and stores * it. Furthermore it creates the necessary parameters, which means that after * calling this function, PawleyParameterFunction potentially exposes a * different number of parameters. The parameters are constrained to physically * meaningful values (angles between 0 and 180 degrees, cell edges above 0). * - * @param crystalSystem :: Crystal system, case insensitive. + * @param latticeSystem :: Crystal system, case insensitive. */ -void PawleyParameterFunction::setCrystalSystem( - const std::string &crystalSystem) { - m_crystalSystem = Geometry::getCrystalSystemFromString(crystalSystem); +void PawleyParameterFunction::setLatticeSystem( + const std::string &latticeSystem) { + m_latticeSystem = Geometry::getLatticeSystemFromString(latticeSystem); - createCrystalSystemParameters(m_crystalSystem); + createLatticeSystemParameters(m_latticeSystem); } /// This method clears all parameters and declares parameters according to the /// supplied crystal system. -void PawleyParameterFunction::createCrystalSystemParameters( - PointGroup::CrystalSystem crystalSystem) { +void PawleyParameterFunction::createLatticeSystemParameters( + PointGroup::LatticeSystem latticeSystem) { clearAllParameters(); - switch (crystalSystem) { - case PointGroup::CrystalSystem::Cubic: + switch (latticeSystem) { + case PointGroup::LatticeSystem::Cubic: declareParameter("a", 1.0); addLengthConstraint("a"); break; - case PointGroup::CrystalSystem::Hexagonal: - case PointGroup::CrystalSystem::Tetragonal: + case PointGroup::LatticeSystem::Hexagonal: + case PointGroup::LatticeSystem::Tetragonal: declareParameter("a", 1.0); declareParameter("c", 1.0); addLengthConstraint("a"); addLengthConstraint("c"); break; - case PointGroup::CrystalSystem::Orthorhombic: + case PointGroup::LatticeSystem::Orthorhombic: declareParameter("a", 1.0); declareParameter("b", 1.0); declareParameter("c", 1.0); @@ -239,7 +239,7 @@ void PawleyParameterFunction::createCrystalSystemParameters( addLengthConstraint("c"); break; - case PointGroup::CrystalSystem::Monoclinic: + case PointGroup::LatticeSystem::Monoclinic: declareParameter("a", 1.0); declareParameter("b", 1.0); declareParameter("c", 1.0); @@ -251,7 +251,7 @@ void PawleyParameterFunction::createCrystalSystemParameters( addAngleConstraint("Beta"); break; - case PointGroup::CrystalSystem::Trigonal: + case PointGroup::LatticeSystem::Rhombohedral: declareParameter("a", 1.0); declareParameter("Alpha", 90.0); addLengthConstraint("a"); @@ -346,8 +346,8 @@ void PawleyFunction::setMatrixWorkspace( /// Sets the crystal system on the internal parameter function and updates the /// exposed parameters -void PawleyFunction::setCrystalSystem(const std::string &crystalSystem) { - m_pawleyParameterFunction->setAttributeValue("CrystalSystem", crystalSystem); +void PawleyFunction::setLatticeSystem(const std::string &latticeSystem) { + m_pawleyParameterFunction->setAttributeValue("LatticeSystem", latticeSystem); m_compositeFunction->checkFunction(); } diff --git a/Framework/CurveFitting/src/LatticeFunction.cpp b/Framework/CurveFitting/src/LatticeFunction.cpp index 0fd29c73d2762d3ef7ee2772847997eee024d4b3..cacf0c763e65d570a1426943f31dffa1b73a8675 100644 --- a/Framework/CurveFitting/src/LatticeFunction.cpp +++ b/Framework/CurveFitting/src/LatticeFunction.cpp @@ -27,10 +27,10 @@ void LatticeFunction::functionLattice(const LatticeDomain &latticeDomain, /// Assigns the crystal system to the internally stored function. Number of /// parameters may change after this function call. -void LatticeFunction::setCrystalSystem(const std::string &crystalSystem) { +void LatticeFunction::setLatticeSystem(const std::string &crystalSystem) { throwIfNoFunctionSet(); - m_cellParameters->setAttributeValue("CrystalSystem", crystalSystem); + m_cellParameters->setAttributeValue("LatticeSystem", crystalSystem); } /// Sets the unit cell parameters from a string that can be parsed by diff --git a/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h index 1766df896cd2ddba7d2486f7210f2496a25dd0fd..286c3e62f943b556862013bf02e30bdc0a875388 100644 --- a/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h +++ b/Framework/CurveFitting/test/Algorithms/PawleyFitTest.h @@ -52,7 +52,7 @@ public: IAlgorithm_sptr pFit = AlgorithmManager::Instance().create("PawleyFit"); pFit->setProperty("InputWorkspace", ws); pFit->setProperty("WorkspaceIndex", 0); - pFit->setProperty("CrystalSystem", "Hexagonal"); + pFit->setProperty("LatticeSystem", "Hexagonal"); pFit->setProperty("InitialCell", "2.444 2.441 3.937 90 90 120"); pFit->setProperty("PeakTable", hkls); pFit->setProperty("OutputWorkspace", "HCP_output"); @@ -101,7 +101,7 @@ public: IAlgorithm_sptr pFit = AlgorithmManager::Instance().create("PawleyFit"); pFit->setProperty("InputWorkspace", ws); pFit->setProperty("WorkspaceIndex", 0); - pFit->setProperty("CrystalSystem", "Orthorhombic"); + pFit->setProperty("LatticeSystem", "Orthorhombic"); pFit->setProperty("InitialCell", "2.44 3.13 4.07 90 90 90"); pFit->setProperty("PeakTable", hkls); pFit->setProperty("EnableChebyshevBackground", true); diff --git a/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h index 2c6b1f8a1c9de561e6fed97a589c7152d9af2f99..a2d2a463d6b8dd9a0a416143f4f3b9c99e458301 100644 --- a/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h @@ -23,100 +23,100 @@ public: static PawleyFunctionTest *createSuite() { return new PawleyFunctionTest(); } static void destroySuite(PawleyFunctionTest *suite) { delete suite; } - void testCrystalSystem() { + void testLatticeSystem() { PawleyParameterFunction fn; fn.initialize(); - TS_ASSERT(fn.hasAttribute("CrystalSystem")); + TS_ASSERT(fn.hasAttribute("LatticeSystem")); // Cubic, check case insensitivity - TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "cubic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::CrystalSystem::Cubic); - TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "Cubic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::CrystalSystem::Cubic); - TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("CrystalSystem", "CUBIC")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), PointGroup::CrystalSystem::Cubic); + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("LatticeSystem", "cubic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), PointGroup::LatticeSystem::Cubic); + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("LatticeSystem", "Cubic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), PointGroup::LatticeSystem::Cubic); + TS_ASSERT_THROWS_NOTHING(fn.setAttributeValue("LatticeSystem", "CUBIC")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), PointGroup::LatticeSystem::Cubic); // Tetragonal TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "tetragonal")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Tetragonal); + fn.setAttributeValue("LatticeSystem", "tetragonal")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Tetragonal); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "Tetragonal")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Tetragonal); + fn.setAttributeValue("LatticeSystem", "Tetragonal")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Tetragonal); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "TETRAGONAL")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Tetragonal); + fn.setAttributeValue("LatticeSystem", "TETRAGONAL")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Tetragonal); // Hexagonal TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "hexagonal")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Hexagonal); + fn.setAttributeValue("LatticeSystem", "hexagonal")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Hexagonal); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "Hexagonal")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Hexagonal); + fn.setAttributeValue("LatticeSystem", "Hexagonal")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Hexagonal); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "HEXAGONAL")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Hexagonal); + fn.setAttributeValue("LatticeSystem", "HEXAGONAL")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Hexagonal); // Orthorhombic TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "orthorhombic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Orthorhombic); + fn.setAttributeValue("LatticeSystem", "orthorhombic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Orthorhombic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "Orthorhombic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Orthorhombic); + fn.setAttributeValue("LatticeSystem", "Orthorhombic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Orthorhombic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "ORTHORHOMBIC")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Orthorhombic); + fn.setAttributeValue("LatticeSystem", "ORTHORHOMBIC")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Orthorhombic); // Monoclinic TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "monoclinic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Monoclinic); + fn.setAttributeValue("LatticeSystem", "monoclinic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Monoclinic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "Monoclinic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Monoclinic); + fn.setAttributeValue("LatticeSystem", "Monoclinic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Monoclinic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "MONOCLINIC")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Monoclinic); + fn.setAttributeValue("LatticeSystem", "MONOCLINIC")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Monoclinic); // Triclinic TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "triclinic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Triclinic); + fn.setAttributeValue("LatticeSystem", "triclinic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Triclinic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "Triclinic")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Triclinic); + fn.setAttributeValue("LatticeSystem", "Triclinic")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Triclinic); TS_ASSERT_THROWS_NOTHING( - fn.setAttributeValue("CrystalSystem", "TRICLINIC")); - TS_ASSERT_EQUALS(fn.getCrystalSystem(), - PointGroup::CrystalSystem::Triclinic); + fn.setAttributeValue("LatticeSystem", "TRICLINIC")); + TS_ASSERT_EQUALS(fn.getLatticeSystem(), + PointGroup::LatticeSystem::Triclinic); // invalid string - TS_ASSERT_THROWS(fn.setAttributeValue("CrystalSystem", "invalid"), + TS_ASSERT_THROWS(fn.setAttributeValue("LatticeSystem", "invalid"), std::invalid_argument); } - void testCrystalSystemConstraintsCubic() { + void testLatticeSystemConstraintsCubic() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Cubic"); + fn.setAttributeValue("LatticeSystem", "Cubic"); TS_ASSERT_EQUALS(fn.nParams(), 2); @@ -133,11 +133,11 @@ public: cellParametersAre(cell, 3.0, 3.0, 3.0, 90.0, 90.0, 90.0); } - void testCrystalSystemConstraintsTetragonal() { + void testLatticeSystemConstraintsTetragonal() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Tetragonal"); + fn.setAttributeValue("LatticeSystem", "Tetragonal"); TS_ASSERT_EQUALS(fn.nParams(), 3); @@ -155,11 +155,11 @@ public: cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 90.0); } - void testCrystalSystemConstraintsHexagonal() { + void testLatticeSystemConstraintsHexagonal() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Hexagonal"); + fn.setAttributeValue("LatticeSystem", "Hexagonal"); TS_ASSERT_EQUALS(fn.nParams(), 3); @@ -177,11 +177,11 @@ public: cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 120.0); } - void testCrystalSystemConstraintsTrigonal() { + void testLatticeSystemConstraintsRhombohedral() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Trigonal"); + fn.setAttributeValue("LatticeSystem", "Rhombohedral"); TS_ASSERT_EQUALS(fn.nParams(), 3); @@ -199,11 +199,11 @@ public: cellParametersAre(cell, 3.0, 3.0, 3.0, 101.0, 101.0, 101.0); } - void testCrystalSystemConstraintsOrthorhombic() { + void testLatticeSystemConstraintsOrthorhombic() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Orthorhombic"); + fn.setAttributeValue("LatticeSystem", "Orthorhombic"); TS_ASSERT_EQUALS(fn.nParams(), 4); @@ -222,11 +222,11 @@ public: cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 90.0, 90.0); } - void testCrystalSystemConstraintsMonoclinic() { + void testLatticeSystemConstraintsMonoclinic() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Monoclinic"); + fn.setAttributeValue("LatticeSystem", "Monoclinic"); TS_ASSERT_EQUALS(fn.nParams(), 5); @@ -246,11 +246,11 @@ public: cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 101.0, 90.0); } - void testCrystalSystemConstraintsTriclinic() { + void testLatticeSystemConstraintsTriclinic() { PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Triclinic"); + fn.setAttributeValue("LatticeSystem", "Triclinic"); TS_ASSERT_EQUALS(fn.nParams(), 7); @@ -275,7 +275,7 @@ public: PawleyParameterFunction fn; fn.initialize(); - fn.setAttributeValue("CrystalSystem", "Triclinic"); + fn.setAttributeValue("LatticeSystem", "Triclinic"); UnitCell cell(3., 4., 5., 101., 111., 103.); @@ -288,7 +288,7 @@ public: TS_ASSERT_EQUALS(fn.getParameter("Beta"), 111.0); TS_ASSERT_EQUALS(fn.getParameter("Gamma"), 103.0); - fn.setAttributeValue("CrystalSystem", "Cubic"); + fn.setAttributeValue("LatticeSystem", "Cubic"); cell.seta(5.43); TS_ASSERT_THROWS_NOTHING(fn.setParametersFromUnitCell(cell)); @@ -323,13 +323,13 @@ public: TS_ASSERT_EQUALS(fn.nParams(), 7); } - void testPawleyFunctionSetCrystalSystem() { + void testPawleyFunctionSetLatticeSystem() { PawleyFunction fn; fn.initialize(); TS_ASSERT_EQUALS(fn.nParams(), 7); - fn.setCrystalSystem("Cubic"); + fn.setLatticeSystem("Cubic"); TS_ASSERT_EQUALS(fn.nParams(), 2); } @@ -439,7 +439,7 @@ public: PawleyFunction_sptr pawleyFn = boost::make_shared<PawleyFunction>(); pawleyFn->initialize(); - pawleyFn->setCrystalSystem("Cubic"); + pawleyFn->setLatticeSystem("Cubic"); pawleyFn->addPeak(V3D(1, 1, 1), 0.0065, 35.0); pawleyFn->addPeak(V3D(2, 2, 0), 0.0045, 110.0); pawleyFn->setUnitCell("5.4295 5.4295 5.4295"); @@ -475,7 +475,7 @@ public: PawleyFunction_sptr pawleyFn = boost::make_shared<PawleyFunction>(); pawleyFn->initialize(); - pawleyFn->setCrystalSystem("Cubic"); + pawleyFn->setLatticeSystem("Cubic"); pawleyFn->addPeak(V3D(1, 1, 1), 0.0065, 35.0); pawleyFn->addPeak(V3D(2, 2, 0), 0.0045, 115.0); pawleyFn->addPeak(V3D(3, 1, 1), 0.0035, 115.0); diff --git a/Framework/CurveFitting/test/LatticeFunctionTest.h b/Framework/CurveFitting/test/LatticeFunctionTest.h index 577b9bfb7f1b573338a67b173e5ab33b57c6a06d..711c8588a7758d631487bf7cf02fc0ad8d01a0dd 100644 --- a/Framework/CurveFitting/test/LatticeFunctionTest.h +++ b/Framework/CurveFitting/test/LatticeFunctionTest.h @@ -27,22 +27,22 @@ public: } static void destroySuite(LatticeFunctionTest *suite) { delete suite; } - void testSetCrystalSystem() { + void testSetLatticeSystem() { LatticeFunction fn; fn.initialize(); - TS_ASSERT_THROWS_NOTHING(fn.setCrystalSystem("Cubic")); - TS_ASSERT_THROWS_NOTHING(fn.setCrystalSystem("Tetragonal")); - TS_ASSERT_THROWS_NOTHING(fn.setCrystalSystem("triclinic")); + TS_ASSERT_THROWS_NOTHING(fn.setLatticeSystem("Cubic")); + TS_ASSERT_THROWS_NOTHING(fn.setLatticeSystem("Tetragonal")); + TS_ASSERT_THROWS_NOTHING(fn.setLatticeSystem("triclinic")); - TS_ASSERT_THROWS(fn.setCrystalSystem("DoesNotExist"), + TS_ASSERT_THROWS(fn.setLatticeSystem("DoesNotExist"), std::invalid_argument); - fn.setCrystalSystem("Cubic"); + fn.setLatticeSystem("Cubic"); // a and ZeroShift TS_ASSERT_EQUALS(fn.nParams(), 2); - fn.setCrystalSystem("Hexagonal"); + fn.setLatticeSystem("Hexagonal"); // a, c and ZeroShift TS_ASSERT_EQUALS(fn.nParams(), 3); @@ -100,7 +100,7 @@ public: fn.initialize(); // Al2O3, from PoldiCreatePeaksFromCell system test. - fn.setCrystalSystem("Hexagonal"); + fn.setLatticeSystem("Hexagonal"); fn.setParameter("a", 4.7605); fn.setParameter("c", 12.9956); @@ -138,7 +138,7 @@ public: IFunction_sptr fn = FunctionFactory::Instance().createFunction("LatticeFunction"); - fn->setAttributeValue("CrystalSystem", "Cubic"); + fn->setAttributeValue("LatticeSystem", "Cubic"); fn->addTies("ZeroShift=0.0"); fn->setParameter("a", 5); diff --git a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 1a7c1005d68692eb07359cc90d0ad0731cadf8ed..44e22c88b05ac47ed2345d071902bb8bf4330984 100644 --- a/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h +++ b/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -105,12 +105,12 @@ protected: getFunctionPawley(std::string profileFunctionName, const PoldiPeakCollection_sptr &peakCollection); - std::string getCrystalSystemFromPointGroup( + std::string getLatticeSystemFromPointGroup( const Geometry::PointGroup_sptr &pointGroup) const; std::string getRefinedStartingCell(const std::string &initialCell, - const std::string &crystalSystem, + const std::string &latticeSystem, const PoldiPeakCollection_sptr &peakCollection); std::string getUserSpecifiedTies(const API::IFunction_sptr &poldiFn); diff --git a/Framework/SINQ/src/PoldiFitPeaks2D.cpp b/Framework/SINQ/src/PoldiFitPeaks2D.cpp index a2a1ed2ba2e2f36c30e493904c791591c41ea195..4da20abea08a71634ecedcaa74a59d80ac31c884 100644 --- a/Framework/SINQ/src/PoldiFitPeaks2D.cpp +++ b/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -546,13 +546,13 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley( "peaks do not have point group."); } - std::string crystalSystem = getCrystalSystemFromPointGroup(pointGroup); - pawleyFunction->setCrystalSystem(crystalSystem); + std::string latticeSystem = getLatticeSystemFromPointGroup(pointGroup); + pawleyFunction->setLatticeSystem(latticeSystem); UnitCell cell = peakCollection->unitCell(); // Extract unit cell from peak collection pawleyFunction->setUnitCell(getRefinedStartingCell( - unitCellToStr(cell), crystalSystem, peakCollection)); + unitCellToStr(cell), latticeSystem, peakCollection)); IPeakFunction_sptr pFun = boost::dynamic_pointer_cast<IPeakFunction>( FunctionFactory::Instance().createFunction(profileFunctionName)); @@ -575,32 +575,21 @@ Poldi2DFunction_sptr PoldiFitPeaks2D::getFunctionPawley( } /** - * Returns the crystal system for the specified point group + * Returns the lattice system for the specified point group * - * This function simply uses Geometry::getCrystalSystemAsString(), except when - * the crystal system is trigonal but the point group uses hexagonal axes. In - * that case this function returns the string for PointGroup::Hexagonal. + * This function simply uses Geometry::getLatticeSystemAsString(). * * @param pointGroup :: The point group for which to find the crystal system * @return The crystal system for the point group */ -std::string PoldiFitPeaks2D::getCrystalSystemFromPointGroup( +std::string PoldiFitPeaks2D::getLatticeSystemFromPointGroup( const PointGroup_sptr &pointGroup) const { if (!pointGroup) { throw std::invalid_argument( - "Cannot return crystal system for null PointGroup."); + "Cannot return lattice system for null PointGroup."); } - PointGroup::CrystalSystem crystalSystem = pointGroup->crystalSystem(); - - if (crystalSystem == PointGroup::CrystalSystem::Trigonal) { - if (pointGroup->getCoordinateSystem() == - Group::CoordinateSystem::Hexagonal) { - return getCrystalSystemAsString(PointGroup::CrystalSystem::Hexagonal); - } - } - - return getCrystalSystemAsString(crystalSystem); + return Geometry::getLatticeSystemAsString(pointGroup->latticeSystem()); } /** @@ -618,7 +607,7 @@ std::string PoldiFitPeaks2D::getCrystalSystemFromPointGroup( * @return String for refined unit cell */ std::string PoldiFitPeaks2D::getRefinedStartingCell( - const std::string &initialCell, const std::string &crystalSystem, + const std::string &initialCell, const std::string &latticeSystem, const PoldiPeakCollection_sptr &peakCollection) { Geometry::UnitCell cell = Geometry::strToUnitCell(initialCell); @@ -627,7 +616,7 @@ std::string PoldiFitPeaks2D::getRefinedStartingCell( boost::dynamic_pointer_cast<ILatticeFunction>( FunctionFactory::Instance().createFunction("LatticeFunction")); - latticeFunction->setCrystalSystem(crystalSystem); + latticeFunction->setLatticeSystem(latticeSystem); latticeFunction->fix(latticeFunction->parameterIndex("ZeroShift")); latticeFunction->setUnitCell(cell); diff --git a/Framework/SINQ/test/PoldiFitPeaks2DTest.h b/Framework/SINQ/test/PoldiFitPeaks2DTest.h index a9f11eb2d9af4e130098bdbf47729f9625cfc4e6..e68a20098256548a7bd18ed07b10f07e867dd1f8 100644 --- a/Framework/SINQ/test/PoldiFitPeaks2DTest.h +++ b/Framework/SINQ/test/PoldiFitPeaks2DTest.h @@ -437,33 +437,34 @@ public: TestablePoldiFitPeaks2D alg; auto pgCubic = PointGroupFactory::Instance().createPointGroup("m-3m"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgCubic), "Cubic"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgCubic), "Cubic"); auto pgTetra = PointGroupFactory::Instance().createPointGroup("4/mmm"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTetra), "Tetragonal"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgTetra), "Tetragonal"); auto pgOrtho = PointGroupFactory::Instance().createPointGroup("mmm"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgOrtho), + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgOrtho), "Orthorhombic"); auto pgMono = PointGroupFactory::Instance().createPointGroup("2/m"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgMono), "Monoclinic"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgMono), "Monoclinic"); auto pgTric = PointGroupFactory::Instance().createPointGroup("-1"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTric), "Triclinic"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgTric), "Triclinic"); auto pgHex = PointGroupFactory::Instance().createPointGroup("6/mmm"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgHex), "Hexagonal"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgHex), "Hexagonal"); auto pgTrigRh = PointGroupFactory::Instance().createPointGroup("-3m r"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigRh), "Trigonal"); + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgTrigRh), + "Rhombohedral"); auto pgTrigHex = PointGroupFactory::Instance().createPointGroup("-3m"); - TS_ASSERT_EQUALS(alg.getCrystalSystemFromPointGroup(pgTrigHex), + TS_ASSERT_EQUALS(alg.getLatticeSystemFromPointGroup(pgTrigHex), "Hexagonal"); PointGroup_sptr invalid; - TS_ASSERT_THROWS(alg.getCrystalSystemFromPointGroup(invalid), + TS_ASSERT_THROWS(alg.getLatticeSystemFromPointGroup(invalid), std::invalid_argument); } diff --git a/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h index df2a8c68069a5dede05606258509334db7cf2123..ef0bca3397ef7442304e21522c3ac4070c6e33c9 100644 --- a/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h +++ b/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h @@ -30,7 +30,7 @@ public: MOCK_CONST_METHOD2(function, void(const FunctionDomain &, FunctionValues &)); // IPawleyFunction interface - MOCK_METHOD1(setCrystalSystem, void(const std::string &)); + MOCK_METHOD1(setLatticeSystem, void(const std::string &)); MOCK_METHOD1(setProfileFunction, void(const std::string &)); MOCK_METHOD1(setUnitCell, void(const std::string &)); @@ -132,7 +132,7 @@ public: IPawleyFunction_sptr pFn = fn.getPawleyFunction(); pFn->setProfileFunction("Gaussian"); - pFn->setCrystalSystem("Cubic"); + pFn->setLatticeSystem("Cubic"); // Only the first figure matters, because of cubic pFn->setUnitCell("5.43122617238802162554 5.431 5.431 90 90 90"); pFn->addPeak(V3D(4, 2, 2), 0.0027446316797104233, 679.59369981039407842726);