57
57
58
58
59
59
class Cohpcar :
60
- """Read COHPCAR/COOPCAR/COBICAR files generated by LOBSTER.
60
+ """Read COXXCAR.lobster/COXXCAR.LCFO.lobster files generated by LOBSTER.
61
61
62
62
Attributes:
63
63
cohp_data (dict[str, Dict[str, Any]]): The COHP data of the form:
@@ -849,7 +849,7 @@ def is_spin_polarized(self) -> bool:
849
849
850
850
851
851
class Charge (MSONable ):
852
- """Read CHARGE files generated by LOBSTER.
852
+ """Read CHARGE.lobster/ CHARGE.LCFO.lobster files generated by LOBSTER.
853
853
854
854
Attributes:
855
855
atomlist (list[str]): List of atoms in CHARGE.lobster.
@@ -988,11 +988,16 @@ class Lobsterout(MSONable):
988
988
"info_lines" ,
989
989
"has_doscar" ,
990
990
"has_doscar_lso" ,
991
+ "has_doscar_lcfo" ,
991
992
"has_cohpcar" ,
993
+ "has_cohpcar_lcfo" ,
992
994
"has_coopcar" ,
995
+ "has_coopcar_lcfo" ,
993
996
"has_cobicar" ,
997
+ "has_cobicar_lcfo" ,
994
998
"has_charge" ,
995
999
"has_madelung" ,
1000
+ "has_mofecar" ,
996
1001
"has_projection" ,
997
1002
"has_bandoverlaps" ,
998
1003
"has_fatbands" ,
@@ -1060,7 +1065,11 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
1060
1065
self .has_doscar_lso = (
1061
1066
"writing DOSCAR.LSO.lobster..." in lines and "SKIPPING writing DOSCAR.LSO.lobster..." not in lines
1062
1067
)
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 :
1064
1073
self .has_cohpcar = (
1065
1074
"writing COOPCAR.lobster and ICOOPLIST.lobster..." in lines
1066
1075
and "SKIPPING writing COOPCAR.lobster and ICOOPLIST.lobster..." not in lines
@@ -1084,6 +1093,10 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
1084
1093
"writing COBICAR.lobster..." in lines and "SKIPPING writing COBICAR.lobster..." not in lines
1085
1094
)
1086
1095
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
1087
1100
self .has_polarization = "writing polarization to POLARIZATION.lobster..." in lines
1088
1101
self .has_charge = "SKIPPING writing CHARGE.lobster..." not in lines
1089
1102
self .has_projection = "saving projection to projectionData.lobster..." in lines
@@ -1097,6 +1110,7 @@ def __init__(self, filename: PathLike | None, **kwargs) -> None:
1097
1110
"writing SitePotentials.lobster and MadelungEnergies.lobster..." in lines
1098
1111
and "skipping writing SitePotentials.lobster and MadelungEnergies.lobster..." not in lines
1099
1112
)
1113
+ self .has_mofecar = "Writing MOFECAR.lobster and IMOFELIST.lobster..." in lines
1100
1114
else :
1101
1115
raise ValueError ("must provide either filename or kwargs to initialize Lobsterout" )
1102
1116
@@ -1119,11 +1133,16 @@ def get_doc(self) -> dict[str, Any]:
1119
1133
"info_lines" : self .info_lines ,
1120
1134
"has_doscar" : self .has_doscar ,
1121
1135
"has_doscar_lso" : self .has_doscar_lso ,
1136
+ "has_doscar_lcfo" : self .has_doscar_lcfo ,
1122
1137
"has_cohpcar" : self .has_cohpcar ,
1138
+ "has_cohpcar_lcfo" : self .has_cohpcar_lcfo ,
1123
1139
"has_coopcar" : self .has_coopcar ,
1140
+ "has_coopcar_lcfo" : self .has_coopcar_lcfo ,
1124
1141
"has_cobicar" : self .has_cobicar ,
1142
+ "has_cobicar_lcfo" : self .has_cobicar_lcfo ,
1125
1143
"has_charge" : self .has_charge ,
1126
1144
"has_madelung" : self .has_madelung ,
1145
+ "has_mofecar" : self .has_mofecar ,
1127
1146
"has_projection" : self .has_projection ,
1128
1147
"has_bandoverlaps" : self .has_bandoverlaps ,
1129
1148
"has_fatbands" : self .has_fatbands ,
@@ -1685,7 +1704,7 @@ def bandoverlapsdict(self) -> dict:
1685
1704
1686
1705
1687
1706
class Grosspop (MSONable ):
1688
- """Read GROSSPOP.lobster files.
1707
+ """Read GROSSPOP.lobster/ GROSSPOP.LCFO.lobster files.
1689
1708
1690
1709
Attributes:
1691
1710
list_dict_grosspop (list[dict[str, str| dict[str, str]]]): List of dictionaries
@@ -2362,7 +2381,7 @@ def __init__(
2362
2381
self .rel_loewdin_pol_vector = {} if rel_loewdin_pol_vector is None else rel_loewdin_pol_vector
2363
2382
2364
2383
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 :
2366
2385
lines = file .read ().split ("\n " )
2367
2386
if len (lines ) == 0 :
2368
2387
raise RuntimeError ("Polarization file contains no data." )
0 commit comments