void test_bondCountWurtzite() { StructureAdapterPtr stru = loadTestPeriodicStructure("ZnS_wurtzite.stru"); BaseBondGeneratorPtr bnds = stru->createBondGenerator(); TS_ASSERT_EQUALS(4, stru->countSites()); bnds->selectAnchorSite(0); bnds->selectSiteRange(0, 4); bnds->setRmin(0); // there should be no bond below the ZnS distance 2.31 bnds->setRmax(2.2); TS_ASSERT_EQUALS(0, countBonds(*bnds)); // z-neighbor is slightly more distant than 3 in the lower plane bnds->setRmax(2.35); TS_ASSERT_EQUALS(3, countBonds(*bnds)); bnds->setRmax(2.5); TS_ASSERT_EQUALS(4, countBonds(*bnds)); // there are 12 second nearest neighbors at 3.81 bnds->setRmin(3.7); bnds->setRmax(3.82); TS_ASSERT_EQUALS(12, countBonds(*bnds)); // and one more at 3.83 bnds->setRmax(3.85); TS_ASSERT_EQUALS(13, countBonds(*bnds)); // making the total 17 bnds->setRmin(0); TS_ASSERT_EQUALS(17, countBonds(*bnds)); // and the same happens for all other sites bnds->selectAnchorSite(1); TS_ASSERT_EQUALS(17, countBonds(*bnds)); bnds->selectAnchorSite(2); TS_ASSERT_EQUALS(17, countBonds(*bnds)); bnds->selectAnchorSite(3); TS_ASSERT_EQUALS(17, countBonds(*bnds)); }
void setUp() { CxxTest::setAbortTestOnFail(true); if (!m_ni) { m_ni = loadTestPeriodicStructure("Ni.stru"); } m_nibnds = m_ni->createBondGenerator(); CxxTest::setAbortTestOnFail(false); }
void test_LiTaO3() { const string lithium = "Li1+"; const string tantalum = "Ta5+"; const string oxygen = "O2-"; const double epsu = 1e-5; StructureAdapterPtr stru = loadTestPeriodicStructure("LiTaO3.stru"); TS_ASSERT_EQUALS(30, stru->countSites()); BaseBondGeneratorPtr bnds = stru->createBondGenerator(); bnds->selectAnchorSite(0); bnds->selectSiteRange(0, 30); // there are 3 oxygen neighbors at 2.065 bnds->setRmax(2.1); TS_ASSERT_EQUALS(3, countBonds(*bnds)); // Li at site 0 is isotropic, oxygens have equal msd-s towards Li for (bnds->rewind(); !bnds->finished(); bnds->next()) { TS_ASSERT_EQUALS(lithium, stru->siteAtomType(bnds->site0())); TS_ASSERT_EQUALS(oxygen, stru->siteAtomType(bnds->site1())); TS_ASSERT_DELTA(0.00265968, testmsd0(stru, bnds), epsu); TS_ASSERT_DELTA(0.00710945, testmsd1(stru, bnds), epsu); } // there are 3 oxygen neighbors at 2.26 bnds->setRmin(2.2); bnds->setRmax(2.3); TS_ASSERT_EQUALS(3, countBonds(*bnds)); for (bnds->rewind(); !bnds->finished(); bnds->next()) { TS_ASSERT_EQUALS(oxygen, stru->siteAtomType(bnds->site1())); TS_ASSERT_DELTA(0.00265968, testmsd0(stru, bnds), epsu); TS_ASSERT_DELTA(0.00824319, testmsd1(stru, bnds), epsu); } // finally there are 4 Ta neighbors between 2.8 and 3.1 bnds->setRmin(2.8); bnds->setRmax(3.1); TS_ASSERT_EQUALS(4, countBonds(*bnds)); for (bnds->rewind(); !bnds->finished(); bnds->next()) { TS_ASSERT_DELTA(0.00265968, testmsd0(stru, bnds), epsu); TS_ASSERT_EQUALS(tantalum, stru->siteAtomType(bnds->site1())); R3::Vector r01xy = bnds->r01(); r01xy[2] = 0.0; // for the tantalum above Li the msd equals U33 if (R3::norm(r01xy) < 0.1) { TS_ASSERT_DELTA(0.00356, testmsd1(stru, bnds), epsu); } // other 3 tantalums are related by tripple axis and // have the same msd towards the central Li else { TS_ASSERT_DELTA(0.00486942, testmsd1(stru, bnds), epsu); } } }