Skip to content

Commit

Permalink
TNT reciprocal space ASU: it's NOT wrt standard settings
Browse files Browse the repository at this point in the history
unlike CCP4 ASU
  • Loading branch information
wojdyr committed Apr 16, 2024
1 parent e54c556 commit 195f9ac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
11 changes: 7 additions & 4 deletions include/gemmi/symmetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2015,11 +2015,14 @@ struct ReciprocalAsu {
if (sg == nullptr)
fail("Missing space group");
idx = spacegroup_tables::ccp4_hkl_asu[sg->number - 1];
if (tnt)
if (tnt) {
idx += 10;
is_ref = sg->is_reference_setting();
if (!is_ref)
rot = sg->basisop().rot;
is_ref = true; // TNT ASU is given wrt current (not standard) settings
} else {
is_ref = sg->is_reference_setting();
if (!is_ref)
rot = sg->basisop().rot;
}
}

bool is_in(const Op::Miller& hkl) const {
Expand Down
14 changes: 8 additions & 6 deletions prog/sg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ void print_info(const gemmi::SpaceGroup* sg, bool verbose) {
printf("Is enantiomorphic: %s\n", sg->is_enantiomorphic() ? "yes" : "no");
std::array<int, 3> gf = ops.find_grid_factors();
printf("Grid restrictions: NX=%dn NY=%dn NZ=%dn\n", gf[0], gf[1], gf[2]);
for (bool tnt : {false, true})
printf("Reciprocal space ASU (%s)%s: %s%s\n",
tnt ? "TNT" : "CCP4",
is_reference ? "" : " wrt. standard setting",
tnt ? " " : "",
gemmi::ReciprocalAsu(sg, tnt).condition_str());
std::string wrt;
if (!is_reference)
wrt = " wrt. " + gemmi::get_spacegroup_reference_setting(sg->number).xhm();
printf("CCP4 reciprocal space ASU%s: %s\n",
wrt.c_str(),
gemmi::ReciprocalAsu(sg, false).condition_str());
printf("TNT reciprocal space ASU: %s\n",
gemmi::ReciprocalAsu(sg, true).condition_str());
gemmi::AsuBrick brick = gemmi::find_asu_brick(sg);
printf("Direct space ASU brick: %s\n", brick.str().c_str());
print_symmetry_operations(ops);
Expand Down
3 changes: 3 additions & 0 deletions tests/test_symmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ def test_reciprocal_asu_checker(self):
checker = gemmi.ReciprocalAsu(sg)
self.assertTrue(checker.is_in([-5, 5, 1]))
self.assertFalse(checker.is_in([5, 5, -1]))
checker = gemmi.ReciprocalAsu(sg, tnt=True)
self.assertTrue(checker.is_in([5, 5, -1]))
self.assertFalse(checker.is_in([-5, 5, 1]))

def test_reflection_properties(self):
sg = gemmi.SpaceGroup('I 1 2 1')
Expand Down

0 comments on commit 195f9ac

Please sign in to comment.