Skip to content

Commit 1840cb5

Browse files
committed
gzipped test files and added pending tests
1 parent aa3f1ce commit 1840cb5

26 files changed

+120
-5381
lines changed

src/pymatgen/io/lobster/outputs.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858

5959
class Cohpcar:
60-
"""Read COHPCAR/COOPCAR/COBICAR files generated by LOBSTER.
60+
"""Read COXXCAR.lobster/COXXCAR.LCFO.lobster files generated by LOBSTER.
6161
6262
Attributes:
6363
cohp_data (dict[str, Dict[str, Any]]): The COHP data of the form:
@@ -849,7 +849,7 @@ def is_spin_polarized(self) -> bool:
849849

850850

851851
class Charge(MSONable):
852-
"""Read CHARGE files generated by LOBSTER.
852+
"""Read CHARGE.lobster/ CHARGE.LCFO.lobster files generated by LOBSTER.
853853
854854
Attributes:
855855
atomlist (list[str]): List of atoms in CHARGE.lobster.
@@ -988,11 +988,16 @@ class Lobsterout(MSONable):
988988
"info_lines",
989989
"has_doscar",
990990
"has_doscar_lso",
991+
"has_doscar_lcfo",
991992
"has_cohpcar",
993+
"has_cohpcar_lcfo",
992994
"has_coopcar",
995+
"has_coopcar_lcfo",
993996
"has_cobicar",
997+
"has_cobicar_lcfo",
994998
"has_charge",
995999
"has_madelung",
1000+
"has_mofecar",
9961001
"has_projection",
9971002
"has_bandoverlaps",
9981003
"has_fatbands",
@@ -1060,7 +1065,11 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
10601065
self.has_doscar_lso = (
10611066
"writing DOSCAR.LSO.lobster..." in lines and "SKIPPING writing DOSCAR.LSO.lobster..." not in lines
10621067
)
1063-
if "5.1" not in self.lobster_version:
1068+
try:
1069+
version_number = float(".".join(self.lobster_version.strip("v").split(".")[:2]))
1070+
except ValueError:
1071+
version_number = 0.0
1072+
if version_number < 5.1:
10641073
self.has_cohpcar = (
10651074
"writing COOPCAR.lobster and ICOOPLIST.lobster..." in lines
10661075
and "SKIPPING writing COOPCAR.lobster and ICOOPLIST.lobster..." not in lines
@@ -1084,6 +1093,10 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
10841093
"writing COBICAR.lobster..." in lines and "SKIPPING writing COBICAR.lobster..." not in lines
10851094
)
10861095

1096+
self.has_cobicar_lcfo = "writing COBICAR.LCFO.lobster..." in lines
1097+
self.has_cohpcar_lcfo = "writing COHPCAR.LCFO.lobster..." in lines
1098+
self.has_coopcar_lcfo = "writing COOPCAR.LCFO.lobster..." in lines
1099+
self.has_doscar_lcfo = "writing DOSCAR.LCFO.lobster..." in lines
10871100
self.has_polarization = "writing polarization to POLARIZATION.lobster..." in lines
10881101
self.has_charge = "SKIPPING writing CHARGE.lobster..." not in lines
10891102
self.has_projection = "saving projection to projectionData.lobster..." in lines
@@ -1097,6 +1110,7 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
10971110
"writing SitePotentials.lobster and MadelungEnergies.lobster..." in lines
10981111
and "skipping writing SitePotentials.lobster and MadelungEnergies.lobster..." not in lines
10991112
)
1113+
self.has_mofecar = "Writing MOFECAR.lobster and IMOFELIST.lobster..." in lines
11001114
else:
11011115
raise ValueError("must provide either filename or kwargs to initialize Lobsterout")
11021116

@@ -1119,11 +1133,16 @@ def get_doc(self) -> dict[str, Any]:
11191133
"info_lines": self.info_lines,
11201134
"has_doscar": self.has_doscar,
11211135
"has_doscar_lso": self.has_doscar_lso,
1136+
"has_doscar_lcfo": self.has_doscar_lcfo,
11221137
"has_cohpcar": self.has_cohpcar,
1138+
"has_cohpcar_lcfo": self.has_cohpcar_lcfo,
11231139
"has_coopcar": self.has_coopcar,
1140+
"has_coopcar_lcfo": self.has_coopcar_lcfo,
11241141
"has_cobicar": self.has_cobicar,
1142+
"has_cobicar_lcfo": self.has_cobicar_lcfo,
11251143
"has_charge": self.has_charge,
11261144
"has_madelung": self.has_madelung,
1145+
"has_mofecar": self.has_mofecar,
11271146
"has_projection": self.has_projection,
11281147
"has_bandoverlaps": self.has_bandoverlaps,
11291148
"has_fatbands": self.has_fatbands,
@@ -1685,7 +1704,7 @@ def bandoverlapsdict(self) -> dict:
16851704

16861705

16871706
class Grosspop(MSONable):
1688-
"""Read GROSSPOP.lobster files.
1707+
"""Read GROSSPOP.lobster/ GROSSPOP.LCFO.lobster files.
16891708
16901709
Attributes:
16911710
list_dict_grosspop (list[dict[str, str| dict[str, str]]]): List of dictionaries
@@ -2362,7 +2381,7 @@ def __init__(
23622381
self.rel_loewdin_pol_vector = {} if rel_loewdin_pol_vector is None else rel_loewdin_pol_vector
23632382

23642383
if not self.rel_loewdin_pol_vector and not self.rel_mulliken_pol_vector:
2365-
with zopen(filename, mode="r", encoding="utf-8") as file:
2384+
with zopen(filename, mode="rt", encoding="utf-8") as file:
23662385
lines = file.read().split("\n")
23672386
if len(lines) == 0:
23682387
raise RuntimeError("Polarization file contains no data.")

tests/files/electronic_structure/cohp/BWDF.lobster.AlN

Lines changed: 0 additions & 202 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)