##############################################################################
#                                                                            #
#    Open Babel file: bondtyp.txt                                            #
#                                                                            #
#  Copyright (c) 2002-2005 by Geoffrey R Hutchison                           #
#  Part of the Open Babel package, under the GNU General Public License (GPL)#
#                                                                            #
# Used by bondtyper.cpp::OBBondTyper (and thus OBMol::PerceiveBondOrders()   #
#                                                                            #
# List of functional groups with double, triple (etc.) bond orders           #
# Pattern       Atom1 Atom2 Bond Order (repeat as needed)                    #
# * = Any atom (for setting non-multiple bonds)                              #
#                                                                            #
# NOTE: These are applied in order, first to last.                           #
#     So it's generally better to have a long (specifc) SMARTS first.        #
#     (all bonds must be single bonds to match)                              #
#                                                                            #
##############################################################################

# Porphyrin / phthalocyanine (3 patterns for three separate bonding motifs)
# this one has explicit bonds to all four nitrogens (e.g., metal bond or hydrogens)
# X2,X3 is needed to avoid mis-typing coproporphyrinogen
#0        1    2       3   4   5  6        7     8      9  10  11  12       13   14     15 16   17  18       19  20       21 22  23
[X2,X3]1[#6]([#7D3]2)[#6][#6][#6]2[X2,X3][#6]([#7D3]3)[#6][#6][#6]3[X2,X3][#6]([#7D3]4)[#6][#6][#6]4[X2,X3][#6]([#7D3]5)[#6][#6][#6]51	0 1 2 1 2 1 1 3 1 3 4 2 4 5 1 5 2 1 5 6 2 6 7 1 7 8 2 7 9 1 9 10 2 10 11 1 11 8 1 11 12 2 12 13 1 13 14 1 13 15 2 15 16 1 16 17 2 17 14 1 17 18 1 18 19 2 19 20 1 19 21 1 21 22 2 22 23 1 23 20 2

# this one has explicit bonds to two nitrogens (12 and 14)
#0        1    2       3   4   5  6        7    8     9  10  11  12       13   14     15 16   17  18      19  20    21 22  23
[X2,X3]1[#6]([#7D3]2)[#6][#6][#6]2[X2,X3][#6]([#7]3)[#6][#6][#6]3[X2,X3][#6]([#7D3]4)[#6][#6][#6]4[X2,X3][#6]([#7]5)[#6][#6][#6]51	0 1 2 1 2 1 1 3 1 3 4 2 4 5 1 5 2 1 5 6 2 6 7 1 7 8 2 7 9 1 9 10 2 10 11 1 11 8 1 11 12 2 12 13 1 13 14 1 13 15 2 15 16 1 16 17 2 17 14 1 17 18 1 18 19 2 19 20 1 19 21 1 21 22 2 22 23 1 23 20 2

# and this one doesn't have any explicit bonds to the nitrogens
#0        1    2     3   4   5  6        7    8     9  10  11  12      13   14   15  16  17 18        19   20    21 22  23
[X2,X3]1[#6]([#7]2)[#6][#6][#6]2[X2,X3][#6]([#7]3)[#6][#6][#6]3[X2,X3][#6]([#7]4)[#6][#6][#6]4[X2,X3][#6]([#7]5)[#6][#6][#6]51	0 1 2 1 2 1 1 3 1 3 4 2 4 5 1 5 2 1 5 6 2 6 7 1 7 8 2 7 9 1 9 10 2 10 11 1 11 8 1 11 12 2 12 13 1 13 14 1 13 15 2 15 16 1 16 17 2 17 14 1 17 18 1 18 19 2 19 20 1 19 21 1 21 22 2 22 23 1 23 20 2

# Azide
[#7D2][#7D2^1][#7D1]		0 1 2 1 2 2
# Nitro
[#8D1][#7D3^2]([#8D1])*		0 1 2 1 2 2 1 3 1

# Sulfones
[#16D4]([#8D1])([#8D1])([*!#8])([*!#8]) 	0 1 2 0 2 2 0 3 1 0 4 1
# Sulfates
[#16D4]([#8D1])([#8D1])([#8-,#8D1])([#8-,#8D1])	0 1 2 0 2 2 0 3 1 0 4 1
# Thiosulfates
[#16D4]([#16D1])([#8D1])([#8-,#8])([#8-,#8])	0 1 2 0 2 2 0 3 1 0 4 1
# Sulfoxides
[#16D3]([#8D1])([*!#8])([*!#8])			0 1 2 0 2 1 0 3 1
# Sulfite
[#16D3]([#8D1])([#8D1-])([#8D1-])		0 1 2 0 2 1 0 3 1
# Sulfur trioxide
[#16D3]([#8D1])([#8D1])([#8D1])			0 1 2 0 2 2 0 3 2
# Sulfites
[#16D3]([#8D1])([#8])([#8])			0 1 2 0 2 1 0 3 1
# Disulfur monoxide
[#16D2]([#8D1])([#16D1])			0 1 2 0 2 2
# Sulfmonoxides
[#16D2]([#8D1])([*!#8])				0 1 2 0 2 1
# Sulfur dioxide
[#16D2]([#8D1])([#8D1])				0 1 2 0 2 2

#Phosphite
[#15D3]([#8D1])([#8D1])([#8D2])		0 1 2 0 2 2 0 3 1

#oxophosphane
#[#15D2]([#8D1])([#1])      0 1 2 0 2 1

#Nitrosyl Hydride
[#7D2]([#8D1])([#1])		0 1 2 0 2 1

# Phosphone
[#15D4]([#8D1])(*)(*)(*)	0 1 2 0 2 1 0 3 1 0 4 1


# Carboxylic Acid, ester, etc.
[#6D3^2]([#8D1])([#8])*		0 1 2 0 2 1 0 3 1
# Carbon dioxide
[#8D1][#6D2^1][#8D1]		0 1 2 1 2 2
# Amide C(=O)N  - no negative charge on O (2aix_u1k.sdf)
[#6D3^2]([#8D1;!-])([#7])*		0 1 2 0 2 1 0 3 1
# Seleninic acid Se(=O)OH
[#34D3^2]([#8D1])([#8])*		0 1 2 0 2 1 0 3 1
# Thioacid / Thioester C(=O)S
[#6D3^2]([#8D1])([#16])*		0 1 2 0 2 1 0 3 1
# dithioacid / dithioester C(=S)S
[#6D3^2]([#16D1])([#16])*		0 1 2 0 2 1 0 3 1
# thioamide C(=S)N
# avoid aromatics (pdb_ligands_sdf/1yry_msg.sdf)
[CD3^2]([#16D1])([N])*		0 1 2 0 2 1 0 3 1

# allene C=C=C
# (this is problematic -- need to make sure the center carbon is sp)
[#6^2][#6D2^1][#6^2]		0 1 2 1 2 2
# ene-one C=C=O
[#6^2][#6D2^1][#8D1]		0 1 2 1 2 2  

# isonitrile / isocyano
[#6D1][#7D2^1]*  0 1 3 1 2 1
# NR2 in ring with hybridized carbon neighbors, do not apply to aromatic N
# valence insted of degree used to fix pdb_ligands_sdf/3dcv_55e.sdf
[Nv2R][#6v3^2][#8v2] 0 1 2 1 2 1
[Nv2R][#6v3^2][Nv2] 0 1 2 1 2 1

# if three N are present in R-N-guanidine-ish, prefer double bond to the
#  non-terminal N (i.e. D2 if present)
[#6D3^2;!R]([#7D2;!R])([#7D1;!R])~[#7D1;!R] 0 1 2 0 2 1 0 3 1
# guanidinium and amidine -C(=NH)NH2 without hydrogens
[#6D3^2;!R]([#7D1H0;!R])([#7;!R])*	0 1 2 0 2 1 0 3 1
# and also with hydrogens
# (this can normally be figured out, but is needed to avoid matching the next SMARTS)
[#6D3^2;!R]([#7D2H1;!R])([#7;!R])*	0 1 2 0 2 1 0 3 1
# and also with more hydrogens than normal (protonated)
[#6D3^2;!R]([#7D3H2;!R])([#7;!R])*	0 1 2 0 2 1 0 3 1

# Schiff base, protonated
[#6D3^2;!R]([#1,#6])([#1,#6])[#7D3^2;!R]([#1])[#6]	0 1 1 0 2 1 0 3 2 3 4 1 3 5 1

### other potential functional groups that may (or may not) be useful to add
# imidines ( N=C/N\C=N
