From 777155ce15d69492a10dce401c8138e9d7eb6c73 Mon Sep 17 00:00:00 2001 From: "Felipe S. S. Schneider" Date: Mon, 28 Feb 2022 19:50:56 -0300 Subject: [PATCH] Support an `extra_energy_term` flag This makes it possible to adjust energies by hand if needed (i.e., a correction performed by an external program, etc.). --- overreact/io.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/overreact/io.py b/overreact/io.py index 11bd1843..c3a31abf 100644 --- a/overreact/io.py +++ b/overreact/io.py @@ -563,6 +563,13 @@ def parse_compounds(text, path=("",), select=None): # TODO(schneiderfelipe): this workaround still allow unused compounds # to be parsed! This should change in the future. compounds = {name: compounds[name] for name in select} + + # Apply `extra_energy_term`s + for name in compounds: + if "extra_energy_term" in compounds[name]: + # TODO: this assumes that 1. there's a single `extra_energy_term` and 2. `energy` is present + compounds[name]["energy"] += compounds[name]["extra_energy_term"] + return dotdict(compounds)