-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: allow mutiple scissions in the atom mapping process. #701
Conversation
b53bddc
to
6c00023
Compare
Codecov Report
@@ Coverage Diff @@
## main #701 +/- ##
==========================================
- Coverage 73.30% 73.29% -0.01%
==========================================
Files 99 99
Lines 26609 26557 -52
Branches 5563 5537 -26
==========================================
- Hits 19506 19466 -40
+ Misses 5759 5744 -15
- Partials 1344 1347 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
d5e4ca0
to
c8cc061
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Please see some comments
Can you relocate the added tests to right after the respective commit that added the function being tested? This way it is easier to review a function and its related tests and see the relevance of the new tests
arc/reaction_test.py
Outdated
@@ -35,7 +36,15 @@ def setUpClass(cls): | |||
""" | |||
cls.maxDiff = None | |||
cls.rmgdb = rmgdb.make_rmg_database_object() | |||
rmgdb.load_families_only(cls.rmgdb) | |||
cls.rmgdb.load(path=rmg_settings['database.directory'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try to load through ARC's rmgdb module, so we guarantee that during an actual run ARC's also able to load all families, not only during the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue with that correctly. Looking for replays on that issue so I could proceed with fixing it. This is a temporary patch.
arc/reaction_test.py
Outdated
@@ -1654,6 +1654,23 @@ def test_get_atom_map(self): | |||
self.assertIn(atom_map[int(atom.label)], c_symmetry_h_2 if atom.symbol == "C" else h_symmetry2) | |||
self.assertTrue(check_atom_map(rxn=rxn)) | |||
|
|||
# XY_elimination_hydroxyl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have another PR that organizes these tests. We should separate this large test into smaller unit tests, so we know which ones fail, and we can run them individually when debugging.
Please put this added test in a new unit test function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you point me to the PR?
Also, we should think about performing some of these randomly, they are getting out of hand in terms of computation time..
arc/mapping/engine_test.py
Outdated
spc = ARCSpecies(label="ethane", smiles="CC") | ||
label_species_atoms([spc]) | ||
self.assertTrue(determine_bdes_indices_based_on_atom_labels(spc, (1, 2))) | ||
self.assertFalse(determine_bdes_indices_based_on_atom_labels(spc, (2, 3))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this line a dependent test? if the above is True, then this line must be false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If (starting from 1, due to bde convention) atom number 3 (hydrogen atom) was connected to atom number 2 (the second carbon atom) then this would have been true.
species += [H1, H2] | ||
else: | ||
try: | ||
species += candidate.scissors() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docsting says we return the species after scission, but looks like we add it to the species list, and the original species is also returned (also above when treating H2). Is this on purpose? If so, need to update the docstring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The species are returned after all required scissoring is done. If none were requested, then no scissoring are done. It does return them after scission, so I do not understand the confusion.
f6807cb
to
bcec4f0
Compare
07e15ce
to
99c9e12
Compare
I tried to map the following rxn on this branch and got an error:
Can you take a look? |
Did it previously work on the main branch? I think I know the issue, and I did not change the function that returns a wrong value. |
This function verifies that the BDE's are supposed to fit the relevant species. Also, checks that the bond exist between the relevant atoms.
This function uses the new, faster and more accurate method for performing the scissoring for atom mapping. Instead of assigning the BDE's to the relevant species, which causes issues when further scissions are performed, this function uses the atom indices to perform the scission.
This due to issue #675, this function also moved the atom indices when copying.
To facilitate the scission without assigning BDE's to the species. Also much simpler than the older function.
This is to follow the new atom mapping functions, and a few minor adjustments.
99c9e12
to
5bfeaac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR presents a new method of performing the scission in atom mapping, based on the atom indices, which are required for atom mapping anyway. This method also simplify the process.
Tests were also added.