コード例 #1
0
 void test_ticker()
 {
     using diffpy::eventticker::EventTicker;
     msftb = ScatteringFactorTable::createByType("X");
     EventTicker e0 = msftb->ticker();
     TS_ASSERT_EQUALS(e0, msftb->clone()->ticker());
     TS_ASSERT_EQUALS(e0, dumpandload(msftb)->ticker());
     msftb->setCustomAs("C", "C", 6.1);
     TS_ASSERT_LESS_THAN(e0, msftb->ticker());
 }
コード例 #2
0
 void test_SFTNeutron()
 {
     msftb = ScatteringFactorTable::createByType("N");
     TS_ASSERT_DELTA(3.63, msftb->lookup("Na"), mtol);
     TS_ASSERT_DELTA(-3.37, msftb->lookup("Ti"), mtol);
     TS_ASSERT_DELTA(5.805, msftb->lookup("O"), mtol);
     TS_ASSERT_DELTA(6.6484, msftb->lookup("C"), mtol);
     TS_ASSERT_EQUALS(msftb->lookup("Na"), msftb->lookup("Na1+"));
     TS_ASSERT_EQUALS(msftb->lookup("Ge"), msftb->lookup("Ge0+"));
     TS_ASSERT_EQUALS("neutron", msftb->clone()->type());
 }
コード例 #3
0
 void test_ElectronNumber()
 {
     msftb = ScatteringFactorTable::createByType("electronnumber");
     TS_ASSERT_EQUALS(8.0, msftb->lookup("O"));
     TS_ASSERT_EQUALS(10.0, msftb->lookup("O2-"));
     TS_ASSERT_EQUALS(18.0, msftb->lookup("K+"));
     TS_ASSERT_EQUALS(18.0, msftb->lookup("K1+"));
     TS_ASSERT_EQUALS(68.0, msftb->lookup("W6+"));
     TS_ASSERT_THROWS(msftb->lookup("H4+"), invalid_argument);
     TS_ASSERT_THROWS(msftb->lookup("O3+"), invalid_argument);
     TS_ASSERT_EQUALS("electronnumber", msftb->clone()->type());
 }
コード例 #4
0
 void test_SFTElectron()
 {
     using diffpy::mathutils::DOUBLE_MAX;
     msftb = ScatteringFactorTable::createByType("E");
     TS_ASSERT_EQUALS(DOUBLE_MAX, msftb->lookup("H"));
     TS_ASSERT_EQUALS(DOUBLE_MAX, msftb->lookup("Ra"));
     TS_ASSERT_DELTA(3.42104, msftb->lookup("Na", 1), 1e-5);
     TS_ASSERT_DELTA(1.34868, msftb->lookup("Na", 3), 1e-5);
     TS_ASSERT_DELTA(0.832158, msftb->lookup("Na", 5), 1e-5);
     TS_ASSERT_THROWS(msftb->lookup("H4+"), invalid_argument);
     TS_ASSERT_THROWS(msftb->lookup("H4+", 3), invalid_argument);
     TS_ASSERT_EQUALS("electron", msftb->clone()->type());
 }
コード例 #5
0
 void test_SFTXray()
 {
     msftb = ScatteringFactorTable::createByType("X");
     TS_ASSERT_DELTA(1.0, msftb->lookup("H"), 0.01);
     TS_ASSERT_DELTA(8.0, msftb->lookup("O"), 0.01);
     TS_ASSERT_DELTA(10.0, msftb->lookup("O2-"), 0.01);
     TS_ASSERT_DELTA(11.0, msftb->lookup("Na"), 0.01);
     TS_ASSERT_DELTA(10.0, msftb->lookup("Na+"), 0.01);
     TS_ASSERT_EQUALS(msftb->lookup("Na+"), msftb->lookup("Na1+"));
     TS_ASSERT_DELTA(74.0, msftb->lookup("W"), 0.04);
     TS_ASSERT_DELTA(88.0, msftb->lookup("Ra"), 0.04);
     TS_ASSERT_EQUALS(msftb->lookup("Si"), msftb->lookup("Si0+"));
     TS_ASSERT_EQUALS("xray", msftb->clone()->type());
 }
コード例 #6
0
 void test_getCustomSymbols()
 {
     msftb = ScatteringFactorTable::createByType("X");
     TS_ASSERT(msftb->getCustomSymbols().empty());
     msftb->setCustomAs("C", "C", 6.1);
     TS_ASSERT_EQUALS(1u, msftb->getCustomSymbols().size());
     TS_ASSERT_EQUALS(1u, msftb->getCustomSymbols().count("C"));
     msftb->setCustomAs("C", "C", 6.3);
     TS_ASSERT_EQUALS(1u, msftb->getCustomSymbols().size());
     TS_ASSERT_EQUALS(1u, msftb->getCustomSymbols().count("C"));
     TS_ASSERT_DELTA(6.3, msftb->lookup("C"), meps);
     ScatteringFactorTablePtr sftb1 = msftb->clone();
     msftb->resetCustom("C");
     TS_ASSERT(msftb->getCustomSymbols().empty());
     TS_ASSERT_EQUALS(1u, sftb1->getCustomSymbols().size());
     TS_ASSERT_EQUALS(1u, sftb1->getCustomSymbols().count("C"));
     TS_ASSERT_DELTA(6.3, sftb1->lookup("C"), meps);
     sftb1->resetAll();
     TS_ASSERT(msftb->getCustomSymbols().empty());
 }