Skip to content

Commit

Permalink
Use UnitCell. Refs #6020.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Dec 28, 2012
1 parent 034c7a0 commit 678aa5a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace CurveFitting
/// Parse the fitting result
std::string parseFitResult(API::IAlgorithm_sptr fitalg, double& chi2);

double calculateDspaceValue(std::vector<int> hkl);
// double calculateDspaceValue(std::vector<int> hkl);

/// Calculate a Bragg peak's centre in TOF from its Miller indices and with instrumental parameters
double calculatePeakCentreTOF(int h, int k, int l);
Expand Down
18 changes: 15 additions & 3 deletions Code/Mantid/Framework/CurveFitting/src/FitPowderDiffPeaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "MantidCurveFitting/BoundaryConstraint.h"
#include "MantidCurveFitting/Gaussian.h"

#include "MantidGeometry/Crystal/UnitCell.h"

#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>

Expand Down Expand Up @@ -1357,10 +1359,15 @@ namespace CurveFitting
// 2. Calculate d-values for each picked peak
std::vector<std::pair<double, std::vector<int> > > dhkls;
std::vector<std::vector<int> >::iterator peakiter;

double lattice = m_instrumentParmaeters["LatticeConstant"];
Geometry::UnitCell unitcell(lattice, lattice, lattice, 90.0, 90.0, 90.0);

for (peakiter = goodfitpeaks.begin(); peakiter != goodfitpeaks.end(); ++peakiter)
{
std::vector<int> hkl = *peakiter;
double d_h = calculateDspaceValue(hkl);
// double d_h = calculateDspaceValue(hkl);
double d_h = unitcell.d(hkl[0], hkl[1], hkl[2]);
dhkls.push_back(std::make_pair(d_h, hkl));
}

Expand Down Expand Up @@ -1695,7 +1702,6 @@ namespace CurveFitting

//----------------------------------------------------------------------------------------------
/** Calculate peak's d-spacing
*/
double FitPowderDiffPeaks::calculateDspaceValue(std::vector<int> hkl)
{
// g_log.information() << "HKL = " << hkl[0] << hkl[1] << hkl[2] << std::endl;
Expand All @@ -1710,18 +1716,24 @@ namespace CurveFitting
return d;
}
*/

/** Calculate a Bragg peak's centre in TOF from its Miller indices
* and with instrumental parameters
*/
double FitPowderDiffPeaks::calculatePeakCentreTOF(int h, int k, int l)
{
/*
vector<int> hkl(3);
hkl[0] = h;
hkl[1] = k;
hkl[2] = l;

double dh = calculateDspaceValue(hkl);
*/

double lattice = m_instrumentParmaeters["LatticeConstant"];
Geometry::UnitCell unitcell(lattice, lattice, lattice, 90.0, 90.0, 90.0);
double dh = unitcell.d(h, k, l);

// 2. Get parameter values from instrument parameter map
double dtt1 = getParameter("Dtt1");
Expand Down

0 comments on commit 678aa5a

Please sign in to comment.