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/copy_const_reference.hpp>
14#include <boost/python/enum.hpp>
15#include <boost/python/list.hpp>
16#include <boost/python/operators.hpp>
17#include <boost/python/register_ptr_to_python.hpp>
18#include <boost/python/scope.hpp>
19#include <boost/python/self.hpp>
20
23
24using namespace boost::python;
25
27
28namespace //<unnamed>
29{
30using namespace Mantid::PythonInterface;
31
32bool isEquivalent(const PointGroup &self, const object &hkl1, const object &hkl2) {
34}
35
36boost::python::list getEquivalents(const PointGroup &self, const object &hkl) {
37 const auto &equivalents = self.getEquivalents(Converters::PyObjectToV3D(hkl)());
38
39 boost::python::list pythonEquivalents;
40 for (const auto &equivalent : equivalents) {
41 pythonEquivalents.append(equivalent);
42 }
43
44 return pythonEquivalents;
45}
46
47Mantid::Kernel::V3D getReflectionFamily(const PointGroup &self, const object &hkl) {
49}
50
51std::string __repr__implementation(const PointGroup &self) {
52 std::stringstream ss;
53 ss << "PointGroupFactory.createPointGroup(\"";
54 ss << self.getSymbol();
55 ss << "\")";
56 return ss.str();
57}
58} // namespace
59
61 register_ptr_to_python<std::shared_ptr<PointGroup>>();
62
63 scope pointGroupScope = class_<PointGroup, boost::noncopyable>("PointGroup", no_init);
64
65 enum_<PointGroup::CrystalSystem>("CrystalSystem")
66 .value("Triclinic", PointGroup::CrystalSystem::Triclinic)
67 .value("Monoclinic", PointGroup::CrystalSystem::Monoclinic)
68 .value("Orthorhombic", PointGroup::CrystalSystem::Orthorhombic)
69 .value("Tetragonal", PointGroup::CrystalSystem::Tetragonal)
70 .value("Hexagonal", PointGroup::CrystalSystem::Hexagonal)
71 .value("Trigonal", PointGroup::CrystalSystem::Trigonal)
72 .value("Cubic", PointGroup::CrystalSystem::Cubic);
73
74 enum_<PointGroup::LatticeSystem>("LatticeSystem")
75 .value("Triclinic", PointGroup::LatticeSystem::Triclinic)
76 .value("Monoclinic", PointGroup::LatticeSystem::Monoclinic)
77 .value("Orthorhombic", PointGroup::LatticeSystem::Orthorhombic)
78 .value("Tetragonal", PointGroup::LatticeSystem::Tetragonal)
79 .value("Hexagonal", PointGroup::LatticeSystem::Hexagonal)
80 .value("Rhombohedral", PointGroup::LatticeSystem::Rhombohedral)
81 .value("Cubic", PointGroup::LatticeSystem::Cubic);
82
83 class_<PointGroup, boost::noncopyable, bases<Group>>("PointGroup", no_init)
84 .def("getName", &PointGroup::getName, arg("self"), return_value_policy<copy_const_reference>())
85 .def("getHMSymbol", &PointGroup::getSymbol, arg("self"), return_value_policy<copy_const_reference>())
86 .def("getCrystalSystem", &PointGroup::crystalSystem, arg("self"))
87 .def("getLatticeSystem", &PointGroup::latticeSystem, arg("self"))
88 .def("isEquivalent", &isEquivalent, (arg("self"), arg("hkl1"), arg("hkl2")),
89 "Check whether the two HKLs are symmetrically equivalent.")
90 .def("getEquivalents", &getEquivalents, (arg("self"), arg("hkl")),
91 "Returns an array with all symmetry equivalents of the supplied "
92 "HKL.")
93 .def("getLauePointGroupSymbol", &PointGroup::getLauePointGroupSymbol, arg("self"))
94 .def("getReflectionFamily", &getReflectionFamily, (arg("self"), arg("hkl")),
95 "Returns the same HKL for all symmetry equivalents.")
96 .def(str(self))
97 .def("__repr__", &__repr__implementation);
98}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition GetPointer.h:17
void export_PointGroup()
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.
const std::string & getName() const
Name of the point group.
Definition PointGroup.h:39
const std::string & getSymbol() const
Hermann-Mauguin symbol.
LatticeSystem latticeSystem() const
Definition PointGroup.h:44
std::vector< Kernel::V3D > getEquivalents(const Kernel::V3D &hkl) const
Returns a vector with all equivalent hkls.
std::string getLauePointGroupSymbol() const
CrystalSystem crystalSystem() const
Definition PointGroup.h:43
Kernel::V3D getReflectionFamily(const Kernel::V3D &hkl) const
Returns the same hkl for all equivalent hkls.
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 ...