From eb7762c7815348d2039fb8c57b8512ce10060ef8 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Mon, 25 Nov 2024 15:17:48 +0800 Subject: [PATCH 1/2] change boolean default --- src/pymatgen/io/vasp/outputs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pymatgen/io/vasp/outputs.py b/src/pymatgen/io/vasp/outputs.py index 14b116ffcbf..8df1d77ac98 100644 --- a/src/pymatgen/io/vasp/outputs.py +++ b/src/pymatgen/io/vasp/outputs.py @@ -2177,11 +2177,11 @@ def __init__(self, filename: PathLike) -> None: # Check if calculation is spin polarized self.read_pattern({"spin": r"ISPIN\s*=\s*2"}) - self.spin = bool(self.data.get("spin", [])) + self.spin = bool(self.data.get("spin", False)) # Check if calculation is non-collinear self.read_pattern({"noncollinear": r"LNONCOLLINEAR\s*=\s*T"}) - self.noncollinear = bool(self.data.get("noncollinear", [])) + self.noncollinear = bool(self.data.get("noncollinear", False)) # Check if the calculation type is DFPT self.read_pattern( From 5e9a640bd5686004fac9e3fc127cca21101a43d0 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Mon, 25 Nov 2024 15:19:32 +0800 Subject: [PATCH 2/2] tiny enhancement of type --- src/pymatgen/io/vasp/outputs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pymatgen/io/vasp/outputs.py b/src/pymatgen/io/vasp/outputs.py index 8df1d77ac98..52caca4db97 100644 --- a/src/pymatgen/io/vasp/outputs.py +++ b/src/pymatgen/io/vasp/outputs.py @@ -2134,7 +2134,7 @@ def __init__(self, filename: PathLike) -> None: self.final_energy = e0 self.final_energy_wo_entrp = e_wo_entrp self.final_fr_energy = e_fr_energy - self.data: dict = {} + self.data: dict[str, Any] = {} # Read "total number of plane waves", NPLWV: self.read_pattern( @@ -2197,7 +2197,7 @@ def __init__(self, filename: PathLike) -> None: # Check if LEPSILON is True and read piezo data if so self.read_pattern({"epsilon": r"LEPSILON\s*=\s*T"}) - if self.data.get("epsilon", []): + if self.data.get("epsilon", False): self.lepsilon = True self.read_lepsilon() # Only read ionic contribution if DFPT is turned on @@ -2208,7 +2208,7 @@ def __init__(self, filename: PathLike) -> None: # Check if LCALCPOL is True and read polarization data if so self.read_pattern({"calcpol": r"LCALCPOL\s*=\s*T"}) - if self.data.get("calcpol", []): + if self.data.get("calcpol", False): self.lcalcpol = True self.read_lcalcpol() self.read_pseudo_zval() @@ -2220,7 +2220,7 @@ def __init__(self, filename: PathLike) -> None: self.ngf = None self.sampling_radii: list[float] | None = None self.read_pattern({"electrostatic": r"average \(electrostatic\) potential at core"}) - if self.data.get("electrostatic", []): + if self.data.get("electrostatic", False): self.read_electrostatic_potential() self.read_pattern({"nmr_cs": r"LCHIMAG\s*=\s*(T)"})