chython 2.19__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chython/__init__.py +35 -0
- chython/_functions.py +95 -0
- chython/_java.py +57 -0
- chython/algorithms/__init__.py +18 -0
- chython/algorithms/_isomorphism.cp313-win_amd64.pyd +0 -0
- chython/algorithms/_isomorphism.pyx +189 -0
- chython/algorithms/_rings.cp313-win_amd64.pyd +0 -0
- chython/algorithms/_rings.pyx +478 -0
- chython/algorithms/aromatics/__init__.py +27 -0
- chython/algorithms/aromatics/_rules.py +124 -0
- chython/algorithms/aromatics/kekule.py +532 -0
- chython/algorithms/aromatics/test/__init__.py +18 -0
- chython/algorithms/aromatics/test/test_kekule.py +160 -0
- chython/algorithms/aromatics/test/test_thiele.py +263 -0
- chython/algorithms/aromatics/thiele.py +222 -0
- chython/algorithms/calculate2d/__init__.py +23 -0
- chython/algorithms/calculate2d/clean2d.js +1 -0
- chython/algorithms/calculate2d/molecule.py +191 -0
- chython/algorithms/calculate2d/reaction.py +75 -0
- chython/algorithms/conformers.py +106 -0
- chython/algorithms/depict.py +596 -0
- chython/algorithms/fingerprints/__init__.py +43 -0
- chython/algorithms/fingerprints/linear.py +202 -0
- chython/algorithms/fingerprints/morgan.py +132 -0
- chython/algorithms/fingerprints/test/__init__.py +18 -0
- chython/algorithms/fingerprints/test/test_linear.py +127 -0
- chython/algorithms/fingerprints/test/test_morgan.py +79 -0
- chython/algorithms/groups/__init__.py +212 -0
- chython/algorithms/groups/_functional.py +290 -0
- chython/algorithms/groups/_oxidations.py +70 -0
- chython/algorithms/groups/_protective.py +964 -0
- chython/algorithms/groups/_reactions.py +809 -0
- chython/algorithms/groups/_reductions.py +88 -0
- chython/algorithms/groups/_transformations.py +278 -0
- chython/algorithms/groups/test/__init__.py +18 -0
- chython/algorithms/groups/test/test_deprotection.py +108 -0
- chython/algorithms/groups/test/test_reactions.py +377 -0
- chython/algorithms/isomorphism.py +664 -0
- chython/algorithms/mapping/__init__.py +188 -0
- chython/algorithms/mapping/_groups.py +94 -0
- chython/algorithms/mapping/_reactions.py +72 -0
- chython/algorithms/mapping/attention.py +266 -0
- chython/algorithms/mapping/reconstruct.py +346 -0
- chython/algorithms/mcs.py +201 -0
- chython/algorithms/morgan.py +77 -0
- chython/algorithms/rings.py +178 -0
- chython/algorithms/smiles.py +597 -0
- chython/algorithms/standardize/__init__.py +30 -0
- chython/algorithms/standardize/_groups.py +958 -0
- chython/algorithms/standardize/_isomers.py +330 -0
- chython/algorithms/standardize/_metal_organics.py +189 -0
- chython/algorithms/standardize/_reagents.py +44 -0
- chython/algorithms/standardize/_salts.py +68 -0
- chython/algorithms/standardize/molecule.py +475 -0
- chython/algorithms/standardize/reaction.py +384 -0
- chython/algorithms/standardize/resonance.py +191 -0
- chython/algorithms/standardize/salts.py +128 -0
- chython/algorithms/standardize/saturation.py +373 -0
- chython/algorithms/standardize/test/__init__.py +18 -0
- chython/algorithms/standardize/test/test_canonicalize.py +66 -0
- chython/algorithms/standardize/test/test_groups.py +146 -0
- chython/algorithms/standardize/test/test_isomers.py +198 -0
- chython/algorithms/stereo.py +1215 -0
- chython/algorithms/tautomers/__init__.py +167 -0
- chython/algorithms/tautomers/_acid.py +59 -0
- chython/algorithms/tautomers/_base.py +116 -0
- chython/algorithms/tautomers/_keto_enol.py +107 -0
- chython/algorithms/tautomers/acid_base.py +208 -0
- chython/algorithms/tautomers/heteroarenes.py +103 -0
- chython/algorithms/tautomers/keto_enol.py +143 -0
- chython/algorithms/tautomers/test/__init__.py +18 -0
- chython/algorithms/tautomers/test/test_tautomers.py +80 -0
- chython/algorithms/test/__init__.py +18 -0
- chython/algorithms/test/test_isomorphism.py +58 -0
- chython/algorithms/test/test_smiles.py +76 -0
- chython/algorithms/x3dom.py +350 -0
- chython/containers/__init__.py +48 -0
- chython/containers/_pack_v2.cp313-win_amd64.pyd +0 -0
- chython/containers/_pack_v2.pyx +271 -0
- chython/containers/_unpack_v0v2.cp313-win_amd64.pyd +0 -0
- chython/containers/_unpack_v0v2.pyx +302 -0
- chython/containers/bonds.py +255 -0
- chython/containers/cgr.py +115 -0
- chython/containers/chimera.py +63 -0
- chython/containers/graph.py +199 -0
- chython/containers/molecule.py +817 -0
- chython/containers/query.py +71 -0
- chython/containers/rdkit.py +183 -0
- chython/containers/reaction.py +324 -0
- chython/containers/test/__init__.py +18 -0
- chython/containers/test/test_molecule.py +117 -0
- chython/containers/test/test_pack.py +60 -0
- chython/containers/test/test_rdkit.py +70 -0
- chython/containers/test/test_reaction.py +40 -0
- chython/exceptions.py +114 -0
- chython/files/MRVrw.py +532 -0
- chython/files/PDBrw.py +255 -0
- chython/files/RDFrw.py +309 -0
- chython/files/SDFrw.py +221 -0
- chython/files/__init__.py +30 -0
- chython/files/_convert.py +207 -0
- chython/files/_mapping.py +117 -0
- chython/files/_xyz.cp313-win_amd64.pyd +0 -0
- chython/files/_xyz.pyx +74 -0
- chython/files/daylight/__init__.py +24 -0
- chython/files/daylight/parser.py +157 -0
- chython/files/daylight/smarts.py +107 -0
- chython/files/daylight/smiles.py +260 -0
- chython/files/daylight/test/__init__.py +18 -0
- chython/files/daylight/test/test_daylight_smarts.py +289 -0
- chython/files/daylight/test/test_daylight_smiles.py +101 -0
- chython/files/daylight/test/test_parser.py +118 -0
- chython/files/daylight/test/test_tokenize.py +77 -0
- chython/files/daylight/tokenize.py +376 -0
- chython/files/libinchi/__init__.py +22 -0
- chython/files/libinchi/libinchi.dll +0 -0
- chython/files/libinchi/wrapper.py +554 -0
- chython/files/mdl/__init__.py +25 -0
- chython/files/mdl/emol.py +251 -0
- chython/files/mdl/erxn.py +67 -0
- chython/files/mdl/mol.py +186 -0
- chython/files/mdl/read.py +223 -0
- chython/files/mdl/rxn.py +67 -0
- chython/files/mdl/stereo.py +63 -0
- chython/files/mdl/write.py +201 -0
- chython/files/opsin.py +35 -0
- chython/files/test/__init__.py +0 -0
- chython/files/test/test_inchi.py +27 -0
- chython/files/test/test_mrv.py +47 -0
- chython/files/test/test_sdf_rdf.py +64 -0
- chython/files/test/test_xyz.py +20 -0
- chython/files/xyz.py +78 -0
- chython/periodictable/__init__.py +69 -0
- chython/periodictable/base/__init__.py +25 -0
- chython/periodictable/base/dynamic.py +149 -0
- chython/periodictable/base/element.py +451 -0
- chython/periodictable/base/groups.py +90 -0
- chython/periodictable/base/periods.py +46 -0
- chython/periodictable/base/query.py +473 -0
- chython/periodictable/base/vector.py +119 -0
- chython/periodictable/groupI.py +252 -0
- chython/periodictable/groupII.py +223 -0
- chython/periodictable/groupIII.py +1154 -0
- chython/periodictable/groupIV.py +210 -0
- chython/periodictable/groupIX.py +196 -0
- chython/periodictable/groupV.py +192 -0
- chython/periodictable/groupVI.py +183 -0
- chython/periodictable/groupVII.py +162 -0
- chython/periodictable/groupVIII.py +161 -0
- chython/periodictable/groupX.py +166 -0
- chython/periodictable/groupXI.py +164 -0
- chython/periodictable/groupXII.py +158 -0
- chython/periodictable/groupXIII.py +239 -0
- chython/periodictable/groupXIV.py +262 -0
- chython/periodictable/groupXV.py +276 -0
- chython/periodictable/groupXVI.py +457 -0
- chython/periodictable/groupXVII.py +324 -0
- chython/periodictable/groupXVIII.py +260 -0
- chython/periodictable/test/__init__.py +0 -0
- chython/periodictable/test/test_element.py +100 -0
- chython/reactor/__init__.py +24 -0
- chython/reactor/base.py +222 -0
- chython/reactor/reactor.py +177 -0
- chython/reactor/test/__init__.py +18 -0
- chython/reactor/test/test_reactor.py +40 -0
- chython/reactor/test/test_transformer.py +78 -0
- chython/reactor/transformer.py +72 -0
- chython/utils/__init__.py +50 -0
- chython/utils/free_wilson.py +114 -0
- chython/utils/grid.py +130 -0
- chython/utils/retro.py +139 -0
- chython-2.19.dist-info/METADATA +105 -0
- chython-2.19.dist-info/RECORD +175 -0
- chython-2.19.dist-info/WHEEL +4 -0
- chython-2.19.dist-info/licenses/LICENSE +165 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2021-2026 Ramil Nugmanov <nougmanoff@protonmail.com>
|
|
4
|
+
# This file is part of chython.
|
|
5
|
+
#
|
|
6
|
+
# chython is free software; you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#
|
|
19
|
+
from lazy_object_proxy import Proxy
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _rules():
|
|
23
|
+
"""
|
|
24
|
+
Rules for canonical positioning of charges and hydrogens.
|
|
25
|
+
|
|
26
|
+
Rule format: (query, rule_type)
|
|
27
|
+
|
|
28
|
+
rule_type:
|
|
29
|
+
'charge_fixed' - deterministic charge move from atom_1 to atom_2
|
|
30
|
+
'charge_fixed_bridge' - deterministic charge move from atom_3 (bridge) to atom_2
|
|
31
|
+
'charge_morgan' - Morgan-dependent charge (atom_1 currently charged)
|
|
32
|
+
'charge_morgan_bridge' - Morgan-dependent charge (atom_3 bridge currently charged)
|
|
33
|
+
'ferrocene' - ferrocene Cp ring charge
|
|
34
|
+
'tautomer_fixed' - deterministic H move
|
|
35
|
+
'tautomer_morgan' - Morgan-dependent H (atom_1 is donor)
|
|
36
|
+
'tautomer_morgan_donor' - Morgan-dependent H (atom_3 is donor)
|
|
37
|
+
'amidine' - global H+bond resolution
|
|
38
|
+
|
|
39
|
+
Charge rules encode atom validity constraints in SMARTS:
|
|
40
|
+
- D2;h1: pyrrole-like NH+ (2 aromatic bonds + 1 implicit H)
|
|
41
|
+
- D3([A]): substituted N+ candidate with any single-bonded atom
|
|
42
|
+
|
|
43
|
+
Each charge rule has 4 variants for atom_1/atom_2 combinations:
|
|
44
|
+
HH: both D2;h1
|
|
45
|
+
HA: atom_1 D2;h1, atom_2 D3
|
|
46
|
+
AH: atom_1 D3, atom_2 D2;h1
|
|
47
|
+
AA: both D3
|
|
48
|
+
"""
|
|
49
|
+
from ... import smarts
|
|
50
|
+
|
|
51
|
+
rules = []
|
|
52
|
+
|
|
53
|
+
# === charge_fixed: deterministic charge positioning ===
|
|
54
|
+
# These rules match fused 5+5 and 5+6 ring systems where the canonical charge position is known.
|
|
55
|
+
# charge_fixed: atom_1 is the current charge holder; charge moves to atom_2.
|
|
56
|
+
# charge_fixed_bridge: atom_3 (bridge N) is the current charge holder; charge moves to atom_2.
|
|
57
|
+
|
|
58
|
+
# --- Rule 1: N1C=CN2[NH+]=CC=C12 -> N1C=CC2=[NH+]C=CN12 ---
|
|
59
|
+
# HH variant
|
|
60
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;r5:3]:2:[C;r5](:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2):[C;r5]:[C;r5]:1')
|
|
61
|
+
rules.append((q, 'charge_fixed'))
|
|
62
|
+
# HA variant
|
|
63
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;r5:3]:2:[C;r5](:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2):[C;r5]:[C;r5]:1')
|
|
64
|
+
rules.append((q, 'charge_fixed'))
|
|
65
|
+
# AH variant
|
|
66
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;r5:3]:2:[C;r5](:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2):[C;r5]:[C;r5]:1')
|
|
67
|
+
rules.append((q, 'charge_fixed'))
|
|
68
|
+
# AA variant
|
|
69
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;r5:3]:2:[C;r5](:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2):[C;r5]:[C;r5]:1')
|
|
70
|
+
rules.append((q, 'charge_fixed'))
|
|
71
|
+
|
|
72
|
+
# --- Rule 2: N1C=C[N+]2=C1C=CN2 -> N1C=CC2=[NH+]C=CN12 ---
|
|
73
|
+
# atom_3 is the charged bridge N (unconstrained D - can be D3 all-aromatic)
|
|
74
|
+
# HH variant
|
|
75
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;r5]:1:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2')
|
|
76
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
77
|
+
# HA variant
|
|
78
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;r5]:1:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2')
|
|
79
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
80
|
+
# AH variant
|
|
81
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;r5]:1:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2')
|
|
82
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
83
|
+
# AA variant
|
|
84
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;r5]:1:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2')
|
|
85
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
86
|
+
|
|
87
|
+
# --- Rule 3: N1C=C2C=CN[N+]2=C1 -> N1C=CC2=C[NH+]=CN12 ---
|
|
88
|
+
# atom_3 is the charged bridge N (unconstrained D)
|
|
89
|
+
# HH variant
|
|
90
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;r5]:1:[C;r5]:[N;r5;D2;h1:2]:[C;r5]:2')
|
|
91
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
92
|
+
# HA variant
|
|
93
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;r5]:1:[C;r5]:[N;r5;D3:2]([A]):[C;r5]:2')
|
|
94
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
95
|
+
# AH variant
|
|
96
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;r5]:1:[C;r5]:[N;r5;D2;h1:2]:[C;r5]:2')
|
|
97
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
98
|
+
# AA variant
|
|
99
|
+
q = smarts('[N;a;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;r5]:1:[C;r5]:[N;r5;D3:2]([A]):[C;r5]:2')
|
|
100
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
101
|
+
|
|
102
|
+
# --- Rule 4: N1C=C2NC=C[N+]2=C1 -> N1C=CN2C=[NH+]C=C12 ---
|
|
103
|
+
# atom_3 is the charged bridge N (unconstrained D)
|
|
104
|
+
# HH variant
|
|
105
|
+
q = smarts('[N;a;r5;+:3]:1:2:[C;r5](:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:1):[C;r5]:[N;r5;D2;h1:2]:[C;r5]:2')
|
|
106
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
107
|
+
# HA variant
|
|
108
|
+
q = smarts('[N;a;r5;+:3]:1:2:[C;r5](:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:1):[C;r5]:[N;r5;D3:2]([A]):[C;r5]:2')
|
|
109
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
110
|
+
# AH variant
|
|
111
|
+
q = smarts('[N;a;r5;+:3]:1:2:[C;r5](:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:1):[C;r5]:[N;r5;D2;h1:2]:[C;r5]:2')
|
|
112
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
113
|
+
# AA variant
|
|
114
|
+
q = smarts('[N;a;r5;+:3]:1:2:[C;r5](:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:1):[C;r5]:[N;r5;D3:2]([A]):[C;r5]:2')
|
|
115
|
+
rules.append((q, 'charge_fixed_bridge'))
|
|
116
|
+
|
|
117
|
+
# --- Rule 5: N1C2=[NH+]C=CC2=CC=C1 -> N1C=CC2=CC=C[NH+]=C12 ---
|
|
118
|
+
# HH variant
|
|
119
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
120
|
+
rules.append((q, 'charge_fixed'))
|
|
121
|
+
# HA variant
|
|
122
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
123
|
+
rules.append((q, 'charge_fixed'))
|
|
124
|
+
# AH variant
|
|
125
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
126
|
+
rules.append((q, 'charge_fixed'))
|
|
127
|
+
# AA variant
|
|
128
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
129
|
+
rules.append((q, 'charge_fixed'))
|
|
130
|
+
|
|
131
|
+
# --- Rule 6: N1C=C2C(=CC=[NH+]2)C=C1 -> N1C=CC2=CC=[NH+]C=C12 ---
|
|
132
|
+
# HH variant
|
|
133
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
134
|
+
rules.append((q, 'charge_fixed'))
|
|
135
|
+
# HA variant
|
|
136
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
137
|
+
rules.append((q, 'charge_fixed'))
|
|
138
|
+
# AH variant
|
|
139
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
140
|
+
rules.append((q, 'charge_fixed'))
|
|
141
|
+
# AA variant
|
|
142
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
143
|
+
rules.append((q, 'charge_fixed'))
|
|
144
|
+
|
|
145
|
+
# --- Rule 7: C1=CC=2C(=[NH+]1)C=CNC=2 -> N1C=CC2=C[NH+]=CC=C12 ---
|
|
146
|
+
# HH variant
|
|
147
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
148
|
+
rules.append((q, 'charge_fixed'))
|
|
149
|
+
# HA variant
|
|
150
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
151
|
+
rules.append((q, 'charge_fixed'))
|
|
152
|
+
# AH variant
|
|
153
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
154
|
+
rules.append((q, 'charge_fixed'))
|
|
155
|
+
# AA variant
|
|
156
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
157
|
+
rules.append((q, 'charge_fixed'))
|
|
158
|
+
|
|
159
|
+
# --- Rule 8: C=1C=[NH+]C=2C=1NC=CC=2 -> N1C=CC2=[NH+]C=CC=C12 ---
|
|
160
|
+
# HH variant
|
|
161
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[C;r6]:[C;r6]:[N;r6;D2;h1:2]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
162
|
+
rules.append((q, 'charge_fixed'))
|
|
163
|
+
# HA variant
|
|
164
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r6]:2:[C;r6]:[C;r6]:[C;r6]:[N;r6;D3:2]([A]):[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
165
|
+
rules.append((q, 'charge_fixed'))
|
|
166
|
+
# AH variant
|
|
167
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[C;r6]:[C;r6]:[N;r6;D2;h1:2]:[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
168
|
+
rules.append((q, 'charge_fixed'))
|
|
169
|
+
# AA variant
|
|
170
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r6]:2:[C;r6]:[C;r6]:[C;r6]:[N;r6;D3:2]([A]):[C;r5]:2:[C;r5]:[C;r5]:1')
|
|
171
|
+
rules.append((q, 'charge_fixed'))
|
|
172
|
+
|
|
173
|
+
# --- Rule 9: C1=2C=[NH+]C=C1NC=CC=2 -> N1C=C2C=CC=[NH+]C2=C1 ---
|
|
174
|
+
# HH variant
|
|
175
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[C;r6]:2:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
176
|
+
rules.append((q, 'charge_fixed'))
|
|
177
|
+
# HA variant
|
|
178
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[C;r6]:2:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
179
|
+
rules.append((q, 'charge_fixed'))
|
|
180
|
+
# AH variant
|
|
181
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[C;r6]:2:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
182
|
+
rules.append((q, 'charge_fixed'))
|
|
183
|
+
# AA variant
|
|
184
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[C;r6]:2:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
185
|
+
rules.append((q, 'charge_fixed'))
|
|
186
|
+
|
|
187
|
+
# --- Rule 10: C1=2C=CNC=C1C=[NH+]C=2 -> N1C=C2C=C[NH+]=CC2=C1 ---
|
|
188
|
+
# HH variant
|
|
189
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[C;r6]:2:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
190
|
+
rules.append((q, 'charge_fixed'))
|
|
191
|
+
# HA variant
|
|
192
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[C;r6]:2:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
193
|
+
rules.append((q, 'charge_fixed'))
|
|
194
|
+
# AH variant
|
|
195
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[C;r6]:2:[C;r6]:[N;r6;D2;h1:2]:[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
196
|
+
rules.append((q, 'charge_fixed'))
|
|
197
|
+
# AA variant
|
|
198
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[C;r6]:2:[C;r6]:[N;r6;D3:2]([A]):[C;r6]:[C;r6]:[C;r5]:2:[C;r5]:1')
|
|
199
|
+
rules.append((q, 'charge_fixed'))
|
|
200
|
+
|
|
201
|
+
# === tautomer_fixed: deterministic H positioning ===
|
|
202
|
+
|
|
203
|
+
# 1,2,4-triazole: N1C=NC=N1 -> N1C=NN=C1
|
|
204
|
+
q = smarts('[N;a;r5;D2;h1;x1:2]:1:[N;r5;D2;h0;x1]:[C;r5]:[N;r5;D2;h0;x0:1]:[C;r5]:1')
|
|
205
|
+
rules.append((q, 'tautomer_fixed'))
|
|
206
|
+
|
|
207
|
+
# tetrazole: N1N=CN=N1 -> N1C=NN=N1
|
|
208
|
+
q = smarts('[N;a;r5;D2;h0;x1:1]:1:[N;r5;D2;h1;x2:2]:[N;r5;D2;h0;x2]:[N;r5;D2;h0;x1]:[C;r5]:1')
|
|
209
|
+
rules.append((q, 'tautomer_fixed'))
|
|
210
|
+
|
|
211
|
+
# === charge_morgan: Morgan-dependent charge positioning ===
|
|
212
|
+
# Morgan ordering decides which atom gets the charge.
|
|
213
|
+
|
|
214
|
+
# --- Rule M1: indazole+ fused (5+5 ring, N-N bridge) ---
|
|
215
|
+
# HH variant
|
|
216
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;D3]:2:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[C;D3]:2:[C;r5]:[C;r5]:1')
|
|
217
|
+
rules.append((q, 'charge_morgan'))
|
|
218
|
+
# HA variant
|
|
219
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;D3]:2:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[C;D3]:2:[C;r5]:[C;r5]:1')
|
|
220
|
+
rules.append((q, 'charge_morgan'))
|
|
221
|
+
# AH variant
|
|
222
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;D3]:2:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[C;D3]:2:[C;r5]:[C;r5]:1')
|
|
223
|
+
rules.append((q, 'charge_morgan'))
|
|
224
|
+
# AA variant
|
|
225
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;D3]:2:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[C;D3]:2:[C;r5]:[C;r5]:1')
|
|
226
|
+
rules.append((q, 'charge_morgan'))
|
|
227
|
+
|
|
228
|
+
# --- Rule M2: indazole+ fused (bridge variant, charge on bridge N) ---
|
|
229
|
+
# HH variant for atom_1/atom_2
|
|
230
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;D3]:1:[C;r5]:[C;r5]:[N;r5;D2;h1:2]:2')
|
|
231
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
232
|
+
# HA variant
|
|
233
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:[C;D3]:1:[C;r5]:[C;r5]:[N;r5;D3:2]([A]):2')
|
|
234
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
235
|
+
# AH variant
|
|
236
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;D3]:1:[C;r5]:[C;r5]:[N;r5;D2;h1:2]:2')
|
|
237
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
238
|
+
# AA variant
|
|
239
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:[C;D3]:1:[C;r5]:[C;r5]:[N;r5;D3:2]([A]):2')
|
|
240
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
241
|
+
|
|
242
|
+
# --- Rule M3: imidazole fused (5+5, C-N-C bridge) ---
|
|
243
|
+
# HH variant
|
|
244
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;D3]:2:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[N;D3]:2:[C;r5]:[C;r5]:1')
|
|
245
|
+
rules.append((q, 'charge_morgan'))
|
|
246
|
+
# HA variant
|
|
247
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;D3]:2:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[N;D3]:2:[C;r5]:[C;r5]:1')
|
|
248
|
+
rules.append((q, 'charge_morgan'))
|
|
249
|
+
# AH variant
|
|
250
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;D3]:2:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[N;D3]:2:[C;r5]:[C;r5]:1')
|
|
251
|
+
rules.append((q, 'charge_morgan'))
|
|
252
|
+
# AA variant
|
|
253
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;D3]:2:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[N;D3]:2:[C;r5]:[C;r5]:1')
|
|
254
|
+
rules.append((q, 'charge_morgan'))
|
|
255
|
+
|
|
256
|
+
# --- Rule M4: imidazole fused (bridge variant, charge on bridge) ---
|
|
257
|
+
# HH variant
|
|
258
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[C;D3](:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:1):[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2')
|
|
259
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
260
|
+
# HA variant
|
|
261
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[C;D3](:[N;r5;D2;h1:1]:[C;r5]:[C;r5]:1):[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2')
|
|
262
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
263
|
+
# AH variant
|
|
264
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[C;D3](:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:1):[N;r5;D2;h1:2]:[C;r5]:[C;r5]:2')
|
|
265
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
266
|
+
# AA variant
|
|
267
|
+
q = smarts('[N;a;D3;r5;+:3]:1:2:[C;D3](:[N;r5;D3:1]([A]):[C;r5]:[C;r5]:1):[N;r5;D3:2]([A]):[C;r5]:[C;r5]:2')
|
|
268
|
+
rules.append((q, 'charge_morgan_bridge'))
|
|
269
|
+
|
|
270
|
+
# --- Rule M5: imidazolium (simple 5-ring) ---
|
|
271
|
+
# HH variant
|
|
272
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:1')
|
|
273
|
+
rules.append((q, 'charge_morgan'))
|
|
274
|
+
# HA variant
|
|
275
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[C;r5]:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:1')
|
|
276
|
+
rules.append((q, 'charge_morgan'))
|
|
277
|
+
# AH variant
|
|
278
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:1')
|
|
279
|
+
rules.append((q, 'charge_morgan'))
|
|
280
|
+
# AA variant
|
|
281
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[C;r5]:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:1')
|
|
282
|
+
rules.append((q, 'charge_morgan'))
|
|
283
|
+
|
|
284
|
+
# --- Rule M6: pyrazolium (simple 5-ring) ---
|
|
285
|
+
# HH variant
|
|
286
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[C;r5]:1')
|
|
287
|
+
rules.append((q, 'charge_morgan'))
|
|
288
|
+
# HA variant
|
|
289
|
+
q = smarts('[N;a;r5;D2;h1;+:1]:1:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[C;r5]:1')
|
|
290
|
+
rules.append((q, 'charge_morgan'))
|
|
291
|
+
# AH variant
|
|
292
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;r5;D2;h1:2]:[C;r5]:[C;r5]:[C;r5]:1')
|
|
293
|
+
rules.append((q, 'charge_morgan'))
|
|
294
|
+
# AA variant
|
|
295
|
+
q = smarts('[N;a;r5;D3;+:1]([A]):1:[N;r5;D3:2]([A]):[C;r5]:[C;r5]:[C;r5]:1')
|
|
296
|
+
rules.append((q, 'charge_morgan'))
|
|
297
|
+
|
|
298
|
+
# === ferrocene ===
|
|
299
|
+
q = smarts('[C;a;r5;-:1]:1:[C;a;r5:2]:[C;a;r5:3]:[C;a;r5:4]:[C;a;r5:5]:1')
|
|
300
|
+
rules.append((q, 'ferrocene'))
|
|
301
|
+
|
|
302
|
+
# === tautomer_morgan: Morgan-dependent H positioning ===
|
|
303
|
+
|
|
304
|
+
# pyrazole
|
|
305
|
+
q = smarts('[N;a;r5;D2;h1;x1:1]:1:[N;r5;D2;h0;x1:2]:[C;r5]:[C;r5]:[C;r5]:1')
|
|
306
|
+
rules.append((q, 'tautomer_morgan'))
|
|
307
|
+
|
|
308
|
+
# imidazole
|
|
309
|
+
q = smarts('[N;a;r5;D2;h1;x0:1]:1:[C;r5]:[N;r5;D2;h0;x0:2]:[C;r5]:[C;r5]:1')
|
|
310
|
+
rules.append((q, 'tautomer_morgan'))
|
|
311
|
+
|
|
312
|
+
# 1,2,3-triazole
|
|
313
|
+
q = smarts('[N;a;r5;D2;h1;x1:1]:1:[N;r5;D2;h0;x2]:[N;r5;D2;h0;x1:2]:[C;r5]:[C;r5]:1')
|
|
314
|
+
rules.append((q, 'tautomer_morgan'))
|
|
315
|
+
|
|
316
|
+
# 1,2,3-triazole (donor variant)
|
|
317
|
+
q = smarts('[N;a;r5;D2;h0;x1:1]:1:[N;r5;D2;h1;x2:3]:[N;r5;D2;h0;x1:2]:[C;r5]:[C;r5]:1')
|
|
318
|
+
rules.append((q, 'tautomer_morgan_donor'))
|
|
319
|
+
|
|
320
|
+
# === amidine: global H+bond resolution ===
|
|
321
|
+
q = smarts('[N;h0,h1;z2:1]=[C;z2;x2,x3;!R:3]-[N;h1,h2;z1:2]')
|
|
322
|
+
rules.append((q, 'amidine'))
|
|
323
|
+
|
|
324
|
+
return rules
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
rules = Proxy(_rules)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
__all__ = ['rules']
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2021-2026 Ramil Nugmanov <nougmanoff@protonmail.com>
|
|
4
|
+
# This file is part of chython.
|
|
5
|
+
#
|
|
6
|
+
# chython is free software; you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#
|
|
19
|
+
from lazy_object_proxy import Proxy
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _rules():
|
|
23
|
+
from ... import smarts
|
|
24
|
+
|
|
25
|
+
rules = []
|
|
26
|
+
|
|
27
|
+
#
|
|
28
|
+
# R - N - C R - N - C
|
|
29
|
+
# / || / ||
|
|
30
|
+
# A - M = C || >> A - M .. [C-] ||
|
|
31
|
+
# \ || \\ ||
|
|
32
|
+
# R - N - C R - [N+]- C
|
|
33
|
+
#
|
|
34
|
+
q = smarts('[M:1]=[C:2]-1-[N;D3;x0;z1:3]-[C;z2:5]-,=[C;z2:6]-[N;D3;x0;z1:4]-1')
|
|
35
|
+
atom_fix = {2: (-1, None), 3: (1, None)} # atom: (charge diff, new radical state or None)
|
|
36
|
+
bonds_fix = ((1, 2, 8), (2, 3, 2))
|
|
37
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
38
|
+
|
|
39
|
+
#
|
|
40
|
+
# cyanide
|
|
41
|
+
#
|
|
42
|
+
q = smarts('[M:3]-[C:1]#[N:2]')
|
|
43
|
+
# NOTE: first fixed atom is metal. required for preventing errors in charge.
|
|
44
|
+
# based on ordered dict nature.
|
|
45
|
+
atom_fix = {3: (1, None), 1: (-1, None)}
|
|
46
|
+
bonds_fix = ((1, 3, 8),)
|
|
47
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
48
|
+
|
|
49
|
+
q = smarts('[M:3]-[C-:1]#[N:2]')
|
|
50
|
+
atom_fix = {}
|
|
51
|
+
bonds_fix = ((1, 3, 8),)
|
|
52
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
53
|
+
|
|
54
|
+
#
|
|
55
|
+
# cyanate/fulminate
|
|
56
|
+
#
|
|
57
|
+
q = smarts('[M:1]-[O,S;D2:2]-[C:3]#[N:4]')
|
|
58
|
+
atom_fix = {1: (1, None), 4: (-1, None)}
|
|
59
|
+
bonds_fix = ((1, 2, 8), (2, 3, 2), (3, 4, 2))
|
|
60
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
61
|
+
|
|
62
|
+
q = smarts('[M:1]-[N:2]=[C:3]=[O,S;D1:4]')
|
|
63
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
64
|
+
bonds_fix = ((1, 2, 8),)
|
|
65
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
66
|
+
|
|
67
|
+
q = smarts('[M:1]-[O,S;D2:2]-[N+:3]#[C-:4]')
|
|
68
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
69
|
+
bonds_fix = ((1, 2, 8),)
|
|
70
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
71
|
+
|
|
72
|
+
q = smarts('[M:1]-[C:2]#[N+:3]-[O,S;D1-:4]')
|
|
73
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
74
|
+
bonds_fix = ((1, 2, 8),)
|
|
75
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
76
|
+
|
|
77
|
+
#
|
|
78
|
+
# carbonyl
|
|
79
|
+
#
|
|
80
|
+
q = smarts('[M:3]-[C:1]#[O:2]')
|
|
81
|
+
atom_fix = {1: (-1, None), 2: (1, None)}
|
|
82
|
+
bonds_fix = ((1, 3, 8),)
|
|
83
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
84
|
+
|
|
85
|
+
q = smarts('[M:3]-[C:1]=[O:2] |^1:1|')
|
|
86
|
+
atom_fix = {1: (-1, False), 2: (1, None)}
|
|
87
|
+
bonds_fix = ((1, 3, 8), (1, 2, 3))
|
|
88
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
89
|
+
|
|
90
|
+
q = smarts('[M:3]-[C;D2:1]=[O:2]')
|
|
91
|
+
atom_fix = {1: (-1, None), 2: (1, None)}
|
|
92
|
+
bonds_fix = ((1, 3, 8), (1, 2, 3))
|
|
93
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
94
|
+
|
|
95
|
+
q = smarts('[M:3]-[C:1](-[M:4])=[O:2]')
|
|
96
|
+
atom_fix = {1: (-1, None), 2: (1, None)}
|
|
97
|
+
bonds_fix = ((1, 3, 8), (1, 4, 8), (1, 2, 3))
|
|
98
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Ferrocene covalent uncharged
|
|
102
|
+
#
|
|
103
|
+
q = smarts('[M:1]-1-2-3-4-[C:2]-5-[C:3]-1-[C:4]-2-[C:5]-3-[C:6]-4-5')
|
|
104
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
105
|
+
bonds_fix = ((1, 2, 8), (1, 3, 8), (1, 4, 8), (1, 5, 8), (1, 6, 8), (3, 4, 2), (5, 6, 2))
|
|
106
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
107
|
+
|
|
108
|
+
#
|
|
109
|
+
# Ferrocene covalent uncharged. invalid valence.
|
|
110
|
+
#
|
|
111
|
+
q = smarts('[M:1]-1-2-3-4-[C:2]-5-[C:3]-1=[C:4]-2-[C:5]-3=[C:6]-4-5')
|
|
112
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
113
|
+
bonds_fix = ((1, 2, 8), (1, 3, 8), (1, 4, 8), (1, 5, 8), (1, 6, 8), (3, 4, 2), (5, 6, 2))
|
|
114
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
115
|
+
|
|
116
|
+
#
|
|
117
|
+
# Ferrocene covalent radical carbon
|
|
118
|
+
#
|
|
119
|
+
q = smarts('[M:1]-1-2-3-4-[C:2]-5-[C:3]-1=[C:4]-2-[C:5]-3=[C:6]-4-5 |^1:1|')
|
|
120
|
+
atom_fix = {1: (1, None), 2: (-1, False), 3: (0, False), 4: (0, False), 5: (0, False), 6: (0, False)}
|
|
121
|
+
bonds_fix = ((1, 2, 8), (1, 3, 8), (1, 4, 8), (1, 5, 8), (1, 6, 8), (3, 4, 2), (5, 6, 2))
|
|
122
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
123
|
+
|
|
124
|
+
#
|
|
125
|
+
# Ferrocene covalent charged
|
|
126
|
+
#
|
|
127
|
+
q = smarts('[M:1]-1-2-3-4-[C-:2]-5-[C:3]-1=[C:4]-2-[C:5]-3=[C:6]-4-5')
|
|
128
|
+
atom_fix = {}
|
|
129
|
+
bonds_fix = ((1, 2, 8), (1, 3, 8), (1, 4, 8), (1, 5, 8), (1, 6, 8))
|
|
130
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
131
|
+
|
|
132
|
+
#
|
|
133
|
+
# Ferrocene coordinate radical carbon
|
|
134
|
+
#
|
|
135
|
+
q = smarts('[M:1]~1~2~3~4~[C:2]-5-[C:3]~1=[C:4]~2-[C:5]~3=[C:6]~4-5 |^1:1|')
|
|
136
|
+
atom_fix = {1: (1, None), 2: (-1, False), 3: (0, False), 4: (0, False), 5: (0, False), 6: (0, False)}
|
|
137
|
+
bonds_fix = ((3, 4, 2), (5, 6, 2))
|
|
138
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Allyl complexes
|
|
142
|
+
#
|
|
143
|
+
q = smarts('[M:1]~1~2~[C;z2:2]=[C:3]~1-[C:4]~2 |^1:3|')
|
|
144
|
+
atom_fix = {1: (1, None), 4: (-1, False)}
|
|
145
|
+
bonds_fix = ()
|
|
146
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
# Phosphines
|
|
150
|
+
#
|
|
151
|
+
q = smarts('[M:1]-[P;D4;z1;+:2]-C')
|
|
152
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
153
|
+
bonds_fix = ((1, 2, 8),)
|
|
154
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
155
|
+
|
|
156
|
+
q = smarts('[M:1]-[P;D4;z1:2]-C')
|
|
157
|
+
atom_fix = {}
|
|
158
|
+
bonds_fix = ((1, 2, 8),)
|
|
159
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
160
|
+
|
|
161
|
+
# Amines
|
|
162
|
+
q = smarts('[M:1]-[N;z1;+:2]-C')
|
|
163
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
164
|
+
bonds_fix = ((1, 2, 8),)
|
|
165
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
166
|
+
|
|
167
|
+
q = smarts('[M:1]-[N;z1:2]-C')
|
|
168
|
+
atom_fix = {}
|
|
169
|
+
bonds_fix = ((1, 2, 8),)
|
|
170
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
171
|
+
|
|
172
|
+
# ethers
|
|
173
|
+
q = smarts('[M:1]-[O;D3;+:2](-C)-C')
|
|
174
|
+
atom_fix = {1: (1, None), 2: (-1, None)}
|
|
175
|
+
bonds_fix = ((1, 2, 8),)
|
|
176
|
+
rules.append((q, atom_fix, bonds_fix))
|
|
177
|
+
|
|
178
|
+
compiled_rules = []
|
|
179
|
+
for q, atom_fix, bonds_fix in rules:
|
|
180
|
+
any_atoms = [n for n, a in q.atoms() if a.atomic_symbol == 'A' and n not in atom_fix]
|
|
181
|
+
any_atoms.extend(n for n, a in q.atoms() if a.atomic_symbol == 'M')
|
|
182
|
+
compiled_rules.append((q, atom_fix, bonds_fix, any_atoms, False))
|
|
183
|
+
return compiled_rules
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
rules = Proxy(_rules)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
__all__ = ['rules']
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2022-2026 Ramil Nugmanov <nougmanoff@protonmail.com>
|
|
4
|
+
# This file is part of chython.
|
|
5
|
+
#
|
|
6
|
+
# chython is free software; you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#
|
|
19
|
+
from lazy_object_proxy import Proxy
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _reagents():
|
|
23
|
+
from ... import smiles
|
|
24
|
+
|
|
25
|
+
tmp = ['N', 'O', 'F', 'Cl', 'Br', 'I', 'O=C=O', # inorganic
|
|
26
|
+
'C1=CC=CC=C1', 'C1CCCCC1', 'CC1=CC=CC=C1', 'CCCCCC', 'CCCCCCC', # hydrocarbon
|
|
27
|
+
'CO', 'CCO', 'CC(C)O', # alcohol
|
|
28
|
+
'OC=O', 'CC(=O)O', # acid
|
|
29
|
+
'CC(=O)OCC', # ester
|
|
30
|
+
'CCOCC', 'C1COCC1', # ether
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
rules = set()
|
|
34
|
+
for x in tmp:
|
|
35
|
+
x = smiles(x)
|
|
36
|
+
x.thiele()
|
|
37
|
+
rules.add(x)
|
|
38
|
+
return rules
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
reagents_set = Proxy(_reagents)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
__all__ = ['reagents_set']
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2022-2026 Ramil Nugmanov <nougmanoff@protonmail.com>
|
|
4
|
+
# This file is part of chython.
|
|
5
|
+
#
|
|
6
|
+
# chython is free software; you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#
|
|
19
|
+
from lazy_object_proxy import Proxy
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _rules():
|
|
23
|
+
from ... import smarts
|
|
24
|
+
rules = []
|
|
25
|
+
|
|
26
|
+
# Oxo-acid salts
|
|
27
|
+
q = smarts('[O,S,Se;D2;z1:1]-[C,N,P,S,Cl,Se,Br,I,Si]=O')
|
|
28
|
+
rules.append(q)
|
|
29
|
+
|
|
30
|
+
# Thiophosphate salts
|
|
31
|
+
q = smarts('[O,S,Se;D2;z1:1]-[P]=[S,Se]')
|
|
32
|
+
rules.append(q)
|
|
33
|
+
|
|
34
|
+
# Phenole salts
|
|
35
|
+
q = smarts('[O,S,Se;D2;z1:1]-[C,N;a]')
|
|
36
|
+
rules.append(q)
|
|
37
|
+
|
|
38
|
+
# Nitrate
|
|
39
|
+
q = smarts('[O;D2;z1:1]-[N+](-[O-])=O')
|
|
40
|
+
rules.append(q)
|
|
41
|
+
|
|
42
|
+
# halogenides and hydroxy
|
|
43
|
+
q = smarts('[O,F,Cl,Br,I;D1;z1:1]')
|
|
44
|
+
rules.append(q)
|
|
45
|
+
return rules
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _acids():
|
|
49
|
+
from ... import smiles
|
|
50
|
+
|
|
51
|
+
tmp = ['Cl', 'Br', 'I', 'O[N+](=O)[O-]', 'ON=O', 'OP(O)(O)=O', 'COP(O)(=O)OC',
|
|
52
|
+
'OS(O)(=O)=O', 'CS(O)(=O)=O', 'OS(=O)(=O)C(F)(F)F', 'CC1=CC=C(C=C1)S(O)(=O)=O',
|
|
53
|
+
'OC(O)=O', 'CC(O)=O', 'OC(=O)C(F)(F)F', 'OCC(O)=O', 'CC(O)C(O)=O', 'OC(=O)C(O)=O', 'OC(=O)C(Cl)Cl',
|
|
54
|
+
'OC(=O)C=CC(O)=O', 'OC(C(O)C(O)=O)C(O)=O',
|
|
55
|
+
'O[Cl](=O)(=O)=O']
|
|
56
|
+
acs = set()
|
|
57
|
+
for x in tmp:
|
|
58
|
+
x = smiles(x)
|
|
59
|
+
x.thiele()
|
|
60
|
+
acs.add(x)
|
|
61
|
+
return acs
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
acids = Proxy(_acids)
|
|
65
|
+
rules = Proxy(_rules)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
__all__ = ['acids', 'rules']
|