Skip to content

Added a Linear TS search job adapter#695

Open
alongd wants to merge 50 commits intomainfrom
linear_ts
Open

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

Conversation

@alongd
Copy link
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

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

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.

print(self.rxn_2.ts_species.ts_guesses[0].initial_xyz)
self.assertEqual(self.rxn_2.ts_species.ts_guesses[0].initial_xyz['symbols'],
('C', 'C', 'O', 'N', 'O', 'H', 'H', 'H', 'H', 'H'))
expected_xyz = 1 # todo

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable expected_xyz is not used.

Copilot Autofix

AI 1 day ago

To fix the problem, we should either remove the unused local variable assignment or rename the variable to a name that clearly indicates it is intentionally unused (e.g., _expected_xyz or just _). Because the value 1 is clearly a placeholder tied to a TODO and is not used for any side effects, the most straightforward fix without changing existing functionality is to delete the line defining expected_xyz.

Concretely, in arc/job/adapters/ts/linear_test.py, inside the test_linear_adapter_2 method, remove line 4103:

4103:         expected_xyz = 1  # todo

No additional imports, methods, or definitions are needed. The rest of the test remains unchanged and will continue to validate behavior as before.

Suggested changeset 1
arc/job/adapters/ts/linear_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_test.py b/arc/job/adapters/ts/linear_test.py
--- a/arc/job/adapters/ts/linear_test.py
+++ b/arc/job/adapters/ts/linear_test.py
@@ -4100,7 +4100,6 @@
         self.assertGreater(len(self.rxn_2.ts_species.ts_guesses), 0)
         self.assertEqual(self.rxn_2.ts_species.ts_guesses[0].initial_xyz['symbols'],
                          ('C', 'C', 'O', 'N', 'O', 'H', 'H', 'H', 'H', 'H'))
-        expected_xyz = 1  # todo
 
     def test_get_r_constraints(self):
         """Test the get_r_constraints() function."""
EOF
@@ -4100,7 +4100,6 @@
self.assertGreater(len(self.rxn_2.ts_species.ts_guesses), 0)
self.assertEqual(self.rxn_2.ts_species.ts_guesses[0].initial_xyz['symbols'],
('C', 'C', 'O', 'N', 'O', 'H', 'H', 'H', 'H', 'H'))
expected_xyz = 1 # todo

def test_get_r_constraints(self):
"""Test the get_r_constraints() function."""
Copilot is powered by AI and may make mistakes. Always verify output.
alongd added 9 commits March 22, 2026 10:28
NMD Improvements (arc/checks/ts.py):
- Replaced mean-based displacement baseline with Median + MAD (Median 
  Absolute Deviation) to insulate the check from floppy rotors.
- Implemented a mandatory Directionality Check: ensures formed and broken 
  bonds move in anti-correlated directions along the imaginary mode.
- Separated primary (formed/broken) from secondary (changed-order) bonds 
  in the sigma test to reflect physical displacement scales.
- Set a global numerical noise floor (1e-4 A) for the Hessian and 
  raised the default validation threshold to 3.0 sigma.
IRC Improvements (arc/checks/ts.py):
- Upgraded 'check_irc_species_and_rxn' to use molecular graph 
  isomorphism as the primary validation method.
- Added 'perceive_irc_fragments' using DFS-based connected component 
  detection to handle multi-species reactions (e.g., A + B) reliably.
- Implemented permutation-based matching to verify that the set of 
  perceived IRC fragments matches the expected reaction species.
- Retained distance-matrix bond-list comparison as a robust fallback.
from arc.family.family import get_reaction_family_products
from arc.imports import settings
from arc.species.converter import check_xyz_dict, displace_xyz, xyz_to_dmat
from arc.species.converter import check_isomorphism, check_xyz_dict, displace_xyz, xyz_from_data, xyz_to_dmat

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'displace_xyz' is not used.

Copilot Autofix

AI 2 days ago

To fix an unused import, remove that specific symbol from the import statement while leaving the rest of the imports unchanged. This eliminates the unnecessary dependency and clears the CodeQL warning without impacting behavior.

Concretely, in arc/checks/ts.py, adjust the import on line 22 so that displace_xyz is no longer imported from arc.species.converter. Keep the other imported names (check_isomorphism, check_xyz_dict, xyz_from_data, xyz_to_dmat) intact. No other code changes are required, and no new methods, imports, or definitions are needed.

Suggested changeset 1
arc/checks/ts.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/checks/ts.py b/arc/checks/ts.py
--- a/arc/checks/ts.py
+++ b/arc/checks/ts.py
@@ -19,7 +19,7 @@
                         )
 from arc.family.family import get_reaction_family_products
 from arc.imports import settings
-from arc.species.converter import check_isomorphism, check_xyz_dict, displace_xyz, xyz_from_data, xyz_to_dmat
+from arc.species.converter import check_isomorphism, check_xyz_dict, xyz_from_data, xyz_to_dmat
 from arc.species.perceive import perceive_molecule_from_xyz
 from arc.statmech.factory import statmech_factory
 
EOF
@@ -19,7 +19,7 @@
)
from arc.family.family import get_reaction_family_products
from arc.imports import settings
from arc.species.converter import check_isomorphism, check_xyz_dict, displace_xyz, xyz_from_data, xyz_to_dmat
from arc.species.converter import check_isomorphism, check_xyz_dict, xyz_from_data, xyz_to_dmat
from arc.species.perceive import perceive_molecule_from_xyz
from arc.statmech.factory import statmech_factory

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.

2 participants