Source code for ewoksmx.utils.symmetry_utils
import gemmi
[docs]
def get_short_space_group_name(input_sg):
# Lookup the group
sg = gemmi.find_spacegroup_by_name(input_sg)
if not sg:
raise ValueError(f"Unknown space group: {input_sg}")
# Get the standard short name
short_name = sg.short_name()
# FIX: If the user explicitly asked for 'R', and Gemmi returned 'H'
# (or vice versa), respect the user's lattice choice if valid.
if input_sg.startswith("R") and short_name.startswith("H"):
short_name = short_name.replace("H", "R", 1)
elif input_sg.startswith("H") and short_name.startswith("R"):
short_name = short_name.replace("R", "H", 1)
return short_name