Skip to content

Commit

Permalink
Merge pull request #2643 from sevyharris/readchemkin_robust_transthermo
Browse files Browse the repository at this point in the history
Make chemkin read of transport and thermo files more robust
  • Loading branch information
JacksonBurns authored Apr 1, 2024
2 parents eed950a + 8cac4c7 commit 3bc2964
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rmgpy/chemkin.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def load_transport_file(path, species_dict, skip_missing_species=False):
continue
species = species_dict[label]
species.transport_data = TransportData(
shapeIndex=int(data[0]),
shapeIndex=int(float(data[0])),
sigma=(float(data[2]), 'angstrom'),
epsilon=(float(data[1]), 'K'),
dipoleMoment=(float(data[3]), 'De'),
Expand Down Expand Up @@ -1035,15 +1035,16 @@ def load_chemkin_file(path, dictionary_path=None, transport_path=None, read_comm
# Read in the thermo data from the thermo file
if thermo_path:
with open(thermo_path, 'r') as f:
line0 = f.readline()
line0 = None
while line0 != '':
line = remove_comment_from_line(line0)[0]
line = line.strip()
previous_line = f.tell()
line0 = f.readline()
line = remove_comment_from_line(line0)[0].strip()
if 'THERM' in line.upper():
f.seek(-len(line0), 1)
f.seek(previous_line)
read_thermo_block(f, species_dict)
break
line0 = f.readline()

# Index the reactions now to have identical numbering as in Chemkin
index = 0
for reaction in reaction_list:
Expand Down

0 comments on commit 3bc2964

Please sign in to comment.