Skip to content

Commit 81bf5c8

Browse files
Ameyanagijanosh
andauthored
fix on reading multiple route in Gaussian input file (#2939)
* fixed reading multiple route in gaussian input * add test for multiple lines of route * fixed test * code style --------- Co-authored-by: Janosh Riebesell <[email protected]>
1 parent e32b3a2 commit 81bf5c8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pymatgen/io/gaussian.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ def from_string(contents):
313313
# This condition allows for route cards spanning multiple lines
314314
elif (line == "" or line.isspace()) and route_index:
315315
break
316+
if route_index:
317+
route += f" {line}"
318+
route_index = idx
316319
functional, basis_set, route_paras, dieze_tag = read_route_line(route)
317320
ind = 2
318321
title = []

pymatgen/io/tests/test_gaussian.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def test_from_string(self):
127127
gau_str = """%mem=5000000
128128
%chk=filename
129129
# mp2/6-31g* scf=direct
130+
opt freq
130131
131132
SIH4+ H2---SIH2+ CS //MP2(full)/6-31G* MP2=-290.9225259
132133
@@ -149,6 +150,7 @@ def test_from_string(self):
149150

150151
gau = GaussianInput.from_string(gau_str)
151152
assert gau.molecule.composition.reduced_formula == "X3SiH4"
153+
assert set(gau.route_parameters) == {"opt", "freq", "scf"}
152154

153155
def test_gen_basis(self):
154156
gau_str = """#N B3LYP/Gen Pseudo=Read

0 commit comments

Comments
 (0)