Skip to content

Commit 56c6e3b

Browse files
committed
Remove unnecessary conditional statements
1 parent 913fd76 commit 56c6e3b

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

dpdata/openmx/omx.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,15 @@ def load_cells(lines):
6969
if "Cell_Vectors=" in line:
7070
part = line.split("Cell_Vectors=")[1]
7171
parts = part.split()
72-
if len(parts) < 9:
73-
raise RuntimeError("Cell_Vectors does not contain enough elements.")
7472
values = list(map(float, parts[:9]))
7573
cell = [values[0:3], values[3:6], values[6:9]]
7674
cells.append(cell)
7775
# Checking SCF converged or not
7876
for token in line.split():
7977
if token.startswith("scf_conv="):
80-
try:
81-
scf_conv = int(token.split("=")[1])
82-
if scf_conv == 0:
83-
warnings.warn("SCF not converged!", stacklevel=2)
84-
except (IndexError, ValueError):
85-
pass
78+
scf_conv = int(token.split("=")[1])
79+
if scf_conv == 0:
80+
warnings.warn("SCF not converged!", stacklevel=2)
8681
cells = np.array(cells)
8782
return cells
8883

0 commit comments

Comments
 (0)