Commit c0dd41ce by Maarten L. Hekkelman

added inverse symmetry operation

parent 4cff92bb
...@@ -314,6 +314,8 @@ class spacegroup : public std::vector<transformation> ...@@ -314,6 +314,8 @@ class spacegroup : public std::vector<transformation>
point operator()(const point &pt, const cell &c, sym_op symop) const; point operator()(const point &pt, const cell &c, sym_op symop) const;
point inverse(const point &pt, const cell &c, sym_op symop) const;
private: private:
int m_nr; int m_nr;
size_t m_index; size_t m_index;
......
...@@ -111,7 +111,7 @@ std::string sym_op::string() const ...@@ -111,7 +111,7 @@ std::string sym_op::string() const
*r.ptr++ = '0' + m_tc; *r.ptr++ = '0' + m_tc;
*r.ptr = 0; *r.ptr = 0;
return { b, r.ptr - b }; return { b, static_cast<size_t>(r.ptr - b) };
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -232,7 +232,31 @@ point spacegroup::operator()(const point &pt, const cell &c, sym_op symop) const ...@@ -232,7 +232,31 @@ point spacegroup::operator()(const point &pt, const cell &c, sym_op symop) const
auto o = offsetToOrigin(c, pt); auto o = offsetToOrigin(c, pt);
transformation tlo(identity_matrix<float>(3), o); transformation tlo(identity_matrix<float>(3), o);
auto itlo = inverse(tlo); auto itlo = cif::inverse(tlo);
point result = pt + o;
result = t_orth(result);
result = itlo(result);
return result;
}
point spacegroup::inverse(const point &pt, const cell &c, sym_op symop) const
{
if (symop.m_nr < 1 or symop.m_nr > size())
throw std::out_of_range("symmetry operator number out of range");
transformation t = at(symop.m_nr - 1);
t.m_translation.m_x += symop.m_ta - 5;
t.m_translation.m_y += symop.m_tb - 5;
t.m_translation.m_z += symop.m_tc - 5;
auto t_orth = cif::inverse(orthogonal(t, c));
auto o = offsetToOrigin(c, pt);
transformation tlo(identity_matrix<float>(3), o);
auto itlo = cif::inverse(tlo);
point result = pt + o; point result = pt + o;
result = t_orth(result); result = t_orth(result);
...@@ -379,6 +403,13 @@ std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const ...@@ -379,6 +403,13 @@ std::tuple<float,point,sym_op> closest_symmetry_copy(const spacegroup &sg, const
float result_d = std::numeric_limits<float>::max(); float result_d = std::numeric_limits<float>::max();
sym_op result_s; sym_op result_s;
auto o = offsetToOrigin(c, a);
transformation tlo(identity_matrix<float>(3), o);
auto itlo = cif::inverse(tlo);
a += o;
b += o;
auto fa = fractional(a, c); auto fa = fractional(a, c);
auto fb = fractional(b, c); auto fb = fractional(b, 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