Closed bannanc closed 5 years ago
I am worried about the number of open PRs that build on each other. I am going to merge them without review. Any suggested changes from reviews will be added in the next round of PRs.
For the record I'm putting 👍 when I've added a comment to issue #55 for addressing in my next PR
In this pull request I'm updating the
SMIRKSifier
code to make changes in decorators more efficient. This addresses issue #40 by extending the types of options for removing decorators and or atoms. After creating the SMIRKS patterns we use theChemicalEnvironments
way of splitting up decorators on atoms and bonds. That is the SMIRKS decorators on atoms and bonds are split into ORtypes and ANDtypes. ORtypes are further split into a base and sub-decorators.Here is a specific example I'll use to show the types of moves:
"[#6X4+0,#7X3;A;!r:1]-,=;!@[#6]"
Is split up insideChemicalEnvironments
: atom 1#6
with decorators: [X4
,+0
]#7
with decorator: [X3
]A
,!r
] bond'-'
,'='
!@
other atom#6
with no decorators: []There are three layers of decisions:
1. chose an atom or bond
Before, I did this by just setting the probability of choosing a bond to be really low. Now, the number of decorators on the atom or bond are used to chose the type of move. The idea being that the more decorators currently on an atom or bond the more likely you should try taking one off. This also means that a fully generic atom (
[*]
) or bond (~
) will never be picked.2. Change ANDtypes, ORtypes, or an atom
These options are only considered if the atom or bond has the decorator type being considered for changing AND or OR types. In order to try removing an atom, the atom needs to be unindexed (that is it doesn't have a
:n
in the SMIRKS) and it must have only one neighbor. That is an unindexed atom that connects two atoms will never be removed.3. Specific types of removal
I will split this section up into the three categories above a) remove an atom, b) change AND types and c) change OR types.
3a. remove an atom:
Remove the unindexed atom
3b. Remove some AND types
There are two choices here:
!r
from atom 1 in the example above[#6X4+0,#7X3;A;!r:1]
-->[#6X4+0,#7X3;A:1]
!@
from the bond in the example above-,=;!@
-->-,=
!r
andA
from atom 1 in the example above[#6X4+0,#7X3;A;!r:1]
-->[#6X4+0,#7X3:1]
3c. Remove some OR types
For a bond
-,=;!@
-->=;!@
~
)-,=;!@
-->~;!@
For an atom
[#6X4+0,#7X3;A;!r:1]
-->[*;A;!r]
[#6X4+0,#7X3;A;!r:1]
-->[#7X3;A;!r:1]
[#6X4+0,#7X3;A;!r:1]
-->[#6+0,#7X3;A;!r:1]
[#6X4+0,#7X3;A;!r:1]
-->[#6,#7X3;A;!r:1]
*
):[#6X4+0,#7X3;A;!r:1]
-->[*X4+0,*X3;A;!r:1]
X
based decorators[#6X4+0,#7X3;A;!r:1]
-->[#6+0,#7;A;!r:1]
I have added tests for most of these sub options that pass locally. I just need to update the relevant jupyter notebook.