void test_siteAtomType()
 {
     TS_ASSERT_EQUALS(string("Ni"), m_ni->siteAtomType(0));
     TS_ASSERT_EQUALS(string("Ni"), m_ni->siteAtomType(3));
     TS_ASSERT_EQUALS(string("K1+"), m_kbise->siteAtomType(0));
     TS_ASSERT_EQUALS(string("Bi3+"), m_kbise->siteAtomType(2));
     TS_ASSERT_EQUALS(string("Se"), m_kbise->siteAtomType(10));
     TS_ASSERT_EQUALS(string("Se"), m_kbise->siteAtomType(22));
 }
 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);
         }
     }
 }
 void test_serialization()
 {
     StructureAdapterPtr stru1;
     stru1 = dumpandload(mstru);
     AtomicStructureAdapterPtr astru1 =
         boost::dynamic_pointer_cast<AtomicStructureAdapter>(stru1);
     TS_ASSERT(!astru1);
     TS_ASSERT_EQUALS(0, stru1->countSites());
     TS_ASSERT_EQUALS(stru1, stru1->clone());
     TS_ASSERT_THROWS(mstru->siteAtomType(0), std::out_of_range);
 }
 void test_empty_instance()
 {
     TS_ASSERT_EQUALS(0, mstru->countSites());
     TS_ASSERT_EQUALS(mstru.get(), mstru->clone().get());
     TS_ASSERT_EQUALS(mstru, emptyStructureAdapter());
     TS_ASSERT_THROWS(mstru->siteAtomType(0), std::out_of_range);
     TS_ASSERT_THROWS(mstru->siteCartesianPosition(0),
                      std::out_of_range);
     TS_ASSERT_THROWS(mstru->siteMultiplicity(0), std::out_of_range);
     TS_ASSERT_THROWS(mstru->siteOccupancy(0), std::out_of_range);
     TS_ASSERT_THROWS(mstru->siteAnisotropy(0), std::out_of_range);
     TS_ASSERT_THROWS(mstru->siteCartesianPosition(0),
                      std::out_of_range);
 }