void test_serialization() { StructureAdapterPtr kbise1 = dumpandload(m_kbise); TS_ASSERT_DIFFERS(m_kbise.get(), kbise1.get()); const double eps = 1.0e-7; TS_ASSERT_EQUALS(23, kbise1->countSites()); TS_ASSERT_EQUALS(23.0, kbise1->totalOccupancy()); TS_ASSERT_DELTA(0.0335565, kbise1->numberDensity(), eps); TS_ASSERT_EQUALS(string("K1+"), kbise1->siteAtomType(0)); TS_ASSERT_EQUALS(string("Bi3+"), kbise1->siteAtomType(2)); TS_ASSERT_EQUALS(string("Se"), kbise1->siteAtomType(10)); TS_ASSERT_EQUALS(string("Se"), kbise1->siteAtomType(22)); PeriodicStructureAdapterPtr pkbise = boost::dynamic_pointer_cast<PeriodicStructureAdapter>(m_kbise); PeriodicStructureAdapterPtr pkbise1 = boost::dynamic_pointer_cast<PeriodicStructureAdapter>(kbise1); const Lattice& L = pkbise->getLattice(); const Lattice& L1 = pkbise1->getLattice(); TS_ASSERT_EQUALS(L.a(), L1.a()); TS_ASSERT_EQUALS(L.b(), L1.b()); TS_ASSERT_EQUALS(L.c(), L1.c()); TS_ASSERT_EQUALS(L.alpha(), L1.alpha()); TS_ASSERT_EQUALS(L.beta(), L1.beta()); TS_ASSERT_EQUALS(L.gamma(), L1.gamma()); }
NoMetaStructureAdapter::NoMetaStructureAdapter( StructureAdapterPtr srcstructure) { boost::shared_ptr<NoMetaStructureAdapter> nmptr = boost::dynamic_pointer_cast<NoMetaStructureAdapter>(srcstructure); if (nmptr) srcstructure = nmptr->getSourceStructure(); msrcstructure = srcstructure.get() ? srcstructure : emptyStructureAdapter(); }
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); }