9#include <boost/algorithm/string/join.hpp>
10#include <boost/python/class.hpp>
11#include <boost/python/make_constructor.hpp>
12#include <boost/python/register_ptr_to_python.hpp>
20 return std::const_pointer_cast<SpaceGroup>(self.
spaceGroup());
26 std::vector<std::string> scattererStrings;
27 scattererStrings.reserve(scatterers->nScatterers());
29 for (
size_t i = 0; i < scatterers->nScatterers(); ++i) {
33 return scattererStrings;
38 ss <<
"Crystal structure with:\n";
41 const auto cell = self.
cell();
42 ss <<
" a = " << cell.
a();
43 ss <<
" b = " << cell.b();
44 ss <<
" c = " << cell.c();
46 ss <<
" alpha = " << cell.alpha();
47 ss <<
" beta = " << cell.beta();
48 ss <<
" gamma = " << cell.gamma();
52 ss <<
"Centering: " << self.
centering()->getName() <<
"\n";
53 ss <<
"Space Group: " << self.
spaceGroup()->hmSymbol() <<
"\n";
54 ss <<
"Scatterers: " << boost::algorithm::join(getScatterers(self),
", ");
61 ss <<
"CrystalStructure(\"";
63 const auto cell = self.
cell();
65 ss << cell.
a() <<
" ";
66 ss << cell.b() <<
" ";
67 ss << cell.c() <<
" ";
69 ss << cell.alpha() <<
" ";
70 ss << cell.beta() <<
" ";
74 ss <<
"\"" << self.
spaceGroup()->hmSymbol() <<
"\", ";
75 ss <<
"\"" << boost::algorithm::join(getScatterers(self),
"; ") <<
"\"";
84 class_<CrystalStructure>(
"CrystalStructure", no_init)
85 .def(init<const std::string &, const std::string &, const std::string &>(
86 (arg(
"unitCell"), arg(
"spaceGroup"), arg(
"scatterers"))))
88 .def(
"getSpaceGroup", &getSpaceGroup, arg(
"self"))
89 .def(
"getScatterers", &getScatterers, arg(
"self"))
90 .def(
"__str__", &__str__implementation)
91 .def(
"__repr__", &__repr__implementation);
void export_CrystalStructure()
Three components are required to describe a crystal structure:
CompositeBraggScatterer_sptr getScatterers() const
Return a clone of the internal CompositeBraggScatterer instance.
UnitCell cell() const
Returns the unit cell of the structure.
ReflectionCondition_sptr centering() const
SpaceGroup_const_sptr spaceGroup() const
Returns the space group of the crystal structure.
double a(int nd) const
Get lattice parameter a1-a3 as function of index (0-2)
MANTID_GEOMETRY_DLL std::string getIsotropicAtomBraggScattererString(const BraggScatterer_sptr &scatterer)
std::shared_ptr< SpaceGroup > SpaceGroup_sptr