Skip to content

Commit

Permalink
Fix: Structureless Reaction objects with dummies
Browse files Browse the repository at this point in the history
For handling old reaction objects without structures
  • Loading branch information
avcopan committed Jun 17, 2024
1 parent 0824174 commit eb13916
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions automol/graph/_2conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
explicit,
geometry_correct_linear_vinyls,
geometry_dihedrals_near_value,
has_dummy_atoms,
has_stereo,
inchi_is_bad,
is_ts_graph,
Expand Down Expand Up @@ -451,6 +452,10 @@ def ts_geometry_from_reactants(
:return: TS geometry
:rtype: automol geom data structure
"""
assert not has_dummy_atoms(
tsg
), f"Cannot convert graph->geom with dummy atoms:\n{tsg}\n{rct_geos}"

# 0. Join geometries for bimolecular reactions, yielding a single starting structure
ts_geo = ts_join_reactant_geometries(tsg, rct_geos, geo_idx_dct=geo_idx_dct)

Expand Down
6 changes: 6 additions & 0 deletions automol/reac/_4struc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
apply_zmatrix_conversion,
mapping,
product_graphs,
without_dummy_atoms,
product_structures,
products_conversion_info,
reactant_graphs,
Expand Down Expand Up @@ -68,6 +69,11 @@ def with_structures(
if struc_typ not in ("geom", "zmat", None):
raise ValueError(f"Requesting invalid structure type {struc_typ}")

# If there are no current structures, remove dummy atoms from the graph to avoid
# problems
if orig_struc_typ is None:
rxn = without_dummy_atoms(rxn)

# If a structure type of `None` was requested, simply update with the structures
# passed in
if struc_typ is None:
Expand Down

0 comments on commit eb13916

Please sign in to comment.