Skip to content

Commit 85235dd

Browse files
committed
Prioritize GAV thermo estimates by number of aromatic rings
Group values are often fitted to the most aromatic resonance structure of a molecule. This can cause issues if the thermo value for a less representative structure ends up being lower than that of the aromatic structure, even though it has a more accurate group estimate. This approach ensures more predictable behavior after adding new group values for aromatic species.
1 parent c26c6e4 commit 85235dd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

rmgpy/data/thermo.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,17 +1785,22 @@ def prioritize_thermo(self, species, thermo_data_list):
17851785
if species.molecule[0].is_cyclic():
17861786
# Special treatment for cyclic compounds
17871787
entries = []
1788-
for thermo in thermo_data_list:
1788+
for i, thermo in enumerate(thermo_data_list):
17891789
ring_groups, polycyclic_groups = self.get_ring_groups_from_comments(thermo)
17901790

17911791
# Use rank as a metric for prioritizing thermo.
17921792
# The smaller the rank, the better.
17931793
sum_rank = np.sum(
17941794
[3 if entry.rank is None else entry.rank for entry in ring_groups + polycyclic_groups])
1795-
entries.append((thermo, sum_rank))
17961795

1797-
# Sort first by rank, then by enthalpy at 298 K
1798-
entries = sorted(entries, key=lambda entry: (entry[1], entry[0].get_enthalpy(298.)))
1796+
# Also use number of aromatic rings as a metric, more aromatic rings is better
1797+
# Group values are generally fitted to the most aromatic resonance structure
1798+
num_arom_rings = species.molecule[i].count_aromatic_rings()
1799+
1800+
entries.append((thermo, sum_rank, -num_arom_rings))
1801+
1802+
# Sort first by number of aromatic rings, then rank, then by enthalpy at 298 K
1803+
entries = sorted(entries, key=lambda entry: (entry[2], entry[1], entry[0].get_enthalpy(298.)))
17991804
indices = [thermo_data_list.index(entry[0]) for entry in entries]
18001805
else:
18011806
# For noncyclics, default to original algorithm of ordering thermo based on the most stable enthalpy

0 commit comments

Comments
 (0)