Commit 0b0d170c by Maarten L. Hekkelman

a bit of documentation

parent 1e8e9adf
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
/// \file cif++/symmetry.hpp
/// This file contains code to do symmetry operations based on the
/// operations as specified in the International Tables.
namespace cif namespace cif
{ {
...@@ -265,7 +269,7 @@ class transformation ...@@ -265,7 +269,7 @@ class transformation
transformation &operator=(const transformation &) = default; transformation &operator=(const transformation &) = default;
transformation &operator=(transformation &&) = default; transformation &operator=(transformation &&) = default;
point operator()(const cell &c, const point &pt) const; // point operator()(const cell &c, const point &pt) const;
point operator()(const point &pt) const point operator()(const point &pt) const
{ {
...@@ -275,6 +279,11 @@ class transformation ...@@ -275,6 +279,11 @@ class transformation
friend transformation operator*(const transformation &lhs, const transformation &rhs); friend transformation operator*(const transformation &lhs, const transformation &rhs);
friend transformation inverse(const transformation &t); friend transformation inverse(const transformation &t);
transformation operator-() const
{
return inverse(*this);
}
friend class spacegroup; friend class spacegroup;
private: private:
...@@ -354,12 +363,23 @@ inline transformation fractional(const transformation &t, const cell &c) ...@@ -354,12 +363,23 @@ inline transformation fractional(const transformation &t, const cell &c)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/// @brief Return the symmetry copy of a point based on spacegroup \a sg, cell \a c and symmetry operation \a symop
/// @param pt The point to transform
/// @param sg The spacegroup
/// @param c The cell
/// @param symop The symmetry operation
/// @return Newly calculated point
inline point symmetry_copy(const point &pt, const spacegroup &sg, const cell &c, sym_op symop) inline point symmetry_copy(const point &pt, const spacegroup &sg, const cell &c, sym_op symop)
{ {
return sg(pt, c, symop); return sg(pt, c, symop);
} }
/// @brief Return the point and symmetry operation required to move point \a b as close as possible to point \a a
/// @param sg The spacegroup
/// @param c The cell
/// @param a The point that acts as reference
/// @param b The point that needs to be moved
/// @return The calculated distance between the new point and \a a plus the symmetry operation required to operate on \a b
std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const cell &c, point a, point b); std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const cell &c, point a, point b);
} // namespace cif } // namespace cif
...@@ -85,8 +85,7 @@ sym_op::sym_op(std::string_view s) ...@@ -85,8 +85,7 @@ sym_op::sym_op(std::string_view s)
auto b = s.data(); auto b = s.data();
auto e = b + s.length(); auto e = b + s.length();
int rnri; int rnri = 256; // default to unexisting number
auto r = std::from_chars(b, e, rnri); auto r = std::from_chars(b, e, rnri);
m_nr = rnri; m_nr = rnri;
...@@ -259,12 +258,12 @@ point spacegroup::inverse(const point &pt, const cell &c, sym_op symop) const ...@@ -259,12 +258,12 @@ point spacegroup::inverse(const point &pt, const cell &c, sym_op symop) const
t.m_translation.m_y += symop.m_tb - 5; t.m_translation.m_y += symop.m_tb - 5;
t.m_translation.m_z += symop.m_tc - 5; t.m_translation.m_z += symop.m_tc - 5;
auto it = cif::inverse(t);
auto fpt = fractional(pt, c); auto fpt = fractional(pt, c);
auto o = offsetToOriginFractional(fpt); auto o = offsetToOriginFractional(fpt);
auto it = cif::inverse(t);
auto spt = it(fpt + o) - o; auto spt = it(fpt + o) - o;
return orthogonal(spt, c); return orthogonal(spt, c);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment