Skip to content

Added a Linear TS search job adapter#695

Open
alongd wants to merge 35 commits intomainfrom
linear_ts
Open

Added a Linear TS search job adapter#695
alongd wants to merge 35 commits intomainfrom
linear_ts

Conversation

@alongd
Copy link
Copy Markdown
Member

@alongd alongd commented Aug 21, 2023

Adds a new Linear TS search adapter that builds TS guesses from atom-mapped reactants and products via Z-matrix chimera construction with Hammond-biased weighting. The adapter is incore-only, plugs into ARC's scheduler like heuristics/autotst_ts, and delegates heavy geometry work to a new linear_utils/ subpackage (5 modules). Currently implemented for isomerization/unimolecular reactions.

The PR also carries supporting additions to arc/species/zmat.py (anchors, smart-anchor detection, zmat re-indexing helpers), arc/species/converter.py (atom-map reordering), arc/reaction/reaction.py (is_unimolecular, refined is_isomerization), and a biradical-preservation fix in arc/species/species.py. CI was hardened: pinned action, -n 4 --dist worksteal for stability, and obabel test made self-contained.

Comment thread arc/job/adapters/ts/linear.py Fixed
Comment thread arc/job/adapters/ts/linear.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 22, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.96%. Comparing base (70dab25) to head (e628333).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
+ Coverage   60.43%   61.96%   +1.52%     
==========================================
  Files         102      112      +10     
  Lines       31102    38184    +7082     
  Branches     8104    10010    +1906     
==========================================
+ Hits        18798    23660    +4862     
- Misses       9965    11602    +1637     
- Partials     2339     2922     +583     
Flag Coverage Δ
functionaltests 61.96% <ø> (+1.52%) ⬆️
unittests 61.96% <ø> (+1.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread arc/species/species.py Fixed
Comment thread arc/rmgdb.py Fixed
@alongd alongd force-pushed the linear_ts branch 5 times, most recently from 8825e9f to cbec920 Compare May 15, 2024 07:02
@alongd alongd marked this pull request as ready for review May 15, 2024 09:26
Comment thread arc/job/adapters/ts/linear.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/job/adapters/ts/linear.py Fixed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread arc/job/adapters/ts/linear_test.py Fixed
Comment thread arc/species/zmat.py Fixed
Comment thread arc/species/zmat.py Fixed
Comment thread arc/species/zmat.py Fixed
@alongd alongd force-pushed the linear_ts branch 2 times, most recently from 908773e to 0acc5d4 Compare March 23, 2026 21:26
alongd added 28 commits April 18, 2026 21:50
Also fixed the is_isomerization() method
Also testing the atom_order arg
And updated update_zmat_by_xyz()
added the linear adapter families
So that parallel execution of tests on CI won't run w/o job.execute()
When an ARCSpecies is constructed with both an adjlist (or SMILES) and xyz, mol_from_xyz re-perceives the molecule from the 3D geometry. Previously, perceive_molecule_from_xyz was called with n_radicals=None (the default) even when the existing mol carried radical information. For singlet biradicals this caused the perception to produce a closed-shell molecule with lone pairs instead of radical centers, which then replaced the original mol and broke downstream family detection (e.g.,  Intra_Disproportionation was not identified).

Now, when self.mol already has radical electrons and the user did not explicitly set number_of_radicals, the radical count is derived from self.mol and forwarded to perceive_molecule_from_xyz and is_mol_valid.
To read additional types of RMG-database families
get_entries_label_with_parentheses, TestSplitEntries
both flanking bonds with order >= 2 (cumulated).
"""
i_atom, j_atom = forming_bond
n_atoms = len(mol.atoms)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable n_atoms is not used.

Copilot Autofix

AI about 17 hours ago

General fix: remove unused local assignments unless the right-hand side has side effects; if intentional, rename to an accepted unused-name pattern. Here, len(mol.atoms) has no side effects and the value is not needed, so the best fix is to delete the assignment line.

Best specific fix: in arc/job/adapters/ts/linear_utils/isomerization.py, inside path_has_cumulated_bonds, remove the line n_atoms = len(mol.atoms) and keep all other logic unchanged.

No imports, new methods, or new definitions are needed.

Suggested changeset 1
arc/job/adapters/ts/linear_utils/isomerization.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/arc/job/adapters/ts/linear_utils/isomerization.py b/arc/job/adapters/ts/linear_utils/isomerization.py
--- a/arc/job/adapters/ts/linear_utils/isomerization.py
+++ b/arc/job/adapters/ts/linear_utils/isomerization.py
@@ -235,7 +235,6 @@
         both flanking bonds with order >= 2 (cumulated).
     """
     i_atom, j_atom = forming_bond
-    n_atoms = len(mol.atoms)
 
     # Build adjacency list
     adj = mol_to_adjacency(mol)
EOF
@@ -235,7 +235,6 @@
both flanking bonds with order >= 2 (cumulated).
"""
i_atom, j_atom = forming_bond
n_atoms = len(mol.atoms)

# Build adjacency list
adj = mol_to_adjacency(mol)
Copilot is powered by AI and may make mistakes. Always verify output.
dict: A new XYZ dictionary with the near-attack geometry.
"""
coords = np.array(xyz['coords'], dtype=float)
n_atoms = len(mol.atoms)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable n_atoms is not used.

Copilot Autofix

AI about 17 hours ago

Remove the unused local variable assignment in arc/job/adapters/ts/linear_utils/isomerization.py within get_near_attack_xyz.

  • General approach: when a local variable is never read, delete the assignment unless the right-hand side has side effects.
  • Here, len(mol.atoms) has no side effects, so the whole line can be safely removed without changing behavior.
  • Edit region: around lines 314–317 in get_near_attack_xyz.
  • No imports, helper methods, or new definitions are needed.
Suggested changeset 1
arc/job/adapters/ts/linear_utils/isomerization.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/arc/job/adapters/ts/linear_utils/isomerization.py b/arc/job/adapters/ts/linear_utils/isomerization.py
--- a/arc/job/adapters/ts/linear_utils/isomerization.py
+++ b/arc/job/adapters/ts/linear_utils/isomerization.py
@@ -312,7 +312,6 @@
         dict: A new XYZ dictionary with the near-attack geometry.
     """
     coords = np.array(xyz['coords'], dtype=float)
-    n_atoms = len(mol.atoms)
 
     adj = mol_to_adjacency(mol)
 
EOF
@@ -312,7 +312,6 @@
dict: A new XYZ dictionary with the near-attack geometry.
"""
coords = np.array(xyz['coords'], dtype=float)
n_atoms = len(mol.atoms)

adj = mol_to_adjacency(mol)

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +17 to +41
from arc.job.adapters.ts.linear_utils.postprocess import (
PAULING_DELTA,
build_zmat_with_retry,
has_detached_hydrogen,
_has_h_close_contact,
has_too_many_fragments,
_has_misoriented_migrating_h,
_has_migrating_h_nearer_to_nonreactive,
_has_bad_ts_motif,
has_excessive_backbone_drift,
has_misdirected_migrating_h,
adjust_reactive_bond_distances,
has_broken_nonreactive_bond,
fix_forming_bond_distances,
fix_nonreactive_h_distances,
fix_crowded_h_atoms,
fix_h_nonbonded_clashes,
has_inward_migrating_group_h,
fix_migrating_group_umbrella,
postprocess_generic,
postprocess_ts_guess,
stagger_donor_terminal_h,
postprocess_h_migration,
validate_ts_guess,
)

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'has_inward_migrating_group_h' is not used.
Import of 'postprocess_generic' is not used.

Copilot Autofix

AI about 17 hours ago

Remove the unused symbols from the from arc.job.adapters.ts.linear_utils.postprocess import (...) list in arc/job/adapters/ts/linear_utils/postprocess_test.py.

Best fix (no behavior change):

  • Edit only the import block starting at line 17.
  • Delete has_inward_migrating_group_h and postprocess_generic from that import tuple.
  • Keep all remaining imports as-is and in place.
  • No method/body/test logic changes are required.
Suggested changeset 1
arc/job/adapters/ts/linear_utils/postprocess_test.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/arc/job/adapters/ts/linear_utils/postprocess_test.py b/arc/job/adapters/ts/linear_utils/postprocess_test.py
--- a/arc/job/adapters/ts/linear_utils/postprocess_test.py
+++ b/arc/job/adapters/ts/linear_utils/postprocess_test.py
@@ -31,9 +31,7 @@
     fix_nonreactive_h_distances,
     fix_crowded_h_atoms,
     fix_h_nonbonded_clashes,
-    has_inward_migrating_group_h,
     fix_migrating_group_umbrella,
-    postprocess_generic,
     postprocess_ts_guess,
     stagger_donor_terminal_h,
     postprocess_h_migration,
EOF
@@ -31,9 +31,7 @@
fix_nonreactive_h_distances,
fix_crowded_h_atoms,
fix_h_nonbonded_clashes,
has_inward_migrating_group_h,
fix_migrating_group_umbrella,
postprocess_generic,
postprocess_ts_guess,
stagger_donor_terminal_h,
postprocess_h_migration,
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants