|
24 | 24 |
|
25 | 25 | #include <diffpy/srreal/PQEvaluator.hpp>
|
26 | 26 | #include <diffpy/srreal/AtomicStructureAdapter.hpp>
|
| 27 | +#include <diffpy/srreal/PeriodicStructureAdapter.hpp> |
27 | 28 | #include <diffpy/srreal/PDFCalculator.hpp>
|
28 | 29 | #include <diffpy/srreal/OverlapCalculator.hpp>
|
| 30 | +#include "test_helpers.hpp" |
29 | 31 |
|
30 | 32 | namespace diffpy {
|
31 | 33 | namespace srreal {
|
@@ -145,6 +147,34 @@ class TestPQEvaluator : public CxxTest::TestSuite
|
145 | 147 | }
|
146 | 148 |
|
147 | 149 |
|
| 150 | + void test_PDF_type_mask() |
| 151 | + { |
| 152 | + mpdfcb.setTypeMask("O2-", "all", false); |
| 153 | + mpdfco.setTypeMask("O2-", "all", false); |
| 154 | + PeriodicStructureAdapterPtr litao = |
| 155 | + boost::dynamic_pointer_cast<PeriodicStructureAdapter>( |
| 156 | + loadTestPeriodicStructure("LiTaO3.stru")); |
| 157 | + TS_ASSERT_EQUALS(mzeros, this->pdfcdiff(litao)); |
| 158 | + TS_ASSERT_EQUALS(BASIC, mpdfco.getEvaluatorTypeUsed()); |
| 159 | + QuantityType gb0 = mpdfcb.getPDF(); |
| 160 | + // change masked-away oxygen |
| 161 | + Atom& o29 = litao->at(29); |
| 162 | + TS_ASSERT_EQUALS("O2-", o29.atomtype); |
| 163 | + o29.xyz_cartn = R3::Vector(0.1, 0.2, 0.3); |
| 164 | + TS_ASSERT_EQUALS(mzeros, this->pdfcdiff(litao)); |
| 165 | + TS_ASSERT_EQUALS(OPTIMIZED, mpdfco.getEvaluatorTypeUsed()); |
| 166 | + QuantityType gb1 = mpdfcb.getPDF(); |
| 167 | + TS_ASSERT_EQUALS(gb0, gb1); |
| 168 | + // change active lithium |
| 169 | + Atom& li0 = litao->at(0); |
| 170 | + li0.occupancy = 0.1; |
| 171 | + TS_ASSERT(allclose(mzeros, this->pdfcdiff(litao))); |
| 172 | + TS_ASSERT_EQUALS(OPTIMIZED, mpdfco.getEvaluatorTypeUsed()); |
| 173 | + QuantityType gb2 = mpdfcb.getPDF(); |
| 174 | + TS_ASSERT(!allclose(gb0, gb2)); |
| 175 | + } |
| 176 | + |
| 177 | + |
148 | 178 | void test_optimized_unsupported()
|
149 | 179 | {
|
150 | 180 | OverlapCalculator olc;
|
|
0 commit comments