Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymatgen yields different spacegroup number to symbol map #83

Open
janosh opened this issue Mar 1, 2025 · 1 comment
Open

pymatgen yields different spacegroup number to symbol map #83

janosh opened this issue Mar 1, 2025 · 1 comment

Comments

@janosh
Copy link
Contributor

janosh commented Mar 1, 2025

@lan496 this should maybe be a pymatgen issue rather than a moyo issue but wanted to hear your opinion first.

after #80, i compared the maps from international number to HM short symbol you get from pymatgen and moyopy, expecting them to be identical but actually they differ for the monoclinic spacegroups. looks like pymatgen returns the full Hermann–Mauguin symbol for 3-15 and HM short else. not sure if this is by design and if so, why.

from pymatgen.symmetry.groups import SpaceGroup
from moyopy import SpaceGroupType

pmg_spg_map = {
    number: SpaceGroup.from_int_number(number).symbol for number in range(1, 230 + 1)
}
moyo_spg_map = {
    # SpaceGroupType(number).hm_short is separated by a space like "F m -3 m"
    number: SpaceGroupType(number).hm_short.replace(" ", "")
    for number in range(1, 230 + 1)
}

for k in pmg_spg_map:
    if pmg_spg_map[k] != moyo_spg_map[k]:
        print(k, pmg_spg_map[k], moyo_spg_map[k])

# this prints
3 P121 P2
4 P12_11 P2_1
5 C121 C2
6 P1m1 Pm
7 P1c1 Pc
8 C1m1 Cm
9 C1c1 Cc
10 P12/m1 P2/m
11 P12_1/m1 P2_1/m
12 C12/m1 C2/m
13 P12/c1 P2/c
14 P12_1/c1 P2_1/c
15 C12/c1 C2/c
@lan496
Copy link
Member

lan496 commented Mar 2, 2025

Thanks for sharing. https://pymatgen.org/pymatgen.symmetry.html#pymatgen.symmetry.groups.SpaceGroup.symbol says SpaceGroup.symbol returns a full HM symbol. But, I've checked SpaceGroup('Pmmm').symbol gives Pmmm, which is short HM symbol (full HM symbol for No.47, "P 2/m 2/m 2/m").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants