Skip to content

Commit

Permalink
Checkpointing work. Refs #7653.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Aug 21, 2013
1 parent ad7a75f commit 4b9e26c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ namespace CurveFitting
double gam1 = getParameter(12);
double gam2 = getParameter(13);

double latticeconstant = getParameter(14);
double latticeconstant = getParameter(LATTICEINDEX);

double dh, tof_h, eta, alpha, beta, H, sigma2, gamma, N;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,85 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite
void test_accessParameter()
{
NeutronBk2BkExpConvPVoigt func;
func.setParameter("A", 1.0);
double a = func.getParameter("A");
TS_ASSERT_EQUALS(a, 1.0);
func.setParameter("Dtt1", 1.0);
double dtt1 = func.getParameter("Dtt1");
TS_ASSERT_EQUALS(dtt1, 1.0);

// Blabla
func.setParameter("Dtt2", 2.0);
double dtt2 = func.getParameter("Dtt2");
TS_ASSERT_EQUALS(dtt2, 2.0);

TS_ASSERT_THROWS_ANYTHING(func.setParameter("Fake", 0.0));

return;
}

//----------------------------------------------------------------------------------------------
/** Calculate peak positions
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void test_calculatePeakPositions()
{
NeutronBk2BkExpConvPVoigt func;

func.setParameter("Dtt1", 0.0);
func.setParameter("Dtt2", 0.0);
func.setParameter("Zero", 0.0);
func.setParameter("LatticeConstant", 0.0);
func.setParameter("Dtt1", 7476.910);
func.setParameter("Dtt2", -1.540);
func.setParameter("Zero", -9.227);
func.setParameter("LatticeConstant", 5.431363); // Silicon

// (1,1,1)
func.setMillerIndex(1, 1, 1);
func.calculateParameters(false);
double tofh1 = func.centre();
TS_ASSERT_DELTA(tofh1, 23421.7207, 0.01);

// (2, 2, 0)
func.setMillerIndex(2, 2, 0);
func.calculateParameters(false);
double tofh2 = func.centre();
TS_ASSERT_DELTA(tofh2, 14342.8350, 0.01);

// (3,1,1)
func.setMillerIndex(3, 1, 1);
func.calculateParameters(false);
double tofh3 = func.centre();
TS_ASSERT_DELTA(tofh3, 12230.9648, 0.01);

// (2, 2, 2)
func.setMillerIndex(2, 2, 2);
func.calculateParameters(false);
double tofh4 = func.centre();
TS_ASSERT_DELTA(tofh4, 11710.0332, 0.01);

}
/* From arg_si.prf
11710.0332 0 ( 2 2 2) 0 1
12230.9648 0 ( 3 1 1) 0 1
14342.8350 0 ( 2 2 0) 0 1
23421.7207 0 ( 1 1 1) 0 1
*/

//----------------------------------------------------------------------------------------------
/** Calculate peak positions: data is from Fullprof's sample: arg_si
*/
void test_calculatePeakShape()
{
NeutronBk2BkExpConvPVoigt func;

func.setParameter("Dtt1", 7476.910);
func.setParameter("Dtt2", -1.540);
func.setParameter("Zero", -9.227);
func.setParameter("LatticeConstant", 5.431363); // Silicon

func.setParameter("Alph0", 0.000000);
func.setParameter("Alph1", 0.597100);
func.setParameter("Beta0", 0.042210);
func.setParameter("Beta1", 0.009460);
func.setParameter("Sig0", 3.032);
func.setParameter("Sig1", 33.027);
func.setParameter("Sig2", 0.000);
func.setParameter("Gam0", 0.000);
func.setParameter("Gam0", 2.604);
func.setParameter("Gam0", 0.000);

func.setMillerIndex(1, 1, 0);
func.calculateParameters(false);
Expand All @@ -48,7 +109,6 @@ class NeutronBk2BkExpConvPVoigtTest : public CxxTest::TestSuite

}


};


Expand Down

0 comments on commit 4b9e26c

Please sign in to comment.