Skip to content

Commit 9ea9be5

Browse files
rwestclaude
andcommitted
Fix end-of-run Cantera translation: correct folder name and guard missing annotated files
Coverage-dependence post-processing was still targeting the old 'cantera/' folder; it now correctly targets 'cantera_from_ck/'. Also added os.path.exists() guards around all annotated-file translation calls so that runs configured without verboseComments (which never write chem_annotated.inp) no longer fail when those files are absent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d22558f commit 9ea9be5

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

rmgpy/rmg/main.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,10 +1298,12 @@ def execute(self, initialize=True, **kwargs):
12981298
os.path.join(self.output_directory, "chemkin", "chem-gas.inp"),
12991299
surface_file=(os.path.join(self.output_directory, "chemkin", "chem-surface.inp")),
13001300
)
1301-
self.generate_cantera_files_from_chemkin(
1302-
os.path.join(self.output_directory, "chemkin", "chem_annotated-gas.inp"),
1303-
surface_file=(os.path.join(self.output_directory, "chemkin", "chem_annotated-surface.inp")),
1304-
)
1301+
annotated_gas = os.path.join(self.output_directory, "chemkin", "chem_annotated-gas.inp")
1302+
if os.path.exists(annotated_gas):
1303+
self.generate_cantera_files_from_chemkin(
1304+
annotated_gas,
1305+
surface_file=(os.path.join(self.output_directory, "chemkin", "chem_annotated-surface.inp")),
1306+
)
13051307

13061308
if self.thermo_coverage_dependence:
13071309
# Build coverage_deps: {species_name: string_to_add_to_yaml}
@@ -1325,18 +1327,19 @@ def execute(self, initialize=True, **kwargs):
13251327
break
13261328

13271329
for yaml_path in [
1328-
os.path.join(self.output_directory, "cantera", "chem.yaml"),
1329-
os.path.join(self.output_directory, "cantera", "chem_annotated.yaml"),
1330+
os.path.join(self.output_directory, "cantera_from_ck", "chem.yaml"),
1331+
os.path.join(self.output_directory, "cantera_from_ck", "chem_annotated.yaml"),
13301332
]:
1331-
_add_coverage_dependence_to_cantera_yaml(yaml_path, coverage_deps)
1333+
if os.path.exists(yaml_path):
1334+
_add_coverage_dependence_to_cantera_yaml(yaml_path, coverage_deps)
13321335

13331336
else: # gas phase only
13341337
translated_cantera_file = self.generate_cantera_files_from_chemkin(
13351338
os.path.join(self.output_directory, "chemkin", "chem.inp")
13361339
)
1337-
self.generate_cantera_files_from_chemkin(
1338-
os.path.join(self.output_directory, "chemkin", "chem_annotated.inp")
1339-
)
1340+
annotated = os.path.join(self.output_directory, "chemkin", "chem_annotated.inp")
1341+
if os.path.exists(annotated):
1342+
self.generate_cantera_files_from_chemkin(annotated)
13401343

13411344
# Compare translated Cantera files against directly generated Cantera files
13421345
if translated_cantera_file and self.cantera1_writer_config and self.cantera1_writer_config.enabled:

0 commit comments

Comments
 (0)