Mantid
Loading...
Searching...
No Matches
PointGroup.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
11
12#include <boost/python/class.hpp>
13#include <boost/python/enum.hpp>
14#include <boost/python/list.hpp>
15#include <boost/python/operators.hpp>
16#include <boost/python/register_ptr_to_python.hpp>
17#include <boost/python/scope.hpp>
18#include <boost/python/self.hpp>
19
22
23using namespace boost::python;
24
26
27namespace //<unnamed>
28{
29using namespace Mantid::PythonInterface;
30
31bool isEquivalent(const PointGroup &self, const object &hkl1, const object &hkl2) {
33}
34
35boost::python::list getEquivalents(const PointGroup &self, const object &hkl) {
36 const auto &equivalents = self.getEquivalents(Converters::PyObjectToV3D(hkl)());
37
38 boost::python::list pythonEquivalents;
39 for (const auto &equivalent : equivalents) {
40 pythonEquivalents.append(equivalent);
41 }
42
43 return pythonEquivalents;
44}
45
46Mantid::Kernel::V3D getReflectionFamily(const PointGroup &self, const object &hkl) {
48}
49
50std::string __repr__implementation(const PointGroup &self) {
51 std::stringstream ss;
52 ss << "PointGroupFactory.createPointGroup(\"";
53 ss << self.getSymbol();
54 ss << "\")";
55 return ss.str();
56}
57} // namespace
58
60 register_ptr_to_python<std::shared_ptr<PointGroup>>();
61
62 scope pointGroupScope = class_<PointGroup, boost::noncopyable>("PointGroup", no_init);
63
64 enum_<PointGroup::CrystalSystem>("CrystalSystem")
65 .value("Triclinic", PointGroup::CrystalSystem::Triclinic)
66 .value("Monoclinic", PointGroup::CrystalSystem::Monoclinic)
67 .value("Orthorhombic", PointGroup::CrystalSystem::Orthorhombic)
68 .value("Tetragonal", PointGroup::CrystalSystem::Tetragonal)
69 .value("Hexagonal", PointGroup::CrystalSystem::Hexagonal)
70 .value("Trigonal", PointGroup::CrystalSystem::Trigonal)
71 .value("Cubic", PointGroup::CrystalSystem::Cubic);
72
73 enum_<PointGroup::LatticeSystem>("LatticeSystem")
74 .value("Triclinic", PointGroup::LatticeSystem::Triclinic)
75 .value("Monoclinic", PointGroup::LatticeSystem::Monoclinic)
76 .value("Orthorhombic", PointGroup::LatticeSystem::Orthorhombic)
77 .value("Tetragonal", PointGroup::LatticeSystem::Tetragonal)
78 .value("Hexagonal", PointGroup::LatticeSystem::Hexagonal)
79 .value("Rhombohedral", PointGroup::LatticeSystem::Rhombohedral)
80 .value("Cubic", PointGroup::LatticeSystem::Cubic);
81
82 class_<PointGroup, boost::noncopyable, bases<Group>>("PointGroup", no_init)
83 .def("getName", &PointGroup::getName, arg("self"))
84 .def("getHMSymbol", &PointGroup::getSymbol, arg("self"))
85 .def("getCrystalSystem", &PointGroup::crystalSystem, arg("self"))
86 .def("getLatticeSystem", &PointGroup::latticeSystem, arg("self"))
87 .def("isEquivalent", &isEquivalent, (arg("self"), arg("hkl1"), arg("hkl2")),
88 "Check whether the two HKLs are symmetrically equivalent.")
89 .def("getEquivalents", &getEquivalents, (arg("self"), arg("hkl")),
90 "Returns an array with all symmetry equivalents of the supplied "
91 "HKL.")
92 .def("getReflectionFamily", &getReflectionFamily, (arg("self"), arg("hkl")),
93 "Returns the same HKL for all symmetry equivalents.")
94 .def(str(self))
95 .def("__repr__", &__repr__implementation);
96}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition: GetPointer.h:17
void export_PointGroup()
Definition: PointGroup.cpp:59
The class Group represents a set of symmetry operations (or symmetry group).
Definition: Group.h:135
A class containing the Point Groups for a crystal.
Definition: PointGroup.h:31
bool isEquivalent(const Kernel::V3D &hkl, const Kernel::V3D &hkl2) const
Return true if the hkls are in same group.
Definition: PointGroup.cpp:77
std::string getSymbol() const
Hermann-Mauguin symbol.
Definition: PointGroup.cpp:75
std::string getName() const
Name of the point group.
Definition: PointGroup.h:39
LatticeSystem latticeSystem() const
Definition: PointGroup.h:44
std::vector< Kernel::V3D > getEquivalents(const Kernel::V3D &hkl) const
Returns a vector with all equivalent hkls.
Definition: PointGroup.cpp:38
CrystalSystem crystalSystem() const
Definition: PointGroup.h:43
Kernel::V3D getReflectionFamily(const Kernel::V3D &hkl) const
Returns the same hkl for all equivalent hkls.
Definition: PointGroup.cpp:61
Class for 3D vectors.
Definition: V3D.h:34
Takes a Python object and if it supports indexing and is of length 3 then it will attempt to convert ...
Definition: PyObjectToV3D.h:22