You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I encountered an issue when using pymatgen's CifParser to parse a .cif file. Specifically, I noticed that the fractional coordinates of some atoms (X and Y) parsed by CifParser do not match the original fractional coordinates in the CIF file. Below are the details of my observation.
Here is the content of the c2db-2832-WSe2-_shixc2db-2696-MoS2-_shi_1.cif file I am using:
W W0 1 0.66666667 0.33333333 0.31812705 1
Se Se1 1 0.33333333 0.66666667 0.26186394 1
Se Se2 1 0.33333333 0.66666667 0.37439016 1
Mo Mo3 1 1.00000000 1.00000000 0.55060730 1
S S4 1 0.66666666 1.33333334 0.49811805 1
S S5 1 0.66666666 1.33333334 0.60309655 1
Here is the code I used to parse the CIF file:
from pymatgen.io.cif import CifParser
for site in structure.sites:
specie = site.specie
original_frac_coords = site._frac_coords
print(f"{specie}: {original_frac_coords}")
The output from the code is as follows:
Mo: [0.33333334 0.66666667 0.5506073 ]
W: [0.66666667 0.33333333 0.31812705]
Se: [0.33333333 0.66666667 0.26186394]
Se: [0.33333333 0.66666667 0.37439016]
S: [0. 0. 0.49811805]
S: [0. 0. 0.60309655]
The Z coordinates for all atoms are correct.
The X and Y coordinates for W and Se atoms match the values in the CIF file, but the X and Y coordinates for Mo and S atoms are incorrect:
Mo's original fractional coordinates in the CIF file are [1.00000000, 1.00000000, 0.55060730], but CifParser outputs [0.33333334, 0.66666667, 0.55060730].
S's original fractional coordinates in the CIF file are [0.66666666, 1.33333334, 0.49811805], but CifParser outputs [0.0, 0.0, 0.49811805].
Expected Behavior
Why does CifParser parse some fractional coordinates (X and Y) as values that do not match the original CIF file?
Is there a way to avoid this normalization or mapping behavior and directly retrieve the fractional coordinates as they are in the CIF file?
Any clarification or guidance on this behavior would be greatly appreciated. Thank you!
Minimal example
No response
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered:
Python version
Python 3.9.21
Pymatgen version
2024.8.9
Operating system version
CentOS 7.9
Current behavior
Hello, I encountered an issue when using pymatgen's CifParser to parse a .cif file. Specifically, I noticed that the fractional coordinates of some atoms (X and Y) parsed by CifParser do not match the original fractional coordinates in the CIF file. Below are the details of my observation.
Here is the content of the c2db-2832-WSe2-_shixc2db-2696-MoS2-_shi_1.cif file I am using:
W W0 1 0.66666667 0.33333333 0.31812705 1
Se Se1 1 0.33333333 0.66666667 0.26186394 1
Se Se2 1 0.33333333 0.66666667 0.37439016 1
Mo Mo3 1 1.00000000 1.00000000 0.55060730 1
S S4 1 0.66666666 1.33333334 0.49811805 1
S S5 1 0.66666666 1.33333334 0.60309655 1
Here is the code I used to parse the CIF file:
from pymatgen.io.cif import CifParser
cif_file = "c2db-2832-WSe2-_shixc2db-2696-MoS2-_shi_1.cif "
parser = CifParser(cif_file)
structure = parser.get_structures(primitive=False)[0]
for site in structure.sites:
specie = site.specie
original_frac_coords = site._frac_coords
print(f"{specie}: {original_frac_coords}")
The output from the code is as follows:
Mo: [0.33333334 0.66666667 0.5506073 ]
W: [0.66666667 0.33333333 0.31812705]
Se: [0.33333333 0.66666667 0.26186394]
Se: [0.33333333 0.66666667 0.37439016]
S: [0. 0. 0.49811805]
S: [0. 0. 0.60309655]
The Z coordinates for all atoms are correct.
The X and Y coordinates for W and Se atoms match the values in the CIF file, but the X and Y coordinates for Mo and S atoms are incorrect:
Mo's original fractional coordinates in the CIF file are [1.00000000, 1.00000000, 0.55060730], but CifParser outputs [0.33333334, 0.66666667, 0.55060730].
S's original fractional coordinates in the CIF file are [0.66666666, 1.33333334, 0.49811805], but CifParser outputs [0.0, 0.0, 0.49811805].
Expected Behavior
Why does CifParser parse some fractional coordinates (X and Y) as values that do not match the original CIF file?
Is there a way to avoid this normalization or mapping behavior and directly retrieve the fractional coordinates as they are in the CIF file?
Any clarification or guidance on this behavior would be greatly appreciated. Thank you!
Minimal example
No response
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: