Skip to content

Added a Linear TS search job adapter#695

Open
alongd wants to merge 65 commits intomainfrom
linear_ts
Open

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

Conversation

@alongd
Copy link
Copy Markdown
Member

@alongd alongd commented Aug 21, 2023

Added a method for generating TS structures from atom mapped reactants and products.
The method works for unimolecular reactions, and at present is only implemented for isomerization reactions.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 22, 2023

Codecov Report

Attention: Patch coverage is 87.93103% with 35 lines in your changes are missing coverage. Please review.

Project coverage is 73.97%. Comparing base (3631196) to head (cbec920).

Current head cbec920 differs from pull request most recent head 69759f8

Please upload reports for the commit 69759f8 to get more accurate results.

Files Patch % Lines
arc/job/adapters/ts/linear.py 75.63% 18 Missing and 11 partials ⚠️
arc/mapping/engine.py 86.66% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #695      +/-   ##
==========================================
+ Coverage   73.80%   73.97%   +0.17%     
==========================================
  Files          99      101       +2     
  Lines       27352    27596     +244     
  Branches     5718     5746      +28     
==========================================
+ Hits        20187    20415     +228     
- Misses       5738     5745       +7     
- Partials     1427     1436       +9     
Flag Coverage Δ
unittests 73.97% <87.93%> (+0.17%) ⬆️

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.

@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
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.

@alongd alongd force-pushed the linear_ts branch 2 times, most recently from 908773e to 0acc5d4 Compare March 23, 2026 21:26
# The central C of propane has 2 heavy neighbors → not a clear terminal.
sp = ARCSpecies(label='propane', smiles='CCC')
xyz = sp.get_xyz()
symbols = xyz['symbols']

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable symbols is not used.

Copilot Autofix

AI about 15 hours ago

To fix an unused local variable, either remove the assignment if it serves no purpose, or, if it is intentionally unused for documentation or side effects, rename it to something like _ or unused_* while preserving any necessary right-hand side computation. In this specific test, symbols = xyz['symbols'] is not used at all, and computing xyz['symbols'] has no needed side effects, so the best fix is simply to delete this assignment.

Concretely, in arc/job/adapters/ts/linear_utils/local_geometry_test.py, in TestRestoreTerminalHSymmetry.test_skips_non_terminal_centers, remove line 264 that defines symbols. No additional imports or helper methods are required; the rest of the test already operates directly on xyz and sp.mol.

Suggested changeset 1
arc/job/adapters/ts/linear_utils/local_geometry_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/local_geometry_test.py b/arc/job/adapters/ts/linear_utils/local_geometry_test.py
--- a/arc/job/adapters/ts/linear_utils/local_geometry_test.py
+++ b/arc/job/adapters/ts/linear_utils/local_geometry_test.py
@@ -261,7 +261,6 @@
         # The central C of propane has 2 heavy neighbors → not a clear terminal.
         sp = ARCSpecies(label='propane', smiles='CCC')
         xyz = sp.get_xyz()
-        symbols = xyz['symbols']
         # The middle C is the one with 2 C neighbors.
         atom_to_idx = {a: i for i, a in enumerate(sp.mol.atoms)}
         middle_c = None
EOF
@@ -261,7 +261,6 @@
# The central C of propane has 2 heavy neighbors → not a clear terminal.
sp = ARCSpecies(label='propane', smiles='CCC')
xyz = sp.get_xyz()
symbols = xyz['symbols']
# The middle C is the one with 2 C neighbors.
atom_to_idx = {a: i for i, a in enumerate(sp.mol.atoms)}
middle_c = None
Copilot is powered by AI and may make mistakes. Always verify output.
# Place the migrated H so it ends up *closer to a non-acceptor
# carbon* than its acceptor. S5 must catch this.
sp = ARCSpecies(label='ccn', smiles='CCN')
symbols = sp.get_xyz()['symbols']

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable symbols is not used.

Copilot Autofix

AI about 15 hours ago

To fix an unused local variable, either remove the assignment if its value and side effects are unnecessary, or rename it to a conventional unused name (such as _ or unused_symbols) if the evaluation is desired but the variable is not read. Here, the test manually defines pre and post geometries and does not use symbols. The sp instance is already created for clarity, and calling sp.get_xyz() is not used elsewhere. The best minimal change without altering behavior is to keep the method call (in case it has benign side effects) but indicate explicitly that the result is unused by renaming the variable to _ (or similar).

Concretely, in arc/job/adapters/ts/linear_utils/local_geometry_test.py, in TestOrientHAwayFromAxis.test_s5_competing_rival_returns_none, change line 645 from:

symbols = sp.get_xyz()['symbols']

to:

_ = sp.get_xyz()['symbols']

This preserves the evaluation of sp.get_xyz() and the index, while satisfying the CodeQL rule by using a conventional unused-variable name. No new imports or additional methods are needed.

Suggested changeset 1
arc/job/adapters/ts/linear_utils/local_geometry_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/local_geometry_test.py b/arc/job/adapters/ts/linear_utils/local_geometry_test.py
--- a/arc/job/adapters/ts/linear_utils/local_geometry_test.py
+++ b/arc/job/adapters/ts/linear_utils/local_geometry_test.py
@@ -642,7 +642,7 @@
         # Place the migrated H so it ends up *closer to a non-acceptor
         # carbon* than its acceptor.  S5 must catch this.
         sp = ARCSpecies(label='ccn', smiles='CCN')
-        symbols = sp.get_xyz()['symbols']
+        _ = sp.get_xyz()['symbols']
         # We don't actually need a chemically sensible geometry here:
         # just one where the post-migration H lands between two heavy
         # atoms that are *both* in the acceptor fragment, with the
EOF
@@ -642,7 +642,7 @@
# Place the migrated H so it ends up *closer to a non-acceptor
# carbon* than its acceptor. S5 must catch this.
sp = ARCSpecies(label='ccn', smiles='CCN')
symbols = sp.get_xyz()['symbols']
_ = sp.get_xyz()['symbols']
# We don't actually need a chemically sensible geometry here:
# just one where the post-migration H lands between two heavy
# atoms that are *both* in the acceptor fragment, with the
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