pymatgen
pymatgen copied to clipboard
Issue with Structure.from_spacegroup
Description
I'm trying to reproduce the structure of LLZO on materials project using pymatgen.core.Structure.from_spacegroup() and it looks like the La wychoff coordinates give the incorrect multiplicity. I'm getting a structure with 208 atoms instead of 192, where the extra 16 atoms are La.
Repro
struc = Structure.from_spacegroup(
spacegroup=142,
lattice={"a": 13.236, "c": 12.7},
symbols=["Li", "La", "Zr", "La", "Li", "Li", "O", "O", "O"],
basis=[
[1 / 2, 0, 3 / 4],
[1 / 2, 0, 0],
[3 / 4, 0.62737, 3 / 8],
[3 / 4, 1 / 2, 5 / 8],
[0.681211, 0.181211, 0],
[0.337534, 0.080516, 0.319143],
[0.805483, 0.465384, 0.471296],
[0.102443, 0.054963, 0.590667],
[0.776773, 0.650823, 0.178764],
],
)
Provide any example files that are needed to reproduce the error, especially if the bug pertains to parsing a file. If the file format is not supported by GitHub, zip it into an archive and upload that.
Expected behavior
Return a structure with 192 atoms
Environment
Relevant versions and platform info:
- OS: Linux
- Version: v2023.3.23
your code does not even work because there is no arg called spacegroup in the from_spacegroup method. There is also no arg called symbols. While I definitely know how to fix this myself, I think it is generally a good practice to provide actual working code to minimize the load on developers when you are asking for help. Pls provide a proper working code and we will debug.
Sorry for the typos. Here is a working code.
from pymatgen.core import Lattice, Structure
lattice_params = [13.236, 13.236, 12.7, 90, 90, 90]
lattice = Lattice.from_parameters(*lattice_params)
struct = Structure.from_spacegroup(
sg=142,
lattice=lattice,
species=["Li", "La", "Zr", "La", "Li", "Li", "O", "O", "O"],
coords=[
[1 / 2, 0, 3 / 4],
[1 / 2, 0, 0],
[3 / 4, 0.62737, 3 / 8],
[3 / 4, 1 / 2, 5 / 8],
[0.681211, 0.181211, 0],
[0.337534, 0.080516, 0.319143],
[0.805483, 0.465384, 0.471296],
[0.102443, 0.054963, 0.590667],
[0.776773, 0.650823, 0.178764],
],
)
This might be a symprec issue. You could try passing different tol values to Structure.from_spacegroup().
Thanks for the suggestion. I tried tol values from 1e-1 to 1e-10 and still got 208 atoms.
When I visualize just the La atoms, I get quite different structures between the Materials Project structure and the Pymatgen structure. It seems like the wychoff coordinate in Materials Project may not be correct, which is causing the incorrect symmetry reduction.
Pymatgen La structure
Material Project La structure.
from pymatgen.ext.matproj import MPRester
MPRester().summary.search(material_ids=["mp-942733"])[0].symmetry
>>> SymmetryData(crystal_system=<CrystalSystem.tet: 'Tetragonal'>, symbol='I4_1/acd', number=142, point_group='4/mmm', symprec=0.1, version='1.16.2')
You might need to install spglib==1.16.2.
Thanks for the suggestion. I rolled back my spglib version to 1.16.2, but am still getting the wrong symmetry operations even with tol=0.1.
The issue seems to be with identifying the symmetry of the state. If I just look at the La sublattice, I can find that the as created structure has all the atoms as the structure of materials project, but the 16 additional sites create linear patterns in the structure. It seems like it is mistakenly being assigned to a 32g Wychoff position instead of 16e. I've tried going through the source code but it doesn't seem to assign any atoms to a wychoff position. Instead all the symmetry operations are applied to the basis atoms using the symmetry operations of the spacegroup. I tried comparing the symmetry operations to an online table , but can't seem to understand where they come from besides that they are tabulated in symm_ops.json.
Thank you for helping me to figure this out.
La sublattice from pymatgen with 16e basis atom identified
La sublattice from Materials Project with 16e basis atom identified