pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

[Bug]: Inconsistent behaviour with `get_symmetrized_structure`

Open kavanase opened this issue 1 year ago • 4 comments

Email (Optional)

[email protected]

Version

v2023.9.2

Which OS(es) are you using?

  • [X] MacOS
  • [ ] Windows
  • [ ] Linux

What happened?

When using SpacegroupAnalyzer.get_symmetrized_structure(), I noticed some odd behavior. If the input structure is a non-diagonal supercell of the primitive structure, the space group symmetry of the material is correctly determined (and returns the correct primitive structure), but the SymmetrizedStructure differs from that obtained when inputting the primitive structure. In the example case below, this now outputs additional 'inequivalent' sites, which are in fact equivalent in the primitive structure. I've witnessed this now in a couple of different material systems, with non-diagonal supercells.

I'm not sure if this is the desired behaviour, but I wouldn't have guessed so. Notebook and PDF attached below.

pymatgen_symm_structure_PR.pdf

pymatgen_symm_structure_PR.ipynb.zip

Code snippet

No response

Log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

kavanase avatar Sep 18 '23 11:09 kavanase

Hi @kavanase! It seems that your supercell is quite large and if you are saving it as a POSCAR with default settings you may be running into numerical precision issues. I suggest you look into either (1) increasing export accuracy or (2) playing with the SpacegroupAnalyzer's symprec parameter, to allow for larger basis distortions from ideal positions. Good luck!

amkrajewski avatar Nov 09 '23 00:11 amkrajewski

It might also be worth talking to the developers of spglib if it might seem like a legitimate bug in symmetry determination, rather than a precision issue (of course, they would need a minimal reproducible example using spglib directly rather than pymatgen—the easiest way to do this is typically to add a print statement before the spglib call inside pymatgen to see the exact values passed to spglib).

For symmetry issues, it’s also worth trying some different versions of spglib just in case there’s been a regression etc.

mkhorton avatar Nov 09 '23 00:11 mkhorton

As spglib developer side, I think it may be possible that spglib returns another space group for a supercell than that for the primitive structure. Spglib only returns rotation matrices with integers. So if the supercell matrix breaks the symmetry, corresponding result may change. I am also wondering what space group types does spglib return for this issue's structure.

lan496 avatar Nov 09 '23 11:11 lan496