materialsproject / pymatgen

Python Materials Genomics (pymatgen) is a robust materials analysis code that defines classes for structures and molecules with support for many electronic structure codes. It powers the Materials Project.
https://pymatgen.org
Other
1.52k stars 864 forks source link

ResParser cannot read the res file with spin values #2938

Closed SehunJoo closed 1 year ago

SehunJoo commented 1 year ago

When using the AIRSS code with spin-polarized DFT calculations, the resulting ShelX .res files contain spin values. However, ResParser is unable to read these .res files with spin values.

Error message:

pymatgen.io.res.ParseError: Failed to parse ion entry Li     1 -0.0000000000000  0.2500000000000  0.1118080000000 1.0  -0.01, expected 6 fields.
Example input file ```txt TITL LiMn2O4-Imma-conv -0.0043 287.448784 -3.11129793E+004 0 0 28 (Imma) n - 1 REM REM Run started: Mon, 03 Apr 2023 04:04:50 +0100 in REM CASTEP 21.11| from code version 7d4405a8a+ HEAD Sat Nov 27 13:38:33 2021 +0000 REM Functional PBE for solids (2008) Relativity Koelling-Harmon Dispersion off REM Cut-off 900.0000 eV Grid scale 2.0000 Gmax 46.1085 1/A FBSC none REM MP grid 4 4 3 Offset 0.000 0.000 0.000 No. kpts 8 Spacing 0.05 REM Total runtime: 960.94 s REM Overall efficiency: 81 % REM REM REM ## AIRSS Version 0.9.3 July 2022 commit v0.9.3-15-g857f5392bdb2fb114d REM REM REM COMMAND_LINE REM REM REM O C19 REM O 2|1.1|17|20|23|20:21(qc=8) REM Mn C19 REM Mn 3|1.8|1.8|0.6|12|14|16|30U:40:31:32(qc=7) REM Li C19 REM Li 1|1.0|14|16|18|10U:20(qc=7) REM Mn d: 3.90 REM CELL 1.54180 5.71878 5.76216 8.72311 90.00000 90.00000 90.00000 LATT -1 SFAC Li O Mn Li 1 -0.0000000000000 0.2500000000000 0.1118080000000 1.0 -0.01 Li 1 0.5000000000000 0.7500000000000 0.6118080000000 1.0 -0.01 Li 1 -0.0000000000000 0.7500000000000 -0.1118080000000 1.0 -0.01 Li 1 0.5000000000000 1.2500000000000 0.3881920000000 1.0 -0.01 O 2 -0.0000000000000 0.0291620000000 0.7529840000000 1.0 -0.04 O 2 0.5000000000000 0.5291620000000 1.2529840000000 1.0 -0.04 O 2 -0.0000000000000 0.4708380000000 0.7529840000000 1.0 -0.04 O 2 0.5000000000000 0.9708380000000 1.2529840000000 1.0 -0.04 O 2 -0.0000000000000 0.5291620000000 -0.7529840000000 1.0 -0.04 O 2 0.5000000000000 1.0291620000000 -0.2529840000000 1.0 -0.04 O 2 -0.0000000000000 -0.0291620000000 -0.7529840000000 1.0 -0.04 O 2 0.5000000000000 0.4708380000000 -0.2529840000000 1.0 -0.04 O 2 0.2261230000000 0.2500000000000 0.5282620000000 1.0 -0.17 O 2 0.7261230000000 0.7500000000000 1.0282620000000 1.0 -0.17 O 2 -0.2261230000000 0.2500000000000 0.5282620000000 1.0 -0.17 O 2 0.2738770000000 0.7500000000000 1.0282620000000 1.0 -0.17 O 2 -0.2261230000000 0.7500000000000 -0.5282620000000 1.0 -0.17 O 2 0.2738770000000 1.2500000000000 -0.0282620000000 1.0 -0.17 O 2 0.2261230000000 -0.2500000000000 -0.5282620000000 1.0 -0.17 O 2 0.7261230000000 0.2500000000000 -0.0282620000000 1.0 -0.17 Mn 3 -0.0000000000000 0.0000000000000 0.5000000000000 1.0 4.12 Mn 3 0.5000000000000 0.5000000000000 1.0000000000000 1.0 4.12 Mn 3 -0.0000000000000 0.5000000000000 0.5000000000000 1.0 4.12 Mn 3 0.5000000000000 1.0000000000000 1.0000000000000 1.0 4.12 Mn 3 0.2500000000000 0.2500000000000 0.7500000000000 1.0 3.31 Mn 3 -0.2500000000000 0.2500000000000 0.7500000000000 1.0 3.31 Mn 3 -0.2500000000000 0.7500000000000 -0.7500000000000 1.0 3.31 Mn 3 0.2500000000000 -0.2500000000000 -0.7500000000000 1.0 3.31 END ```
janosh commented 1 year ago

AIRSS IO support was initially added by @ScottNotFound in https://github.com/materialsproject/pymatgen/pull/2625. Maybe he can briefly chime in if this an easy fix or would take some work.

ScottNotFound commented 1 year ago

This is easy to add to the parser, just need to add an extra field and relevant parsing. I can do a fix tomorrow. Is there a standard way to represent spin in the Site class? I see mention of a "magmom" key in the properties, but I didn't know if this was standardized.

janosh commented 1 year ago

That would be great, thanks!

Up and down spins are represented by the Spin class which internally just stores 1 or -1.