       1 package Fingerprints::MACCSKeys;
       2 #
       3 # $RCSfile: MACCSKeys.pm,v $
       4 # $Date: 2015/02/28 20:48:54 $
       5 # $Revision: 1.33 $
       6 #
       7 # Author: Manish Sud <msud@san.rr.com>
       8 #
       9 # Copyright (C) 2015 Manish Sud. All rights reserved.
      10 #
      11 # This file is part of MayaChemTools.
      12 #
      13 # MayaChemTools is free software; you can redistribute it and/or modify it under
      14 # the terms of the GNU Lesser General Public License as published by the Free
      15 # Software Foundation; either version 3 of the License, or (at your option) any
      16 # later version.
      17 #
      18 # MayaChemTools is distributed in the hope that it will be useful, but without
      19 # any warranty; without even the implied warranty of merchantability of fitness
      20 # for a particular purpose.  See the GNU Lesser General Public License for more
      21 # details.
      22 #
      23 # You should have received a copy of the GNU Lesser General Public License
      24 # along with MayaChemTools; if not, see <http://www.gnu.org/licenses/> or
      25 # write to the Free Software Foundation Inc., 59 Temple Place, Suite 330,
      26 # Boston, MA, 02111-1307, USA.
      27 #
      28
      29 use strict;
      30 use Carp;
      31 use Exporter;
      32 use Fingerprints::Fingerprints;
      33 use TextUtil ();
      34 use Molecule;
      35 use PeriodicTable;
      36
      37 use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
      38
      39 @ISA = qw(Fingerprints::Fingerprints Exporter);
      40 @EXPORT = qw();
      41 @EXPORT_OK = qw();
      42
      43 %EXPORT_TAGS = (all  => [@EXPORT, @EXPORT_OK]);
      44
      45 # Setup class variables...
      46 my($ClassName);
      47 _InitializeClass();
      48
      49 # Overload Perl functions...
      50 use overload '""' => 'StringifyMACCSKeys';
      51
      52 # Class constructor...
      53 sub new {
      54   my($Class, %NamesAndValues) = @_;
      55
      56   # Initialize object...
      57   my $This = $Class->SUPER::new();
      58   bless $This, ref($Class) || $Class;
      59   $This->_InitializeMACCSKeys();
      60
      61   $This->_InitializeMACCSKeysProperties(%NamesAndValues);
      62
      63   return $This;
      64 }
      65
      66 # Initialize object data...
      67 #
      68 sub _InitializeMACCSKeys {
      69   my($This) = @_;
      70
      71   # Type of fingerprint to generate:
      72   #
      73   # MACCSKeyBits - A bit vector indicating presence/absence of keys
      74   # MACCSKeyCount - A vector containing count of keys
      75   #
      76   $This->{Type} = '';
      77   $This->{KeyBits} = '';
      78
      79   # Size of key set: 166 or 322...
      80   $This->{Size} = '';
      81 }
      82
      83 # Initialize class ...
      84 sub _InitializeClass {
      85   #Class name...
      86   $ClassName = __PACKAGE__;
      87 }
      88
      89 # Initialize object properties....
      90 sub _InitializeMACCSKeysProperties {
      91   my($This, %NamesAndValues) = @_;
      92
      93   my($Name, $Value, $MethodName);
      94   while (($Name, $Value) = each  %NamesAndValues) {
      95     $MethodName = "Set${Name}";
      96     $This->$MethodName($Value);
      97   }
      98
      99   # Make sure molecule object was specified...
     100   if (!exists $NamesAndValues{Molecule}) {
     101     croak "Error: ${ClassName}->New: Object can't be instantiated without specifying molecule...";
     102   }
     103
     104   # Make sure type and size were specified...
     105   if (!exists $NamesAndValues{Type}) {
     106     croak "Error: ${ClassName}->New: Object can't be instantiated without specifying type...";
     107   }
     108   if (!exists $NamesAndValues{Size}) {
     109     croak "Error: ${ClassName}->New: Object can't be instantiated without specifying size...";
     110   }
     111
     112   # Make sure approriate size is specified...
     113   if ($NamesAndValues{Size} !~ /^(166|322)$/) {
     114     croak "Error: ${ClassName}->New: The current release of MayaChemTools doesn't support MDL MACCS $NamesAndValues{Size} keys...";
     115   }
     116
     117   if ($This->{Type} =~ /^MACCSKeyBits$/i) {
     118     $This->_InitializeMACCSKeyBits();
     119   }
     120   elsif ($This->{Type} =~ /^MACCSKeyCount$/i) {
     121     $This->_InitializeMACCSKeyCounts();
     122   }
     123   else {
     124     croak "Error: ${ClassName}->_InitializeMACCSKeysProperties: Unknown MACCS keys type: $This->{Type}; Supported type keys: MACCSKeyBits or MACCSKeyCount......";
     125   }
     126
     127   return $This;
     128 }
     129
     130 # Initialize MACCS key bits...
     131 #
     132 sub _InitializeMACCSKeyBits {
     133   my($This) = @_;
     134
     135   $This->{KeyBits} = 1;
     136
     137   # Vector type...
     138   $This->{VectorType} = 'FingerprintsBitVector';
     139
     140   $This->_InitializeFingerprintsBitVector();
     141
     142   return $This;
     143 }
     144
     145 # Initialize MACCS key counts...
     146 #
     147 sub _InitializeMACCSKeyCounts {
     148   my($This) = @_;
     149
     150   $This->{KeyBits} = 0;
     151
     152   # Vector type and type of values...
     153   $This->{VectorType} = 'FingerprintsVector';
     154   $This->{FingerprintsVectorType} = 'OrderedNumericalValues';
     155
     156   $This->_InitializeFingerprintsVector();
     157
     158   # Initialize values to zero...
     159   my(@Values);
     160   @Values = (0) x $This->{Size};
     161   $This->{FingerprintsVector}->AddValues(\@Values);
     162
     163   return $This;
     164 }
     165
     166 # Set type...
     167 #
     168 sub SetType {
     169   my($This, $Type) = @_;
     170
     171   if ($This->{Type}) {
     172     croak "Error: ${ClassName}->SetType: Can't change type:  It's already set...";
     173   }
     174
     175   if ($Type =~ /^MACCSKeyBits$/i) {
     176     $This->{Type} = 'MACCSKeyBits';;
     177     $This->{KeyBits} = 1;
     178   }
     179   elsif ($Type =~ /^MACCSKeyCount$/i) {
     180     $This->{Type} = 'MACCSKeyCount';;
     181     $This->{KeyBits} = 0;
     182   }
     183   else {
     184     croak "Error: ${ClassName}->SetType: Unknown type MACCS keys: $Type; Supported type keys: MACCSKeyBits or MACCSKeyCount...";
     185   }
     186   return $This;
     187 }
     188
     189 # Set size...
     190 #
     191 sub SetSize {
     192   my($This, $Value) = @_;
     193
     194   if ($This->{Size}) {
     195     croak "Error: ${ClassName}->SetSize: Can't change size:  It's already set...";
     196   }
     197   if (!TextUtil::IsPositiveInteger($Value)) {
     198     croak "Error: ${ClassName}->SetSize: Size value, $Value, is not valid:  It must be a positive integer...";
     199   }
     200   if ($Value !~ /^(166|322)/i) {
     201     croak "Error: ${ClassName}->Size: The current release of MayaChemTools doesn't support MDL MACCS $Value keys...";
     202   }
     203   $This->{Size} = $Value;
     204
     205   return $This;
     206 }
     207
     208 # Generate description...
     209 #
     210 sub GetDescription {
     211   my($This) = @_;
     212
     213   # Is description explicity set?
     214   if (exists $This->{Description}) {
     215     return $This->{Description};
     216   }
     217
     218   return "$This->{Type}";
     219 }
     220
     221 # Generate MDL MACCS keys..
     222 #
     223 sub GenerateMACCSKeys {
     224   my($This) = @_;
     225
     226   # Cache appropriate molecule data...
     227   $This->_SetupMoleculeDataCache();
     228
     229   if ($This->{Size} == 166) {
     230     $This->_GenerateMACCS166Keys();
     231   }
     232   elsif ($This->{Size} == 322) {
     233     $This->_GenerateMACCS322Keys();
     234   }
     235   else {
     236     croak "Error: ${ClassName}->GenerateMACCSKeys: The current release of MayaChemTools doesn't support MDL MACCS  $This->{Size} keys...";
     237   }
     238
     239   $This->{FingerprintsGenerated} = 1;
     240
     241   # Clear cached molecule data...
     242   $This->_ClearMoleculeDataCache();
     243
     244   return $This;
     245 }
     246
     247 # Setup GenerateFingerprints method in order to be consistent with all other
     248 # fingerprints classes implemented in the current release of MayaChemTools...
     249 #
     250 sub GenerateFingerprints {
     251   my($This) = @_;
     252
     253   return $This->GenerateMACCSKeys();
     254 }
     255
     256 # Generate MDL MACCS 166 keys...
     257 #
     258 # Information on the 166 keys [ Ref. 45-47 ]:
     259 #
     260 # Atom symbols:
     261 #
     262 # A : Any valid perodic table element symbol
     263 # Q  : Hetro atoms; any non-C or non-H atom
     264 # X  : Halogens; F, Cl, Br, I
     265 # Z  : Others; other than H, C, N, O, Si, P, S, F, Cl, Br, I
     266 #
     267 # Bond types:
     268 #
     269 # -  : Single
     270 # =  : Double
     271 # T  : Triple
     272 # #  : Triple
     273 # ~  : Single or double query bond
     274 # %  : An aromatic query bond
     275 #
     276 # None : Any bond type; no explict bond specified
     277 #
     278 # $  : Ring bond; $ before a bond type specifies ring bond
     279 # !  : Chain or non-ring bond; ! before a bond type specifies chain bond
     280 #
     281 # @  : A ring linkage and the number following it specifies the
     282 #      atoms position in the line, thus @1 means linked back to the first atom in
     283 #      the list.
     284 #
     285 # Aromatic: Kekule or Arom5
     286 #
     287 # Kekule: Bonds in 6-membered rings with alternalte single/double bonds or perimeter
     288 #         bonds
     289 #
     290 # Arom5: Bonds in 5-membered rings with two double bonds and a hetro atom at
     291 #        the apex of the ring.
     292 #
     293 # Index Key Description
     294 # 1        ISOTOPE
     295 # 2        103 < ATOMIC NO. < 256
     296 # 3        GROUP IVA,VA,VIA PERIODS 4-6 (Ge...)
     297 # 4        ACTINIDE
     298 # 5        GROUP IIIB,IVB (Sc...)
     299 # 6        LANTHANIDE
     300 # 7        GROUP VB,VIB,VIIB (V...)
     301 # 8        QAAA@1
     302 # 9        GROUP VIII (Fe...)
     303 # 10        GROUP IIA (ALKALINE EARTH)
     304 # 11        4M RING
     305 # 12        GROUP IB,IIB (Cu...)
     306 # 13        ON(C)C
     307 # 14        S-S
     308 # 15        OC(O)O
     309 # 16        QAA@1
     310 # 17        CTC
     311 # 18        GROUP IIIA (B...)
     312 # 19        7M RING
     313 # 20        SI
     314 # 21        C=C(Q)Q
     315 # 22        3M RING
     316 # 23        NC(O)O
     317 # 24        N-O
     318 # 25        NC(N)N
     319 # 26        C$=C($A)$A
     320 # 27        I
     321 # 28        QCH2Q
     322 # 29        P
     323 # 30        CQ(C)(C)A
     324 # 31        QX
     325 # 32        CSN
     326 # 33        NS
     327 # 34        CH2=A
     328 # 35        GROUP IA (ALKALI METAL)
     329 # 36        S HETEROCYCLE
     330 # 37        NC(O)N
     331 # 38        NC(C)N
     332 # 39        OS(O)O
     333 # 40        S-O
     334 # 41        CTN
     335 # 42        F
     336 # 43        QHAQH
     337 # 44        OTHER
     338 # 45        C=CN
     339 # 46        BR
     340 # 47        SAN
     341 # 48        OQ(O)O
     342 # 49        CHARGE
     343 # 50        C=C(C)C
     344 # 51        CSO
     345 # 52        NN
     346 # 53        QHAAAQH
     347 # 54        QHAAQH
     348 # 55        OSO
     349 # 56        ON(O)C
     350 # 57        O HETEROCYCLE
     351 # 58        QSQ
     352 # 59        Snot%A%A
     353 # 60        S=O
     354 # 61        AS(A)A
     355 # 62        A$A!A$A
     356 # 63        N=O
     357 # 64        A$A!S
     358 # 65        C%N
     359 # 66        CC(C)(C)A
     360 # 67        QS
     361 # 68        QHQH (&...)
     362 # 69        QQH
     363 # 70        QNQ
     364 # 71        NO
     365 # 72        OAAO
     366 # 73        S=A
     367 # 74        CH3ACH3
     368 # 75        A!N$A
     369 # 76        C=C(A)A
     370 # 77        NAN
     371 # 78        C=N
     372 # 79        NAAN
     373 # 80        NAAAN
     374 # 81        SA(A)A
     375 # 82        ACH2QH
     376 # 83         QAAAA@1
     377 # 84        NH2
     378 # 85        CN(C)C
     379 # 86        CH2QCH2
     380 # 87        X!A$A
     381 # 88        S
     382 # 89        OAAAO
     383 # 90        QHAACH2A
     384 # 91        QHAAACH2A
     385 # 92        OC(N)C
     386 # 93        QCH3
     387 # 94        QN
     388 # 95        NAAO
     389 # 96        5M RING
     390 # 97        NAAAO
     391 # 98        QAAAAA@1
     392 # 99        C=C
     393 # 100        ACH2N
     394 # 101        8M RING
     395 # 102        QO
     396 # 103        CL
     397 # 104        QHACH2A
     398 # 105        A$A($A)$A
     399 # 106        QA(Q)Q
     400 # 107        XA(A)A
     401 # 108        CH3AAACH2A
     402 # 109        ACH2O
     403 # 110        NCO
     404 # 111        NACH2A
     405 # 112        AA(A)(A)A
     406 # 113        Onot%A%A
     407 # 114        CH3CH2A
     408 # 115        CH3ACH2A
     409 # 116        CH3AACH2A
     410 # 117        NAO
     411 # 118        ACH2CH2A > 1
     412 # 119        N=A
     413 # 120        HETEROCYCLIC ATOM > 1 (&...)
     414 # 121        N HETEROCYCLE
     415 # 122        AN(A)A
     416 # 123        OCO
     417 # 124        QQ
     418 # 125        AROMATIC RING > 1
     419 # 126        A!O!A
     420 # 127        A$A!O > 1 (&...)
     421 # 128        ACH2AAACH2A
     422 # 129        ACH2AACH2A
     423 # 130        QQ > 1 (&...)
     424 # 131        QH > 1
     425 # 132        OACH2A
     426 # 133        A$A!N
     427 # 134        X (HALOGEN)
     428 # 135        Nnot%A%A
     429 # 136        O=A > 1
     430 # 137        HETEROCYCLE
     431 # 138        QCH2A > 1 (&...)
     432 # 139        OH
     433 # 140        O > 3 (&...)
     434 # 141        CH3 > 2 (&...)
     435 # 142        N > 1
     436 # 143        A$A!O
     437 # 144        Anot%A%Anot%A
     438 # 145        6M RING > 1
     439 # 146        O > 2
     440 # 147        ACH2CH2A
     441 # 148        AQ(A)A
     442 # 149        CH3 > 1
     443 # 150        A!A$A!A
     444 # 151        NH
     445 # 152        OC(C)C
     446 # 153        QCH2A
     447 # 154        C=O
     448 # 155        A!CH2!A
     449 # 156        NA(A)A
     450 # 157        C-O
     451 # 158        C-N
     452 # 159        O > 1
     453 # 160        CH3
     454 # 161        N
     455 # 162        AROMATIC
     456 # 163        6M RING
     457 # 164        O
     458 # 165        RING
     459 # 166         FRAGMENTS
     460 #
     461 sub _GenerateMACCS166Keys {
     462   my($This) = @_;
     463   my($KeyNum, $KeyIndex, $MethodName, $KeyValue, $SkipPosCheck);
     464
     465   $SkipPosCheck = 1;
     466
     467   # Generate and set key values...
     468   KEYNUM: for $KeyNum (1 .. 166) {
     469     $MethodName = "_Generate166KeySetKey${KeyNum}";
     470     $KeyValue = $This->$MethodName();
     471
     472     if (!$KeyValue) {
     473       next KEYNUM;
     474     }
     475     $KeyIndex = $KeyNum - 1;
     476     if ($This->{KeyBits}) {
     477       $This->{FingerprintsBitVector}->SetBit($KeyIndex, $SkipPosCheck);
     478     }
     479     else {
     480       $This->{FingerprintsVector}->SetValue($KeyIndex, $KeyValue, $SkipPosCheck);
     481     }
     482   }
     483
     484   # Add key labels for MACCSKeyCount...
     485   if (!$This->{KeyBits}) {
     486     $This->_SetMACCSKeyCountValueIDs();
     487   }
     488
     489   return $This;
     490 }
     491
     492 # Generate MDL MACCS 322 keys...
     493 #
     494 # MDL MACCS 322 key set is defined in tables 1, 2 and 3 by: Joseph L. Durant; Burton A. Leland;
     495 # Douglas R. Henry; James G. Nourse. Reoptimization of MDL Keys for Use in Drug Discovery [ Ref. 46 ].
     496 #
     497 # Atom symbols:
     498 #
     499 # A : Any valid perodic table element symbol
     500 # Q  : Hetro atoms; any non-C or non-H atom
     501 # X  : Others; other than H, C, N, O, Si, P, S, F, Cl, Br, I
     502 # Z is neither defined nor used
     503 #
     504 # Atom symbol, X, used for 322 keys [ Ref 46 ] doesn't refer to Halogens as it does for 166 keys. In
     505 # order to keep the definition of 322 keys consistent with the published definitions, the symbol X is
     506 # used to imply "others" atoms, but it's internally mapped to symbol X as defined for 166 keys
     507 # during the generation of key values.
     508 #
     509 # The keys include:
     510 #
     511 # o 26 atom properties of type P, as listed in Table 1
     512 # o 32 one-atom environments, as listed in Table 3
     513 # o 264 atom-bond-atom combinations listed in Table 4
     514 #
     515 # Total number of keys in three tables: 322
     516 #
     517 # Removal of two rare properties in Table 1 number 21 and 22 results in a 320 keyset.
     518 #
     519 # Atom properties-based keys (26):
     520 #
     521 # Index Description
     522 # 1     A(AAA) or AA(A)A - atom with at least three neighbors
     523 # 2     Q - heteroatom
     524 # 3     Anot%not-A - atom involved in one or more multiple bonds, not aromatic
     525 # 4     A(AAAA) or AA(A)(A)A - atom with at least four neighbors
     526 # 5     A(QQ) or QA(Q) - atom with at least two heteroatom neighbors
     527 # 6     A(QQQ) or QA(Q)Q - atom with at least three heteroatom neighbors
     528 # 7     QH - heteroatom with at least one hydrogen attached
     529 # 8     CH2(AA) or ACH2A - carbon with at least two single bonds and at least two hydrogens attached
     530 # 9     CH3(A) or ACH3 - carbon with at least one single bond and at least three hydrogens attached
     531 # 10    Halogen
     532 # 11    A(-A-A-A) or A-A(-A)-A - atom has at least three single bonds
     533 # 12    AAAAAA@1 > 2 - atom is in at least two different six-membered rings
     534 # 13    A($A$A$A) or A$A($A)$A - atom has more than two ring bonds
     535 # 14    A$A!A$A - atom is at a ring/chain boundary. When a comparison is done
     536 #       with another atom the path passes through the chain bond.
     537 # 15    Anot%A%Anot%A - atom is at an aromatic/nonaromatic boundary. When a
     538 #       comparison is done with another atom the path
     539 #       passes through the aromatic bond.
     540 # 16    A!A!A  - atom with more than one chain bond
     541 # 17    A!A$A!A - atom is at a ring/chain boundary. When a comparison is done
     542 #       with another atom the path passes through the ring bond.
     543 # 18    A%Anot%A%A - atom is at an aromatic/nonaromatic boundary. When a
     544 #       comparison is done with another atom the
     545 #       path passes through the nonaromatic bond.
     546 # 19    HETEROCYCLE - atom is a heteroatom in a ring.
     547 # 20    rare properties: atom with five or more neighbors, atom in
     548 #       four or more rings, or atom types other than
     549 #       H, C, N, O, S, F, Cl, Br, or I
     550 # 21    rare properties: atom has a charge, is an isotope, has two or
     551 #       more multiple bonds, or has a triple bond.
     552 # 22    N - nitrogen
     553 # 23    S - sulfur
     554 # 24    O - oxygen
     555 # 25    A(AA)A(A)A(AA) - atom has two neighbors, each with three or more neighbors
     556 #       (including the central atom).
     557 # 26    CHACH2 - atom has two hydrocarbon (CH2) neighbors
     558 #
     559 #
     560 # Atomic environments properties-based keys (32):
     561 #
     562 # Index Key Description
     563 # 27    C(CC)
     564 # 28    C(CCC)
     565 # 29    C(CN)
     566 # 30    C(CCN)
     567 # 31    C(NN)
     568 # 32    C(NNC)
     569 # 33    C(NNN)
     570 # 34    C(CO)
     571 # 35    C(CCO)
     572 # 36    C(NO)
     573 # 37    C(NCO)
     574 # 38    C(NNO)
     575 # 39    C(OO)
     576 # 40    C(COO)
     577 # 41    C(NOO)
     578 # 42    C(OOO)
     579 # 43    Q(CC)
     580 # 44    Q(CCC)
     581 # 45    Q(CN)
     582 # 46    Q(CCN)
     583 # 47    Q(NN)
     584 # 48    Q(CNN)
     585 # 49    Q(NNN)
     586 # 50    Q(CO)
     587 # 51    Q(CCO)
     588 # 52    Q(NO)
     589 # 53    Q(CNO)
     590 # 54    Q(NNO)
     591 # 55    Q(OO)
     592 # 56    Q(COO)
     593 # 57    Q(NOO)
     594 # 58    Q(OOO)
     595 #
     596 # Note: The first symbol is the central atom, with atoms bonded to the
     597 # central atom listed in parentheses. Q is any non-C, non-H atom. If
     598 # only two atoms are in parentheses, there is no implication concerning
     599 # the other atoms bonded to the central atom.
     600 #
     601 # Atom-Bond-Atom properties-based keys: (264)
     602 #
     603 # Index Key Description
     604 # 59    C-C
     605 # 60    C-N
     606 # 61    C-O
     607 # 62    C-S
     608 # 63    C-Cl
     609 # 64    C-P
     610 # 65    C-F
     611 # 66    C-Br
     612 # 67    C-Si
     613 # 68    C-I
     614 # 69    C-X
     615 # 70    N-N
     616 # 71    N-O
     617 # 72    N-S
     618 # 73    N-Cl
     619 # 74    N-P
     620 # 75    N-F
     621 # 76    N-Br
     622 # 77    N-Si
     623 # 78    N-I
     624 # 79    N-X
     625 # 80    O-O
     626 # 81    O-S
     627 # 82    O-Cl
     628 # 83    O-P
     629 # 84    O-F
     630 # 85    O-Br
     631 # 86    O-Si
     632 # 87    O-I
     633 # 88    O-X
     634 # 89    S-S
     635 # 90    S-Cl
     636 # 91    S-P
     637 # 92    S-F
     638 # 93    S-Br
     639 # 94    S-Si
     640 # 95    S-I
     641 # 96    S-X
     642 # 97    Cl-Cl
     643 # 98    Cl-P
     644 # 99    Cl-F
     645 # 100   Cl-Br
     646 # 101   Cl-Si
     647 # 102   Cl-I
     648 # 103   Cl-X
     649 # 104   P-P
     650 # 105   P-F
     651 # 106   P-Br
     652 # 107   P-Si
     653 # 108   P-I
     654 # 109   P-X
     655 # 110   F-F
     656 # 111   F-Br
     657 # 112   F-Si
     658 # 113   F-I
     659 # 114   F-X
     660 # 115   Br-Br
     661 # 116   Br-Si
     662 # 117   Br-I
     663 # 118   Br-X
     664 # 119   Si-Si
     665 # 120   Si-I
     666 # 121   Si-X
     667 # 122   I-I
     668 # 123   I-X
     669 # 124   X-X
     670 # 125   C=C
     671 # 126   C=N
     672 # 127   C=O
     673 # 128   C=S
     674 # 129   C=Cl
     675 # 130   C=P
     676 # 131   C=F
     677 # 132   C=Br
     678 # 133   C=Si
     679 # 134   C=I
     680 # 135   C=X
     681 # 136   N=N
     682 # 137   N=O
     683 # 138   N=S
     684 # 139   N=Cl
     685 # 140   N=P
     686 # 141   N=F
     687 # 142   N=Br
     688 # 143   N=Si
     689 # 144   N=I
     690 # 145   N=X
     691 # 146   O=O
     692 # 147   O=S
     693 # 148   O=Cl
     694 # 149   O=P
     695 # 150   O=F
     696 # 151   O=Br
     697 # 152   O=Si
     698 # 153   O=I
     699 # 154   O=X
     700 # 155   S=S
     701 # 156   S=Cl
     702 # 157   S=P
     703 # 158   S=F
     704 # 159   S=Br
     705 # 160   S=Si
     706 # 161   S=I
     707 # 162   S=X
     708 # 163   Cl=Cl
     709 # 164   Cl=P
     710 # 165   Cl=F
     711 # 166   Cl=Br
     712 # 167   Cl=Si
     713 # 168   Cl=I
     714 # 169   Cl=X
     715 # 170   P=P
     716 # 171   P=F
     717 # 172   P=Br
     718 # 173   P=Si
     719 # 174   P=I
     720 # 175   P=X
     721 # 176   F=F
     722 # 177   F=Br
     723 # 178   F=Si
     724 # 179   F=I
     725 # 180   F=X
     726 # 181   Br=Br
     727 # 182   Br=Si
     728 # 183   Br=I
     729 # 184   Br=X
     730 # 185   Si=Si
     731 # 186   Si=I
     732 # 187   Si=X
     733 # 188   I=I
     734 # 189   I=X
     735 # 190   X=X
     736 # 191   C#C
     737 # 192   C#N
     738 # 193   C#O
     739 # 194   C#S
     740 # 195   C#Cl
     741 # 196   C#P
     742 # 197   C#F
     743 # 198   C#Br
     744 # 199   C#Si
     745 # 200   C#I
     746 # 201   C#X
     747 # 202   N#N
     748 # 203   N#O
     749 # 204   N#S
     750 # 205   N#Cl
     751 # 206   N#P
     752 # 207   N#F
     753 # 208   N#Br
     754 # 209   N#Si
     755 # 210   N#I
     756 # 211   N#X
     757 # 212   O#O
     758 # 213   O#S
     759 # 214   O#Cl
     760 # 215   O#P
     761 # 216   O#F
     762 # 217   O#Br
     763 # 218   O#Si
     764 # 219   O#I
     765 # 220   O#X
     766 # 221   S#S
     767 # 222   S#Cl
     768 # 223   S#P
     769 # 224   S#F
     770 # 225   S#Br
     771 # 226   S#Si
     772 # 227   S#I
     773 # 228   S#X
     774 # 229   Cl#Cl
     775 # 230   Cl#P
     776 # 231   Cl#F
     777 # 232   Cl#Br
     778 # 233   Cl#Si
     779 # 234   Cl#I
     780 # 235   Cl#X
     781 # 236   P#P
     782 # 237   P#F
     783 # 238   P#Br
     784 # 239   P#Si
     785 # 240   P#I
     786 # 241   P#X
     787 # 242   F#F
     788 # 243   F#Br
     789 # 244   F#Si
     790 # 245   F#I
     791 # 246   F#X
     792 # 247   Br#Br
     793 # 248   Br#Si
     794 # 249   Br#I
     795 # 250   Br#X
     796 # 251   Si#Si
     797 # 252   Si#I
     798 # 253   Si#X
     799 # 254   I#I
     800 # 255   I#X
     801 # 256   X#X
     802 # 257   C$C
     803 # 258   C$N
     804 # 259   C$O
     805 # 260   C$S
     806 # 261   C$Cl
     807 # 262   C$P
     808 # 263   C$F
     809 # 264   C$Br
     810 # 265   C$Si
     811 # 266   C$I
     812 # 267   C$X
     813 # 268   N$N
     814 # 269   N$O
     815 # 270   N$S
     816 # 271   N$Cl
     817 # 272   N$P
     818 # 273   N$F
     819 # 274   N$Br
     820 # 275   N$Si
     821 # 276   N$I
     822 # 277   N$X
     823 # 278   O$O
     824 # 279   O$S
     825 # 280   O$Cl
     826 # 281   O$P
     827 # 282   O$F
     828 # 283   O$Br
     829 # 284   O$Si
     830 # 285   O$I
     831 # 286   O$X
     832 # 287   S$S
     833 # 288   S$Cl
     834 # 289   S$P
     835 # 290   S$F
     836 # 291   S$Br
     837 # 292   S$Si
     838 # 293   S$I
     839 # 294   S$X
     840 # 295   Cl$Cl
     841 # 296   Cl$P
     842 # 297   Cl$F
     843 # 298   Cl$Br
     844 # 299   Cl$Si
     845 # 300   Cl$I
     846 # 301   Cl$X
     847 # 302   P$P
     848 # 303   P$F
     849 # 304   P$Br
     850 # 305   P$Si
     851 # 306   P$I
     852 # 307   P$X
     853 # 308   F$F
     854 # 309   F$Br
     855 # 310   F$Si
     856 # 311   F$I
     857 # 312   F$X
     858 # 313   Br$Br
     859 # 314   Br$Si
     860 # 315   Br$I
     861 # 316   Br$X
     862 # 317   Si$Si
     863 # 318   Si$I
     864 # 319   Si$X
     865 # 320   I$I
     866 # 321   I$X
     867 # 322   X$X
     868 #
     869 # Note: Instead of using '%' as rind bond as mentioned in the article [ Ref. 46 ], MayaChemTools
     870 # used '$' as a symbol for ring bond to follow conventions used for MACCS 166 keys; the symbol '%'
     871 # is used to indicate an aromatic query bond.
     872 #
     873 sub _GenerateMACCS322Keys {
     874   my($This) = @_;
     875   my($KeyNum, $KeyIndex, $MethodName, $KeyValue, $SkipPosCheck);
     876
     877   $SkipPosCheck = 1;
     878
     879   # Generate and set key values...
     880   KEYNUM: for $KeyNum (1 .. 322) {
     881     $MethodName = "_Generate322KeySetKey${KeyNum}";
     882     $KeyValue = $This->$MethodName();
     883
     884     if (!$KeyValue) {
     885       next KEYNUM;
     886     }
     887     $KeyIndex = $KeyNum - 1;
     888     if ($This->{KeyBits}) {
     889       $This->{FingerprintsBitVector}->SetBit($KeyIndex, $SkipPosCheck);
     890     }
     891     else {
     892       $This->{FingerprintsVector}->SetValue($KeyIndex, $KeyValue, $SkipPosCheck);
     893     }
     894   }
     895
     896   # Add key labels for MACCSKeyCount...
     897   if (!$This->{KeyBits}) {
     898     $This->_SetMACCSKeyCountValueIDs();
     899   }
     900   return $This;
     901 }
     902
     903 # Set MACCS key count value IDs for fingerprint vector. The value IDs labels format
     904 # is: Key<KeyNum>.
     905 #
     906 # By default, no value IDs are set for fingerprint vector values.
     907 #
     908 sub _SetMACCSKeyCountValueIDs {
     909   my($This) = @_;
     910
     911   if (!$This->{FingerprintsVector}) {
     912     return;
     913   }
     914   my(@ValueIDs);
     915
     916   @ValueIDs = map { "Key$_"; } (1 .. $This->{Size});
     917   $This->{FingerprintsVector}->AddValueIDs(\@ValueIDs);
     918
     919   return $This;
     920 }
     921
     922 ##################################
     923 #
     924 #  Implementation of MDL MACCS 166 keys...
     925 #
     926 ##################################
     927
     928 # Generate key 1 value as 1/0 indicating its presence/absence or count of its
     929 # presence in a molecule.
     930 #
     931 # Key 1 description: ISOTOPE
     932 #
     933 sub _Generate166KeySetKey1 {
     934   my($This) = @_;
     935   my($Atom, $KeyValue);
     936
     937   $KeyValue = 0;
     938   ATOM: for $Atom (@{$This->{Atoms}}) {
     939     if ($Atom->IsIsotope()) {
     940       if ($This->{KeyBits}) {
     941         $KeyValue = 1;
     942         last ATOM;
     943       }
     944       $KeyValue++;
     945     }
     946   }
     947   return $KeyValue;
     948 }
     949
     950 # Generate key 2 value as 1/0 indicating its presence/absence or count of its
     951 # presence in a molecule.
     952 #
     953 # Key 2 description: 103 < ATOMIC NO. < 256
     954 #
     955 sub _Generate166KeySetKey2 {
     956   my($This) = @_;
     957   my($Atom, $AtomicNumber, $KeyValue);
     958
     959   $KeyValue = 0;
     960   ATOM: for $Atom (@{$This->{Atoms}}) {
     961     $AtomicNumber = $Atom->GetAtomicNumber();
     962     if ($AtomicNumber > 103 && $AtomicNumber < 256) {
     963       if ($This->{KeyBits}) {
     964         $KeyValue = 1;
     965         last ATOM;
     966       }
     967       $KeyValue++;
     968     }
     969   }
     970   return $KeyValue;
     971 }
     972
     973 # Generate key 3 value as 1/0 indicating its presence/absence or count of its
     974 # presence in a molecule.
     975 #
     976 # Key 3 description: GROUP IVA,VA,VIA (GroupNumber: 14, 15, 16) PERIODS 4-6 (Ge...)
     977 #
     978 sub _Generate166KeySetKey3 {
     979   my($This) = @_;
     980   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber, $PeriodNumber);
     981
     982   $KeyValue = 0;
     983   ATOM: for $Atom (@{$This->{Atoms}}) {
     984     $AtomicNumber = $Atom->GetAtomicNumber();
     985     if ($AtomicNumber) {
     986       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
     987       $PeriodNumber = PeriodicTable::GetElementPeriodNumber($AtomicNumber);
     988       if ($PeriodNumber =~ /^(4|5|6)$/ && $GroupNumber =~ /^(14|15|16)$/) {
     989         if ($This->{KeyBits}) {
     990           $KeyValue = 1;
     991           last ATOM;
     992         }
     993         $KeyValue++;
     994       }
     995     }
     996   }
     997   return $KeyValue;
     998 }
     999
    1000 # Generate key 4 value as 1/0 indicating its presence/absence or count of its
    1001 # presence in a molecule.
    1002 #
    1003 # Key 4 description: ACTINIDE
    1004 #
    1005 sub _Generate166KeySetKey4 {
    1006   my($This) = @_;
    1007   my($Atom, $AtomicNumber, $KeyValue);
    1008
    1009   $KeyValue = 0;
    1010   ATOM: for $Atom (@{$This->{Atoms}}) {
    1011     $AtomicNumber = $Atom->GetAtomicNumber();
    1012     if ($AtomicNumber >= 89 && $AtomicNumber <= 103) {
    1013       if ($This->{KeyBits}) {
    1014         $KeyValue = 1;
    1015         last ATOM;
    1016       }
    1017       $KeyValue++;
    1018     }
    1019   }
    1020   return $KeyValue;
    1021 }
    1022
    1023 # Generate key 5 value as 1/0 indicating its presence/absence or count of its
    1024 # presence in a molecule.
    1025 #
    1026 # Key 5 description: GROUP IIIB,IVB (Sc...)
    1027 #
    1028 sub _Generate166KeySetKey5 {
    1029   my($This) = @_;
    1030   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1031
    1032   $KeyValue = 0;
    1033   ATOM: for $Atom (@{$This->{Atoms}}) {
    1034     $AtomicNumber = $Atom->GetAtomicNumber();
    1035     if ($AtomicNumber) {
    1036       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1037       if ($GroupNumber =~ /^(3|4)$/) {
    1038         if ($This->{KeyBits}) {
    1039           $KeyValue = 1;
    1040           last ATOM;
    1041         }
    1042         $KeyValue++;
    1043       }
    1044     }
    1045   }
    1046   return $KeyValue;
    1047 }
    1048
    1049 # Generate key 6 value as 1/0 indicating its presence/absence or count of its
    1050 # presence in a molecule.
    1051 #
    1052 # Key 6 description: LANTHANIDE
    1053 #
    1054 sub _Generate166KeySetKey6 {
    1055   my($This) = @_;
    1056   my($Atom, $AtomicNumber, $KeyValue);
    1057
    1058   $KeyValue = 0;
    1059   ATOM: for $Atom (@{$This->{Atoms}}) {
    1060     $AtomicNumber = $Atom->GetAtomicNumber();
    1061     if ($AtomicNumber >= 57 && $AtomicNumber <= 71) {
    1062       if ($This->{KeyBits}) {
    1063         $KeyValue = 1;
    1064         last ATOM;
    1065       }
    1066       $KeyValue++;
    1067     }
    1068   }
    1069   return $KeyValue;
    1070 }
    1071
    1072 # Generate key 7 value as 1/0 indicating its presence/absence or count of its
    1073 # presence in a molecule.
    1074 #
    1075 # Key 7 description: GROUP VB,VIB,VIIB (V...)
    1076 #
    1077 sub _Generate166KeySetKey7 {
    1078   my($This) = @_;
    1079   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1080
    1081   $KeyValue = 0;
    1082   ATOM: for $Atom (@{$This->{Atoms}}) {
    1083     $AtomicNumber = $Atom->GetAtomicNumber();
    1084     if ($AtomicNumber) {
    1085       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1086       if ($GroupNumber =~ /^(5|6|7)$/) {
    1087         if ($This->{KeyBits}) {
    1088           $KeyValue = 1;
    1089           last ATOM;
    1090         }
    1091         $KeyValue++;
    1092       }
    1093     }
    1094   }
    1095   return $KeyValue;
    1096 }
    1097
    1098 # Generate key 8 value as 1/0 indicating its presence/absence or count of its
    1099 # presence in a molecule.
    1100 #
    1101 # Key 8 description: QAAA@1
    1102 #
    1103 sub _Generate166KeySetKey8 {
    1104   my($This) = @_;
    1105   my($Atom, $KeyValue, $RingSize);
    1106
    1107   $RingSize = 4;
    1108   $KeyValue = 0;
    1109   ATOM: for $Atom (@{$This->{Atoms}}) {
    1110     if ($This->_IsHeteroAtom($Atom) && $Atom->IsInRingOfSize($RingSize)) {
    1111       if ($This->{KeyBits}) {
    1112         $KeyValue = 1;
    1113         last ATOM;
    1114       }
    1115       $KeyValue++;
    1116     }
    1117   }
    1118   return $KeyValue;
    1119 }
    1120
    1121 # Generate key 9 value as 1/0 indicating its presence/absence or count of its
    1122 # presence in a molecule.
    1123 #
    1124 # Key 9 description: GROUP VIII (Fe...)
    1125 #
    1126 sub _Generate166KeySetKey9 {
    1127   my($This) = @_;
    1128   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1129
    1130   $KeyValue = 0;
    1131   ATOM: for $Atom (@{$This->{Atoms}}) {
    1132     $AtomicNumber = $Atom->GetAtomicNumber();
    1133     if ($AtomicNumber) {
    1134       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1135       if ($GroupNumber =~ /^(8|9|10)$/) {
    1136         if ($This->{KeyBits}) {
    1137           $KeyValue = 1;
    1138           last ATOM;
    1139         }
    1140         $KeyValue++;
    1141       }
    1142     }
    1143   }
    1144   return $KeyValue;
    1145 }
    1146
    1147 # Generate key 10 value as 1/0 indicating its presence/absence or count of its
    1148 # presence in a molecule.
    1149 #
    1150 # Key 10 description: GROUP IIA (ALKALINE EARTH)
    1151 #
    1152 sub _Generate166KeySetKey10 {
    1153   my($This) = @_;
    1154   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1155
    1156   $KeyValue = 0;
    1157   ATOM: for $Atom (@{$This->{Atoms}}) {
    1158     $AtomicNumber = $Atom->GetAtomicNumber();
    1159     if ($AtomicNumber) {
    1160       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1161       if ($GroupNumber =~ /^2$/) {
    1162         if ($This->{KeyBits}) {
    1163           $KeyValue = 1;
    1164           last ATOM;
    1165         }
    1166         $KeyValue++;
    1167       }
    1168     }
    1169   }
    1170   return $KeyValue;
    1171 }
    1172
    1173 # Generate key 11 value as 1/0 indicating its presence/absence or count of its
    1174 # presence in a molecule.
    1175 #
    1176 # Key 11 description: 4M RING
    1177 #
    1178 sub _Generate166KeySetKey11 {
    1179   my($This) = @_;
    1180   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    1181
    1182   $RingSize = 4;
    1183   $Molecule = $This->GetMolecule();
    1184   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    1185
    1186   if ($This->{KeyBits}) {
    1187     $KeyValue = $NumOfRings ? 1 : 0;
    1188   }
    1189   else {
    1190     $KeyValue = $NumOfRings;
    1191   }
    1192   return $KeyValue;
    1193 }
    1194
    1195 # Generate key 12 value as 1/0 indicating its presence/absence or count of its
    1196 # presence in a molecule.
    1197 #
    1198 # Key 12 description: GROUP IB,IIB (Cu...)
    1199 #
    1200 sub _Generate166KeySetKey12 {
    1201   my($This) = @_;
    1202   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1203
    1204   $KeyValue = 0;
    1205   ATOM: for $Atom (@{$This->{Atoms}}) {
    1206     $AtomicNumber = $Atom->GetAtomicNumber();
    1207     if ($AtomicNumber) {
    1208       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1209       if ($GroupNumber =~ /^(11|12)$/) {
    1210         if ($This->{KeyBits}) {
    1211           $KeyValue = 1;
    1212           last ATOM;
    1213         }
    1214         $KeyValue++;
    1215       }
    1216     }
    1217   }
    1218   return $KeyValue;
    1219 }
    1220
    1221 # Generate key 13 value as 1/0 indicating its presence/absence or count of its
    1222 # presence in a molecule.
    1223 #
    1224 # Key 13 description: ON(C)C
    1225 #
    1226 sub _Generate166KeySetKey13 {
    1227   my($This) = @_;
    1228   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1229
    1230   $CentralAtomSymbol = 'N';
    1231   @NbrAtomSymbols = ('O', 'C', 'C');
    1232   @NbrBondSymbols = (undef, undef, undef);
    1233
    1234   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1235 }
    1236
    1237 # Generate key 14 value as 1/0 indicating its presence/absence or count of its
    1238 # presence in a molecule.
    1239 #
    1240 # Key 14 description: S-S
    1241 #
    1242 sub _Generate166KeySetKey14 {
    1243   my($This) = @_;
    1244   my($BondOrder) = 1;
    1245
    1246   return $This->_DetectBondKeys('S', 'S', $BondOrder);
    1247 }
    1248
    1249 # Generate key 15 value as 1/0 indicating its presence/absence or count of its
    1250 # presence in a molecule.
    1251 #
    1252 # Key 15 description: OC(O)O
    1253 #
    1254 sub _Generate166KeySetKey15 {
    1255   my($This) = @_;
    1256   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1257
    1258   $CentralAtomSymbol = 'C';
    1259   @NbrAtomSymbols = ('O', 'O', 'O');
    1260   @NbrBondSymbols = (undef, undef, undef);
    1261
    1262   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1263 }
    1264
    1265 # Generate key 16 value as 1/0 indicating its presence/absence or count of its
    1266 # presence in a molecule.
    1267 #
    1268 # Key 16 description: QAA@1
    1269 #
    1270 sub _Generate166KeySetKey16 {
    1271   my($This) = @_;
    1272   my($Atom, $KeyValue, $RingSize);
    1273
    1274   $RingSize = 3;
    1275   $KeyValue = 0;
    1276   ATOM: for $Atom (@{$This->{Atoms}}) {
    1277     if ($This->_IsHeteroAtom($Atom) && $Atom->IsInRingOfSize($RingSize)) {
    1278       if ($This->{KeyBits}) {
    1279         $KeyValue = 1;
    1280         last ATOM;
    1281       }
    1282       $KeyValue++;
    1283     }
    1284   }
    1285   return $KeyValue;
    1286 }
    1287
    1288 # Generate key 17 value as 1/0 indicating its presence/absence or count of its
    1289 # presence in a molecule.
    1290 #
    1291 # Key 17 description: CTC
    1292 #
    1293 sub _Generate166KeySetKey17 {
    1294   my($This) = @_;
    1295   my($BondOrder) = 3;
    1296
    1297   return $This->_DetectBondKeys('C', 'C', $BondOrder);
    1298 }
    1299
    1300 # Generate key 18 value as 1/0 indicating its presence/absence or count of its
    1301 # presence in a molecule.
    1302 #
    1303 # Key 18 description: GROUP IIIA (B...)
    1304 #
    1305 sub _Generate166KeySetKey18 {
    1306   my($This) = @_;
    1307   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1308
    1309   $KeyValue = 0;
    1310   ATOM: for $Atom (@{$This->{Atoms}}) {
    1311     $AtomicNumber = $Atom->GetAtomicNumber();
    1312     if ($AtomicNumber) {
    1313       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1314       if ($GroupNumber =~ /^13$/) {
    1315         if ($This->{KeyBits}) {
    1316           $KeyValue = 1;
    1317           last ATOM;
    1318         }
    1319         $KeyValue++;
    1320       }
    1321     }
    1322   }
    1323   return $KeyValue;
    1324 }
    1325
    1326 # Generate key 19 value as 1/0 indicating its presence/absence or count of its
    1327 # presence in a molecule.
    1328 #
    1329 # Key 19 description: 7M RING
    1330 #
    1331 sub _Generate166KeySetKey19 {
    1332   my($This) = @_;
    1333   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    1334
    1335   $RingSize = 7;
    1336   $Molecule = $This->GetMolecule();
    1337   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    1338
    1339   $KeyValue = 0;
    1340   if ($NumOfRings) {
    1341     $KeyValue = ($This->{KeyBits}) ? 1 : $NumOfRings;
    1342   }
    1343   return $KeyValue;
    1344 }
    1345
    1346 # Generate key 20 value as 1/0 indicating its presence/absence or count of its
    1347 # presence in a molecule.
    1348 #
    1349 # Key 20 description: SI
    1350 #
    1351 sub _Generate166KeySetKey20 {
    1352   my($This) = @_;
    1353
    1354   return $This->_DetectAtomKeys('Si');
    1355 }
    1356
    1357 # Generate key 21 value as 1/0 indicating its presence/absence or count of its
    1358 # presence in a molecule.
    1359 #
    1360 # Key 21 description: C=C(Q)Q
    1361 #
    1362 sub _Generate166KeySetKey21 {
    1363   my($This) = @_;
    1364   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1365
    1366   $CentralAtomSymbol = 'C';
    1367   @NbrAtomSymbols = ('C', 'Q', 'Q');
    1368   @NbrBondSymbols = ('=', undef, undef);
    1369
    1370   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1371 }
    1372
    1373 # Generate key 22 value as 1/0 indicating its presence/absence or count of its
    1374 # presence in a molecule.
    1375 #
    1376 # Key 22 description: 3M RING
    1377 #
    1378 sub _Generate166KeySetKey22 {
    1379   my($This) = @_;
    1380   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    1381
    1382   $RingSize = 3;
    1383   $Molecule = $This->GetMolecule();
    1384   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    1385
    1386   if ($This->{KeyBits}) {
    1387     $KeyValue = $NumOfRings ? 1 : 0;
    1388   }
    1389   else {
    1390     $KeyValue = $NumOfRings;
    1391   }
    1392   return $KeyValue;
    1393 }
    1394
    1395 # Generate key 23 value as 1/0 indicating its presence/absence or count of its
    1396 # presence in a molecule.
    1397 #
    1398 # Key 23 description: NC(O)O
    1399 #
    1400 sub _Generate166KeySetKey23 {
    1401   my($This) = @_;
    1402   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1403
    1404   $CentralAtomSymbol = 'C';
    1405   @NbrAtomSymbols = ('N', 'O', 'O');
    1406   @NbrBondSymbols = (undef, undef, undef);
    1407
    1408   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1409 }
    1410
    1411 # Generate key 24 value as 1/0 indicating its presence/absence or count of its
    1412 # presence in a molecule.
    1413 #
    1414 # Key 24 description: N-O
    1415 #
    1416 sub _Generate166KeySetKey24 {
    1417   my($This) = @_;
    1418   my($BondOrder) = 1;
    1419
    1420   return $This->_DetectBondKeys('N', 'O', $BondOrder);
    1421 }
    1422
    1423 # Generate key 25 value as 1/0 indicating its presence/absence or count of its
    1424 # presence in a molecule.
    1425 #
    1426 # Key 25 description: NC(N)N
    1427 #
    1428 sub _Generate166KeySetKey25 {
    1429   my($This) = @_;
    1430   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1431
    1432   $CentralAtomSymbol = 'C';
    1433   @NbrAtomSymbols = ('N', 'N', 'N');
    1434   @NbrBondSymbols = (undef, undef, undef);
    1435
    1436   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1437 }
    1438
    1439 # Generate key 26 value as 1/0 indicating its presence/absence or count of its
    1440 # presence in a molecule.
    1441 #
    1442 # Key 26 description: C$=C($A)$A
    1443 #
    1444 sub _Generate166KeySetKey26 {
    1445   my($This) = @_;
    1446   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1447
    1448   $CentralAtomSymbol = 'C';
    1449   @NbrAtomSymbols = ('C', 'A', 'A');
    1450   @NbrBondSymbols = ('$=', '$', '$');
    1451
    1452   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1453 }
    1454
    1455 # Generate key 27 value as 1/0 indicating its presence/absence or count of its
    1456 # presence in a molecule.
    1457 #
    1458 # Key 27 description: I
    1459 #
    1460 sub _Generate166KeySetKey27 {
    1461   my($This) = @_;
    1462
    1463   return $This->_DetectAtomKeys('I');
    1464 }
    1465
    1466 # Generate key 28 value as 1/0 indicating its presence/absence or count of its
    1467 # presence in a molecule.
    1468 #
    1469 # Key 28 description: QCH2Q
    1470 #
    1471 sub _Generate166KeySetKey28 {
    1472   my($This) = @_;
    1473   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    1474
    1475   $CentralAtomSymbol = 'C';
    1476   @NbrAtomSymbols = ('Q', 'Q');
    1477   @NbrBondSymbols = (undef, undef);
    1478   $MinKeyCount = undef;
    1479   $CentralAtomMinHydrogenCount = 2;
    1480
    1481   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    1482 }
    1483
    1484 # Generate key 29 value as 1/0 indicating its presence/absence or count of its
    1485 # presence in a molecule.
    1486 #
    1487 # Key 29 description: P
    1488 #
    1489 sub _Generate166KeySetKey29 {
    1490   my($This) = @_;
    1491
    1492   return $This->_DetectAtomKeys('P');
    1493 }
    1494
    1495 # Generate key 30 value as 1/0 indicating its presence/absence or count of its
    1496 # presence in a molecule.
    1497 #
    1498 # Key 30 description: CQ(C)(C)A
    1499 #
    1500 sub _Generate166KeySetKey30 {
    1501   my($This) = @_;
    1502   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1503
    1504   $CentralAtomSymbol = 'Q';
    1505   @NbrAtomSymbols = ('C', 'C', 'C', 'A');
    1506   @NbrBondSymbols = (undef, undef, undef, undef);
    1507
    1508   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1509 }
    1510
    1511 # Generate key 31 value as 1/0 indicating its presence/absence or count of its
    1512 # presence in a molecule.
    1513 #
    1514 # Key 31 description: QX
    1515 #
    1516 sub _Generate166KeySetKey31 {
    1517   my($This) = @_;
    1518
    1519   return $This->_DetectBondKeys('Q', 'X');
    1520 }
    1521
    1522 # Generate key 32 value as 1/0 indicating its presence/absence or count of its
    1523 # presence in a molecule.
    1524 #
    1525 # Key 32 description: CSN
    1526 #
    1527 sub _Generate166KeySetKey32 {
    1528   my($This) = @_;
    1529   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1530
    1531   $CentralAtomSymbol = 'S';
    1532   @NbrAtomSymbols = ('C', 'N');
    1533   @NbrBondSymbols = (undef, undef);
    1534
    1535   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1536 }
    1537
    1538 # Generate key 33 value as 1/0 indicating its presence/absence or count of its
    1539 # presence in a molecule.
    1540 #
    1541 # Key 33 description: NS
    1542 #
    1543 sub _Generate166KeySetKey33 {
    1544   my($This) = @_;
    1545
    1546   return $This->_DetectBondKeys('N', 'S');
    1547 }
    1548
    1549 # Generate key 34 value as 1/0 indicating its presence/absence or count of its
    1550 # presence in a molecule.
    1551 #
    1552 # Key 34 description: CH2=A
    1553 #
    1554 sub _Generate166KeySetKey34 {
    1555   my($This) = @_;
    1556   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    1557
    1558   $CentralAtomSymbol = 'C';
    1559   @NbrAtomSymbols = ('A');
    1560   @NbrBondSymbols = ('=');
    1561   $MinKeyCount = undef;
    1562   $CentralAtomMinHydrogenCount = 2;
    1563
    1564   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    1565 }
    1566
    1567 # Generate key 35 value as 1/0 indicating its presence/absence or count of its
    1568 # presence in a molecule.
    1569 #
    1570 # Key 35 description: GROUP IA (ALKALI METAL)
    1571 #
    1572 sub _Generate166KeySetKey35 {
    1573   my($This) = @_;
    1574   my($Atom, $KeyValue, $AtomicNumber, $GroupNumber);
    1575
    1576   $KeyValue = 0;
    1577   ATOM: for $Atom (@{$This->{Atoms}}) {
    1578     $AtomicNumber = $Atom->GetAtomicNumber();
    1579     if ($AtomicNumber) {
    1580       $GroupNumber = PeriodicTable::GetElementGroupNumber($AtomicNumber);
    1581       if ($GroupNumber =~ /^1$/) {
    1582         if ($This->{KeyBits}) {
    1583           $KeyValue = 1;
    1584           last ATOM;
    1585         }
    1586         $KeyValue++;
    1587       }
    1588     }
    1589   }
    1590   return $KeyValue;
    1591 }
    1592
    1593 # Generate key 36 value as 1/0 indicating its presence/absence or count of its
    1594 # presence in a molecule.
    1595 #
    1596 # Key 36 description: S HETEROCYCLE
    1597 #
    1598 sub _Generate166KeySetKey36 {
    1599   my($This) = @_;
    1600   my($MinKeyCount, $IsInRing) = (1, 1);
    1601
    1602   return $This->_DetectAtomKeys('S', $MinKeyCount, $IsInRing);
    1603 }
    1604
    1605 # Generate key 37 value as 1/0 indicating its presence/absence or count of its
    1606 # presence in a molecule.
    1607 #
    1608 # Key 37 description: NC(O)N
    1609 #
    1610 sub _Generate166KeySetKey37 {
    1611   my($This) = @_;
    1612   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1613
    1614   $CentralAtomSymbol = 'C';
    1615   @NbrAtomSymbols = ('N', 'O', 'N');
    1616   @NbrBondSymbols = (undef, undef, undef);
    1617
    1618   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1619 }
    1620
    1621 # Generate key 38 value as 1/0 indicating its presence/absence or count of its
    1622 # presence in a molecule.
    1623 #
    1624 # Key 38 description: NC(C)N
    1625 #
    1626 sub _Generate166KeySetKey38 {
    1627   my($This) = @_;
    1628   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1629
    1630   $CentralAtomSymbol = 'C';
    1631   @NbrAtomSymbols = ('N', 'C', 'N');
    1632   @NbrBondSymbols = (undef, undef, undef);
    1633
    1634   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1635 }
    1636
    1637 # Generate key 39 value as 1/0 indicating its presence/absence or count of its
    1638 # presence in a molecule.
    1639 #
    1640 # Key 39 description: OS(O)O
    1641 #
    1642 sub _Generate166KeySetKey39 {
    1643   my($This) = @_;
    1644   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1645
    1646   $CentralAtomSymbol = 'S';
    1647   @NbrAtomSymbols = ('O', 'O', 'O');
    1648   @NbrBondSymbols = (undef, undef, undef);
    1649
    1650   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1651 }
    1652
    1653 # Generate key 40 value as 1/0 indicating its presence/absence or count of its
    1654 # presence in a molecule.
    1655 #
    1656 # Key 40 description: S-O
    1657 #
    1658 sub _Generate166KeySetKey40 {
    1659   my($This) = @_;
    1660   my($BondOrder) = 1;
    1661
    1662   return $This->_DetectBondKeys('S', 'O', $BondOrder);
    1663 }
    1664
    1665 # Generate key 41 value as 1/0 indicating its presence/absence or count of its
    1666 # presence in a molecule.
    1667 #
    1668 # Key 41 description: CTN
    1669 #
    1670 sub _Generate166KeySetKey41 {
    1671   my($This) = @_;
    1672   my($BondOrder) = 3;
    1673
    1674   return $This->_DetectBondKeys('C', 'N', $BondOrder);
    1675 }
    1676
    1677 # Generate key 42 value as 1/0 indicating its presence/absence or count of its
    1678 # presence in a molecule.
    1679 #
    1680 # Key 42 description: F
    1681 #
    1682 sub _Generate166KeySetKey42 {
    1683   my($This) = @_;
    1684
    1685   return $This->_DetectAtomKeys('F');
    1686 }
    1687
    1688 # Generate key 43 value as 1/0 indicating its presence/absence or count of its
    1689 # presence in a molecule.
    1690 #
    1691 # Key 43 description: QHAQH
    1692 #
    1693 sub _Generate166KeySetKey43 {
    1694   my($This) = @_;
    1695   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    1696
    1697   $CentralAtomSymbol = 'A';
    1698   $CentralAtomMinHydrogenCount = undef;
    1699
    1700   @NbrAtomSymbols = ('Q', 'Q');
    1701   @NbrBondSymbols = (undef, undef);
    1702   @NbrAtomMinHydrogenCount = (1, 1);
    1703
    1704   $MinKeyCount = undef;
    1705
    1706   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    1707 }
    1708
    1709 # Generate key 44 value as 1/0 indicating its presence/absence or count of its
    1710 # presence in a molecule.
    1711 #
    1712 # Key 44 description: OTHER
    1713 #
    1714 sub _Generate166KeySetKey44 {
    1715   my($This) = @_;
    1716
    1717   return $This->_DetectAtomKeys('Z');
    1718 }
    1719
    1720 # Generate key 45 value as 1/0 indicating its presence/absence or count of its
    1721 # presence in a molecule.
    1722 #
    1723 # Key 45 description: C=CN
    1724 #
    1725 sub _Generate166KeySetKey45 {
    1726   my($This) = @_;
    1727   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1728
    1729   $CentralAtomSymbol = 'C';
    1730   @NbrAtomSymbols = ('C', 'N');
    1731   @NbrBondSymbols = ('=', undef);
    1732
    1733   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1734 }
    1735
    1736 # Generate key 46 value as 1/0 indicating its presence/absence or count of its
    1737 # presence in a molecule.
    1738 #
    1739 # Key 46 description: BR
    1740 #
    1741 sub _Generate166KeySetKey46 {
    1742   my($This) = @_;
    1743
    1744   return $This->_DetectAtomKeys('Br');
    1745 }
    1746
    1747 # Generate key 47 value as 1/0 indicating its presence/absence or count of its
    1748 # presence in a molecule.
    1749 #
    1750 # Key 47 description: SAN
    1751 #
    1752 sub _Generate166KeySetKey47 {
    1753   my($This) = @_;
    1754   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1755
    1756   $CentralAtomSymbol = 'A';
    1757   @NbrAtomSymbols = ('S', 'N');
    1758   @NbrBondSymbols = (undef, undef);
    1759
    1760   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1761 }
    1762
    1763 # Generate key 48 value as 1/0 indicating its presence/absence or count of its
    1764 # presence in a molecule.
    1765 #
    1766 # Key 48 description: OQ(O)O
    1767 #
    1768 sub _Generate166KeySetKey48 {
    1769   my($This) = @_;
    1770   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1771
    1772   $CentralAtomSymbol = 'Q';
    1773   @NbrAtomSymbols = ('O', 'O', 'O');
    1774   @NbrBondSymbols = (undef, undef, undef);
    1775
    1776   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1777 }
    1778
    1779 # Generate key 49 value as 1/0 indicating its presence/absence or count of its
    1780 # presence in a molecule.
    1781 #
    1782 # Key 49 description: CHARGE
    1783 #
    1784 sub _Generate166KeySetKey49 {
    1785   my($This) = @_;
    1786   my($Molecule, $KeyValue);
    1787
    1788   $Molecule = $This->GetMolecule();
    1789   $KeyValue = $Molecule->GetFormalCharge() ? 1 : 0;
    1790
    1791   return $KeyValue;
    1792 }
    1793
    1794 # Generate key 50 value as 1/0 indicating its presence/absence or count of its
    1795 # presence in a molecule.
    1796 #
    1797 # Key 50 description: C=C(C)C
    1798 #
    1799 sub _Generate166KeySetKey50 {
    1800   my($This) = @_;
    1801   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1802
    1803   $CentralAtomSymbol = 'C';
    1804   @NbrAtomSymbols = ('C', 'C', 'C');
    1805   @NbrBondSymbols = ('=', undef, undef);
    1806
    1807   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1808 }
    1809
    1810 # Generate key 51 value as 1/0 indicating its presence/absence or count of its
    1811 # presence in a molecule.
    1812 #
    1813 # Key 51 description: CSO
    1814 #
    1815 sub _Generate166KeySetKey51 {
    1816   my($This) = @_;
    1817   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1818
    1819   $CentralAtomSymbol = 'S';
    1820   @NbrAtomSymbols = ('C', 'O');
    1821   @NbrBondSymbols = (undef, undef);
    1822
    1823   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1824 }
    1825
    1826 # Generate key 52 value as 1/0 indicating its presence/absence or count of its
    1827 # presence in a molecule.
    1828 #
    1829 # Key 52 description: NN
    1830 #
    1831 sub _Generate166KeySetKey52 {
    1832   my($This) = @_;
    1833
    1834   return $This->_DetectBondKeys('N', 'N');
    1835 }
    1836
    1837 # Generate key 53 value as 1/0 indicating its presence/absence or count of its
    1838 # presence in a molecule.
    1839 #
    1840 # Key 53 description: QHAAAQH
    1841 #
    1842 sub _Generate166KeySetKey53 {
    1843   my($This) = @_;
    1844   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    1845
    1846   @CentralAtomsSymbols = ('Q', 'A', 'A', 'A', 'Q');
    1847   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    1848   @CentralAtomsMinHydrogenCount = (1, undef, undef, undef, 1);
    1849
    1850   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    1851 }
    1852
    1853 # Generate key 54 value as 1/0 indicating its presence/absence or count of its
    1854 # presence in a molecule.
    1855 #
    1856 # Key 54 description: QHAAQH
    1857 #
    1858 sub _Generate166KeySetKey54 {
    1859   my($This) = @_;
    1860   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    1861
    1862   @CentralAtomsSymbols = ('Q', 'A', 'A', 'Q');
    1863   @CentralAtomsBondSymbols = (undef, undef, undef);
    1864   @CentralAtomsMinHydrogenCount = (1, undef, undef, 1);
    1865
    1866   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    1867 }
    1868
    1869 # Generate key 55 value as 1/0 indicating its presence/absence or count of its
    1870 # presence in a molecule.
    1871 #
    1872 # Key 55 description: OSO
    1873 #
    1874 sub _Generate166KeySetKey55 {
    1875   my($This) = @_;
    1876   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1877
    1878   $CentralAtomSymbol = 'S';
    1879   @NbrAtomSymbols = ('O', 'O');
    1880   @NbrBondSymbols = (undef, undef);
    1881
    1882   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1883 }
    1884
    1885 # Generate key 56 value as 1/0 indicating its presence/absence or count of its
    1886 # presence in a molecule.
    1887 #
    1888 # Key 56 description: ON(O)C
    1889 #
    1890 sub _Generate166KeySetKey56 {
    1891   my($This) = @_;
    1892   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1893
    1894   $CentralAtomSymbol = 'N';
    1895   @NbrAtomSymbols = ('O', 'O', 'C');
    1896   @NbrBondSymbols = (undef, undef, undef);
    1897
    1898   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1899 }
    1900
    1901 # Generate key 57 value as 1/0 indicating its presence/absence or count of its
    1902 # presence in a molecule.
    1903 #
    1904 # Key 57 description: O HETEROCYCLE
    1905 #
    1906 sub _Generate166KeySetKey57 {
    1907   my($This) = @_;
    1908   my($MinKeyCount, $IsInRing) = (undef, 1);
    1909
    1910   return $This->_DetectAtomKeys('O', $MinKeyCount, $IsInRing);
    1911 }
    1912
    1913 # Generate key 58 value as 1/0 indicating its presence/absence or count of its
    1914 # presence in a molecule.
    1915 #
    1916 # Key 58 description: QSQ
    1917 #
    1918 sub _Generate166KeySetKey58 {
    1919   my($This) = @_;
    1920   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1921
    1922   $CentralAtomSymbol = 'S';
    1923   @NbrAtomSymbols = ('Q', 'Q');
    1924   @NbrBondSymbols = (undef, undef);
    1925
    1926   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1927 }
    1928
    1929 # Generate key 59 value as 1/0 indicating its presence/absence or count of its
    1930 # presence in a molecule.
    1931 #
    1932 # Key 59 description: Snot%A%A
    1933 #
    1934 sub _Generate166KeySetKey59 {
    1935   my($This) = @_;
    1936   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1937
    1938   $CentralAtomSymbol = 'A';
    1939   @NbrAtomSymbols = ('S', 'A');
    1940   @NbrBondSymbols = ('not%', '%');
    1941
    1942   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1943 }
    1944
    1945 # Generate key 60 value as 1/0 indicating its presence/absence or count of its
    1946 # presence in a molecule.
    1947 #
    1948 # Key 60 description: S=O
    1949 #
    1950 sub _Generate166KeySetKey60 {
    1951   my($This) = @_;
    1952   my($BondOrder) = 2;
    1953
    1954   return $This->_DetectBondKeys('S', 'O', $BondOrder);
    1955 }
    1956
    1957 # Generate key 61 value as 1/0 indicating its presence/absence or count of its
    1958 # presence in a molecule.
    1959 #
    1960 # Key 61 description: AS(A)A
    1961 #
    1962 sub _Generate166KeySetKey61 {
    1963   my($This) = @_;
    1964   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    1965
    1966   $CentralAtomSymbol = 'S';
    1967   @NbrAtomSymbols = ('A', 'A', 'A');
    1968   @NbrBondSymbols = (undef, undef, undef);
    1969
    1970   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    1971 }
    1972
    1973 # Generate key 62 value as 1/0 indicating its presence/absence or count of its
    1974 # presence in a molecule.
    1975 #
    1976 # Key 62 description: A$A!A$A
    1977 #
    1978 sub _Generate166KeySetKey62 {
    1979   my($This) = @_;
    1980   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    1981
    1982   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    1983   $BondSymbol = '!';
    1984
    1985   @NbrAtomsSymbols = (['A'], ['A']);
    1986   @NbrAtomsBondSymbols = (['$'], ['$']);
    1987   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    1988 }
    1989
    1990 # Generate key 63 value as 1/0 indicating its presence/absence or count of its
    1991 # presence in a molecule.
    1992 #
    1993 # Key 63 description: N=O
    1994 #
    1995 sub _Generate166KeySetKey63 {
    1996   my($This) = @_;
    1997   my($BondOrder) = 2;
    1998
    1999   return $This->_DetectBondKeys('N', 'O', $BondOrder);
    2000 }
    2001
    2002 # Generate key 64 value as 1/0 indicating its presence/absence or count of its
    2003 # presence in a molecule.
    2004 #
    2005 # Key 64 description: A$A!S
    2006 #
    2007 sub _Generate166KeySetKey64 {
    2008   my($This) = @_;
    2009   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2010
    2011   $CentralAtomSymbol = 'A';
    2012   @NbrAtomSymbols = ('A', 'S');
    2013   @NbrBondSymbols = ('$', '!');
    2014
    2015   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2016 }
    2017
    2018 # Generate key 65 value as 1/0 indicating its presence/absence or count of its
    2019 # presence in a molecule.
    2020 #
    2021 # Key 65 description: C%N
    2022 #
    2023 sub _Generate166KeySetKey65 {
    2024   my($This) = @_;
    2025   my($BondSymbol) = '%';
    2026
    2027   return $This->_DetectBondKeys('C', 'N', $BondSymbol);
    2028 }
    2029
    2030 # Generate key 66 value as 1/0 indicating its presence/absence or count of its
    2031 # presence in a molecule.
    2032 #
    2033 # Key 66 description: CC(C)(C)A
    2034 #
    2035 sub _Generate166KeySetKey66 {
    2036   my($This) = @_;
    2037   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2038
    2039   $CentralAtomSymbol = 'C';
    2040   @NbrAtomSymbols = ('C', 'C', 'C', 'A');
    2041   @NbrBondSymbols = (undef, undef, undef, undef);
    2042
    2043   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2044 }
    2045
    2046 # Generate key 67 value as 1/0 indicating its presence/absence or count of its
    2047 # presence in a molecule.
    2048 #
    2049 # Key 67 description: QS
    2050 #
    2051 sub _Generate166KeySetKey67 {
    2052   my($This) = @_;
    2053
    2054   return $This->_DetectBondKeys('Q', 'S');
    2055 }
    2056
    2057 # Generate key 68 value as 1/0 indicating its presence/absence or count of its
    2058 # presence in a molecule.
    2059 #
    2060 # Key 68 description: QHQH (&...)
    2061 #
    2062 sub _Generate166KeySetKey68 {
    2063   my($This) = @_;
    2064   my($AtomSymbol1, $AtomSymbol2, $BondSymbol) = ('Q', 'Q', undef);
    2065   my($MinKeyCount) = undef;
    2066   my($Atom1MinHydrogenCount, $Atom2MinHydrogenCount) = (1, 1);
    2067
    2068   return $This->_DetectBondKeys($AtomSymbol1, $AtomSymbol2, $BondSymbol, $MinKeyCount, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount);
    2069 }
    2070
    2071 # Generate key 69 value as 1/0 indicating its presence/absence or count of its
    2072 # presence in a molecule.
    2073 #
    2074 # Key 69 description: QQH
    2075 #
    2076 sub _Generate166KeySetKey69 {
    2077   my($This) = @_;
    2078   my($AtomSymbol1, $AtomSymbol2, $BondSymbol) = ('Q', 'Q', undef);
    2079   my($MinKeyCount) = undef;
    2080   my($Atom1MinHydrogenCount, $Atom2MinHydrogenCount) = (undef, 1);
    2081
    2082   return $This->_DetectBondKeys($AtomSymbol1, $AtomSymbol2, $BondSymbol, $MinKeyCount, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount);
    2083 }
    2084
    2085 # Generate key 70 value as 1/0 indicating its presence/absence or count of its
    2086 # presence in a molecule.
    2087 #
    2088 # Key 70 description: QNQ
    2089 #
    2090 sub _Generate166KeySetKey70 {
    2091   my($This) = @_;
    2092   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2093
    2094   $CentralAtomSymbol = 'N';
    2095   @NbrAtomSymbols = ('Q', 'Q');
    2096   @NbrBondSymbols = (undef, undef);
    2097
    2098   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2099 }
    2100
    2101 # Generate key 71 value as 1/0 indicating its presence/absence or count of its
    2102 # presence in a molecule.
    2103 #
    2104 # Key 71 description: NO
    2105 #
    2106 sub _Generate166KeySetKey71 {
    2107   my($This) = @_;
    2108
    2109   return $This->_DetectBondKeys('N', 'O');
    2110 }
    2111
    2112 # Generate key 72 value as 1/0 indicating its presence/absence or count of its
    2113 # presence in a molecule.
    2114 #
    2115 # Key 72 description: OAAO
    2116 #
    2117 sub _Generate166KeySetKey72 {
    2118   my($This) = @_;
    2119   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2120
    2121   @CentralAtomsSymbols = ('O', 'A', 'A', 'O');
    2122   @CentralAtomsBondSymbols = (undef, undef, undef);
    2123
    2124   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2125 }
    2126
    2127 # Generate key 73 value as 1/0 indicating its presence/absence or count of its
    2128 # presence in a molecule.
    2129 #
    2130 # Key 73 description: S=A
    2131 #
    2132 sub _Generate166KeySetKey73 {
    2133   my($This) = @_;
    2134   my($BondOrder) = 2;
    2135
    2136   return $This->_DetectBondKeys('S', 'A', $BondOrder);
    2137 }
    2138
    2139 # Generate key 74 value as 1/0 indicating its presence/absence or count of its
    2140 # presence in a molecule.
    2141 #
    2142 # Key 74 description: CH3ACH3
    2143 #
    2144 sub _Generate166KeySetKey74 {
    2145   my($This) = @_;
    2146   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    2147
    2148   $CentralAtomSymbol = 'A';
    2149   $CentralAtomMinHydrogenCount = undef;
    2150
    2151   @NbrAtomSymbols = ('C', 'C');
    2152   @NbrBondSymbols = (undef, undef);
    2153   @NbrAtomMinHydrogenCount = (3, 3);
    2154
    2155   $MinKeyCount = undef;
    2156
    2157   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    2158 }
    2159
    2160 # Generate key 75 value as 1/0 indicating its presence/absence or count of its
    2161 # presence in a molecule.
    2162 #
    2163 # Key 75 description: A!N$A
    2164 #
    2165 sub _Generate166KeySetKey75 {
    2166   my($This) = @_;
    2167   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2168
    2169   $CentralAtomSymbol = 'N';
    2170   @NbrAtomSymbols = ('A', 'A');
    2171   @NbrBondSymbols = ('!', '$');
    2172
    2173   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2174 }
    2175
    2176 # Generate key 76 value as 1/0 indicating its presence/absence or count of its
    2177 # presence in a molecule.
    2178 #
    2179 # Key 76 description: C=C(A)A
    2180 #
    2181 sub _Generate166KeySetKey76 {
    2182   my($This) = @_;
    2183   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2184
    2185   $CentralAtomSymbol = 'C';
    2186   @NbrAtomSymbols = ('C', 'A', 'A');
    2187   @NbrBondSymbols = ('=', undef, undef);
    2188
    2189   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2190 }
    2191
    2192 # Generate key 77 value as 1/0 indicating its presence/absence or count of its
    2193 # presence in a molecule.
    2194 #
    2195 # Key 77 description: NAN
    2196 #
    2197 sub _Generate166KeySetKey77 {
    2198   my($This) = @_;
    2199   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2200
    2201   $CentralAtomSymbol = 'A';
    2202   @NbrAtomSymbols = ('N', 'N');
    2203   @NbrBondSymbols = (undef, undef);
    2204
    2205   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2206 }
    2207
    2208 # Generate key 78 value as 1/0 indicating its presence/absence or count of its
    2209 # presence in a molecule.
    2210 #
    2211 # Key 78 description: C=N
    2212 #
    2213 sub _Generate166KeySetKey78 {
    2214   my($This) = @_;
    2215   my($BondOrder) = 2;
    2216
    2217   return $This->_DetectBondKeys('C', 'N', $BondOrder);
    2218 }
    2219
    2220 # Generate key 79 value as 1/0 indicating its presence/absence or count of its
    2221 # presence in a molecule.
    2222 #
    2223 # Key 79 description: NAAN
    2224 #
    2225 sub _Generate166KeySetKey79 {
    2226   my($This) = @_;
    2227   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2228
    2229   @CentralAtomsSymbols = ('N', 'A', 'A', 'N');
    2230   @CentralAtomsBondSymbols = (undef, undef, undef);
    2231
    2232   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2233 }
    2234
    2235 # Generate key 80 value as 1/0 indicating its presence/absence or count of its
    2236 # presence in a molecule.
    2237 #
    2238 # Key 80 description: NAAAN
    2239 #
    2240 sub _Generate166KeySetKey80 {
    2241   my($This) = @_;
    2242   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2243
    2244   @CentralAtomsSymbols = ('N', 'A', 'A', 'A', 'N');
    2245   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    2246
    2247   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2248 }
    2249
    2250 # Generate key 81 value as 1/0 indicating its presence/absence or count of its
    2251 # presence in a molecule.
    2252 #
    2253 # Key 81 description: SA(A)A
    2254 #
    2255 sub _Generate166KeySetKey81 {
    2256   my($This) = @_;
    2257   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2258
    2259   $CentralAtomSymbol = 'A';
    2260   @NbrAtomSymbols = ('S', 'A', 'A');
    2261   @NbrBondSymbols = (undef, undef, undef);
    2262
    2263   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2264 }
    2265
    2266 # Generate key 82 value as 1/0 indicating its presence/absence or count of its
    2267 # presence in a molecule.
    2268 #
    2269 # Key 82 description: ACH2QH
    2270 #
    2271 sub _Generate166KeySetKey82 {
    2272   my($This) = @_;
    2273   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    2274
    2275   $CentralAtomSymbol = 'C';
    2276   $CentralAtomMinHydrogenCount = 2;
    2277
    2278   @NbrAtomSymbols = ('A', 'Q');
    2279   @NbrBondSymbols = (undef, undef);
    2280   @NbrAtomMinHydrogenCount = (undef, 1);
    2281
    2282   $MinKeyCount = undef;
    2283
    2284   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    2285 }
    2286
    2287 # Generate key 83 value as 1/0 indicating its presence/absence or count of its
    2288 # presence in a molecule.
    2289 #
    2290 # Key 83 description: QAAAA@1
    2291 #
    2292 sub _Generate166KeySetKey83 {
    2293   my($This) = @_;
    2294   my($Atom, $KeyValue, $RingSize);
    2295
    2296   $RingSize = 5;
    2297   $KeyValue = 0;
    2298   ATOM: for $Atom (@{$This->{Atoms}}) {
    2299     if ($This->_IsHeteroAtom($Atom) && $Atom->IsInRingOfSize($RingSize)) {
    2300       if ($This->{KeyBits}) {
    2301         $KeyValue = 1;
    2302         last ATOM;
    2303       }
    2304       $KeyValue++;
    2305     }
    2306   }
    2307   return $KeyValue;
    2308 }
    2309
    2310 # Generate key 84 value as 1/0 indicating its presence/absence or count of its
    2311 # presence in a molecule.
    2312 #
    2313 # Key 84 description: NH2
    2314 #
    2315 sub _Generate166KeySetKey84 {
    2316   my($This) = @_;
    2317   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (undef, undef, 2);
    2318
    2319   return $This->_DetectAtomKeys('N', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    2320 }
    2321
    2322 # Generate key 85 value as 1/0 indicating its presence/absence or count of its
    2323 # presence in a molecule.
    2324 #
    2325 # Key 85 description: CN(C)C
    2326 #
    2327 sub _Generate166KeySetKey85 {
    2328   my($This) = @_;
    2329   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2330
    2331   $CentralAtomSymbol = 'N';
    2332   @NbrAtomSymbols = ('C', 'C', 'C');
    2333   @NbrBondSymbols = (undef, undef, undef);
    2334
    2335   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2336 }
    2337
    2338 # Generate key 86 value as 1/0 indicating its presence/absence or count of its
    2339 # presence in a molecule.
    2340 #
    2341 # Key 86 description: CH2QCH2
    2342 #
    2343 sub _Generate166KeySetKey86 {
    2344   my($This) = @_;
    2345   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    2346
    2347   $CentralAtomSymbol = 'Q';
    2348   $CentralAtomMinHydrogenCount = undef;
    2349
    2350   @NbrAtomSymbols = ('C', 'C');
    2351   @NbrBondSymbols = (undef, undef);
    2352   @NbrAtomMinHydrogenCount = (2, 2);
    2353
    2354   $MinKeyCount = undef;
    2355
    2356   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    2357 }
    2358
    2359 # Generate key 87 value as 1/0 indicating its presence/absence or count of its
    2360 # presence in a molecule.
    2361 #
    2362 # Key 87 description: X!A$A
    2363 #
    2364 sub _Generate166KeySetKey87 {
    2365   my($This) = @_;
    2366   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2367
    2368   $CentralAtomSymbol = 'A';
    2369   @NbrAtomSymbols = ('X', 'A');
    2370   @NbrBondSymbols = ('!', '$');
    2371
    2372   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2373 }
    2374
    2375 # Generate key 88 value as 1/0 indicating its presence/absence or count of its
    2376 # presence in a molecule.
    2377 #
    2378 # Key 88 description: S
    2379 #
    2380 sub _Generate166KeySetKey88 {
    2381   my($This) = @_;
    2382
    2383   return $This->_DetectAtomKeys('S');
    2384 }
    2385
    2386 # Generate key 89 value as 1/0 indicating its presence/absence or count of its
    2387 # presence in a molecule.
    2388 #
    2389 # Key 89 description: OAAAO
    2390 #
    2391 sub _Generate166KeySetKey89 {
    2392   my($This) = @_;
    2393   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2394
    2395   @CentralAtomsSymbols = ('O', 'A', 'A', 'A', 'O');
    2396   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    2397
    2398   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2399 }
    2400
    2401 # Generate key 90 value as 1/0 indicating its presence/absence or count of its
    2402 # presence in a molecule.
    2403 #
    2404 # Key 90 description: QHAACH2A
    2405 #
    2406 sub _Generate166KeySetKey90 {
    2407   my($This) = @_;
    2408   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2409
    2410   @CentralAtomsSymbols = ('Q', 'A', 'A', 'C', 'A');
    2411   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    2412   @CentralAtomsMinHydrogenCount = (1, undef, undef, 2, undef);
    2413
    2414   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2415 }
    2416
    2417 # Generate key 91 value as 1/0 indicating its presence/absence or count of its
    2418 # presence in a molecule.
    2419 #
    2420 # Key 91 description: QHAAACH2A
    2421 #
    2422 sub _Generate166KeySetKey91 {
    2423   my($This) = @_;
    2424   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2425
    2426   @CentralAtomsSymbols = ('Q', 'A', 'A', 'A', 'C', 'A');
    2427   @CentralAtomsBondSymbols = (undef, undef, undef, undef, undef);
    2428   @CentralAtomsMinHydrogenCount = (1, undef, undef, undef, 2, undef);
    2429
    2430   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2431 }
    2432
    2433 # Generate key 92 value as 1/0 indicating its presence/absence or count of its
    2434 # presence in a molecule.
    2435 #
    2436 # Key 92 description: OC(N)C
    2437 #
    2438 sub _Generate166KeySetKey92 {
    2439   my($This) = @_;
    2440   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2441
    2442   $CentralAtomSymbol = 'C';
    2443   @NbrAtomSymbols = ('O', 'N', 'C');
    2444   @NbrBondSymbols = (undef, undef, undef);
    2445
    2446   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2447 }
    2448
    2449 # Generate key 93 value as 1/0 indicating its presence/absence or count of its
    2450 # presence in a molecule.
    2451 #
    2452 # Key 93 description: QCH3
    2453 #
    2454 sub _Generate166KeySetKey93 {
    2455   my($This) = @_;
    2456   my($AtomSymbol1, $AtomSymbol2, $BondSymbol) = ('Q', 'C', undef);
    2457   my($MinKeyCount) = undef;
    2458   my($Atom1MinHydrogenCount, $Atom2MinHydrogenCount) = (undef, 3);
    2459
    2460   return $This->_DetectBondKeys($AtomSymbol1, $AtomSymbol2, $BondSymbol, $MinKeyCount, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount);
    2461 }
    2462
    2463 # Generate key 94 value as 1/0 indicating its presence/absence or count of its
    2464 # presence in a molecule.
    2465 #
    2466 # Key 94 description: QN
    2467 #
    2468 sub _Generate166KeySetKey94 {
    2469   my($This) = @_;
    2470
    2471   return $This->_DetectBondKeys('Q', 'N');
    2472 }
    2473
    2474 # Generate key 95 value as 1/0 indicating its presence/absence or count of its
    2475 # presence in a molecule.
    2476 #
    2477 # Key 95 description: NAAO
    2478 #
    2479 sub _Generate166KeySetKey95 {
    2480   my($This) = @_;
    2481   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2482
    2483   @CentralAtomsSymbols = ('N', 'A', 'A', 'O');
    2484   @CentralAtomsBondSymbols = (undef, undef, undef);
    2485
    2486   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2487 }
    2488
    2489 # Generate key 96 value as 1/0 indicating its presence/absence or count of its
    2490 # presence in a molecule.
    2491 #
    2492 # Key 96 description: 5M RING
    2493 #
    2494 sub _Generate166KeySetKey96 {
    2495   my($This) = @_;
    2496   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    2497
    2498   $RingSize = 5;
    2499   $Molecule = $This->GetMolecule();
    2500   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    2501
    2502   if ($This->{KeyBits}) {
    2503     $KeyValue = $NumOfRings ? 1 : 0;
    2504   }
    2505   else {
    2506     $KeyValue = $NumOfRings;
    2507   }
    2508   return $KeyValue;
    2509 }
    2510
    2511 # Generate key 97 value as 1/0 indicating its presence/absence or count of its
    2512 # presence in a molecule.
    2513 #
    2514 # Key 97 description: NAAAO
    2515 #
    2516 sub _Generate166KeySetKey97 {
    2517   my($This) = @_;
    2518   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    2519
    2520   @CentralAtomsSymbols = ('N', 'A', 'A', 'A', 'O');
    2521   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    2522
    2523   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    2524 }
    2525
    2526 # Generate key 98 value as 1/0 indicating its presence/absence or count of its
    2527 # presence in a molecule.
    2528 #
    2529 # Key 98 description: QAAAAA@1
    2530 #
    2531 sub _Generate166KeySetKey98 {
    2532   my($This) = @_;
    2533   my($Atom, $KeyValue, $RingSize);
    2534
    2535   $RingSize = 6;
    2536   $KeyValue = 0;
    2537   ATOM: for $Atom (@{$This->{Atoms}}) {
    2538     if ($This->_IsHeteroAtom($Atom) && $Atom->IsInRingOfSize($RingSize)) {
    2539       if ($This->{KeyBits}) {
    2540         $KeyValue = 1;
    2541         last ATOM;
    2542       }
    2543       $KeyValue++;
    2544     }
    2545   }
    2546   return $KeyValue;
    2547 }
    2548
    2549 # Generate key 99 value as 1/0 indicating its presence/absence or count of its
    2550 # presence in a molecule.
    2551 #
    2552 # Key 99 description: C=C
    2553 #
    2554 sub _Generate166KeySetKey99 {
    2555   my($This) = @_;
    2556   my($BondOrder) = 2;
    2557
    2558   return $This->_DetectBondKeys('C', 'C', $BondOrder);
    2559 }
    2560
    2561 # Generate key 100 value as 1/0 indicating its presence/absence or count of its
    2562 # presence in a molecule.
    2563 #
    2564 # Key 100 description: ACH2N
    2565 #
    2566 sub _Generate166KeySetKey100 {
    2567   my($This) = @_;
    2568   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    2569
    2570   $CentralAtomSymbol = 'C';
    2571   $CentralAtomMinHydrogenCount = 2;
    2572
    2573   @NbrAtomSymbols = ('A', 'N');
    2574   @NbrBondSymbols = (undef, undef);
    2575
    2576   $MinKeyCount = undef;
    2577
    2578   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    2579 }
    2580
    2581 # Generate key 101 value as 1/0 indicating its presence/absence or count of its
    2582 # presence in a molecule.
    2583 #
    2584 # Key 101 description: 8M RING
    2585 #
    2586 sub _Generate166KeySetKey101 {
    2587   my($This) = @_;
    2588   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    2589
    2590   $RingSize = 8;
    2591   $Molecule = $This->GetMolecule();
    2592   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    2593
    2594   if ($This->{KeyBits}) {
    2595     $KeyValue = $NumOfRings ? 1 : 0;
    2596   }
    2597   else {
    2598     $KeyValue = $NumOfRings;
    2599   }
    2600   return $KeyValue;
    2601 }
    2602
    2603 # Generate key 102 value as 1/0 indicating its presence/absence or count of its
    2604 # presence in a molecule.
    2605 #
    2606 # Key 102 description: QO
    2607 #
    2608 sub _Generate166KeySetKey102 {
    2609   my($This) = @_;
    2610
    2611   return $This->_DetectBondKeys('Q', 'O');
    2612 }
    2613
    2614 # Generate key 103 value as 1/0 indicating its presence/absence or count of its
    2615 # presence in a molecule.
    2616 #
    2617 # Key 103 description: CL
    2618 #
    2619 sub _Generate166KeySetKey103 {
    2620   my($This) = @_;
    2621
    2622   return $This->_DetectAtomKeys('Cl');
    2623 }
    2624
    2625 # Generate key 104 value as 1/0 indicating its presence/absence or count of its
    2626 # presence in a molecule.
    2627 #
    2628 # Key 104 description: QHACH2A
    2629 #
    2630 sub _Generate166KeySetKey104 {
    2631   my($This) = @_;
    2632   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2633
    2634   @CentralAtomsSymbols = ('Q', 'A', 'C', 'A');
    2635   @CentralAtomsBondSymbols = (undef, undef, undef);
    2636   @CentralAtomsMinHydrogenCount = (1, undef, 2, undef);
    2637
    2638   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2639 }
    2640
    2641 # Generate key 105 value as 1/0 indicating its presence/absence or count of its
    2642 # presence in a molecule.
    2643 #
    2644 # Key 105 description: A$A($A)$A
    2645 #
    2646 sub _Generate166KeySetKey105 {
    2647   my($This) = @_;
    2648   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2649
    2650   $CentralAtomSymbol = 'A';
    2651   @NbrAtomSymbols = ('A', 'A', 'A');
    2652   @NbrBondSymbols = ('$', '$', '$');
    2653
    2654   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2655 }
    2656
    2657 # Generate key 106 value as 1/0 indicating its presence/absence or count of its
    2658 # presence in a molecule.
    2659 #
    2660 # Key 106 description: QA(Q)Q
    2661 #
    2662 sub _Generate166KeySetKey106 {
    2663   my($This) = @_;
    2664   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2665
    2666   $CentralAtomSymbol = 'A';
    2667   @NbrAtomSymbols = ('Q', 'Q', 'Q');
    2668   @NbrBondSymbols = (undef, undef, undef);
    2669
    2670   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2671 }
    2672
    2673 # Generate key 107 value as 1/0 indicating its presence/absence or count of its
    2674 # presence in a molecule.
    2675 #
    2676 # Key 107 description: XA(A)A
    2677 #
    2678 sub _Generate166KeySetKey107 {
    2679   my($This) = @_;
    2680   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2681
    2682   $CentralAtomSymbol = 'A';
    2683   @NbrAtomSymbols = ('X', 'A', 'A');
    2684   @NbrBondSymbols = (undef, undef, undef);
    2685
    2686   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2687 }
    2688
    2689 # Generate key 108 value as 1/0 indicating its presence/absence or count of its
    2690 # presence in a molecule.
    2691 #
    2692 # Key 108 description: CH3AAACH2A
    2693 #
    2694 sub _Generate166KeySetKey108 {
    2695   my($This) = @_;
    2696   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2697
    2698   @CentralAtomsSymbols = ('C', 'A', 'A', 'A', 'C', 'A');
    2699   @CentralAtomsBondSymbols = (undef, undef, undef, undef, undef);
    2700   @CentralAtomsMinHydrogenCount = (3, undef, undef, undef, 1, undef);
    2701
    2702   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2703 }
    2704
    2705 # Generate key 109 value as 1/0 indicating its presence/absence or count of its
    2706 # presence in a molecule.
    2707 #
    2708 # Key 109 description: ACH2O
    2709 #
    2710 sub _Generate166KeySetKey109 {
    2711   my($This) = @_;
    2712   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    2713
    2714   $CentralAtomSymbol = 'C';
    2715   $CentralAtomMinHydrogenCount = 2;
    2716
    2717   @NbrAtomSymbols = ('A', 'O');
    2718   @NbrBondSymbols = (undef, undef);
    2719
    2720   $MinKeyCount = undef;
    2721
    2722   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    2723 }
    2724
    2725 # Generate key 110 value as 1/0 indicating its presence/absence or count of its
    2726 # presence in a molecule.
    2727 #
    2728 # Key 110 description: NCO
    2729 #
    2730 sub _Generate166KeySetKey110 {
    2731   my($This) = @_;
    2732   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2733
    2734   $CentralAtomSymbol = 'C';
    2735   @NbrAtomSymbols = ('N', 'O');
    2736   @NbrBondSymbols = (undef, undef);
    2737
    2738   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2739 }
    2740
    2741 # Generate key 111 value as 1/0 indicating its presence/absence or count of its
    2742 # presence in a molecule.
    2743 #
    2744 # Key 111 description: NACH2A
    2745 #
    2746 sub _Generate166KeySetKey111 {
    2747   my($This) = @_;
    2748   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2749
    2750   @CentralAtomsSymbols = ('N', 'A', 'C', 'A');
    2751   @CentralAtomsBondSymbols = (undef, undef, undef);
    2752   @CentralAtomsMinHydrogenCount = (undef, undef, 2, undef);
    2753
    2754   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2755 }
    2756
    2757 # Generate key 112 value as 1/0 indicating its presence/absence or count of its
    2758 # presence in a molecule.
    2759 #
    2760 # Key 112 description: AA(A)(A)A
    2761 #
    2762 sub _Generate166KeySetKey112 {
    2763   my($This) = @_;
    2764   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2765
    2766   $CentralAtomSymbol = 'A';
    2767   @NbrAtomSymbols = ('A', 'A', 'A', 'A');
    2768   @NbrBondSymbols = (undef, undef, undef, undef);
    2769
    2770   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2771 }
    2772
    2773 # Generate key 113 value as 1/0 indicating its presence/absence or count of its
    2774 # presence in a molecule.
    2775 #
    2776 # Key 113 description: Onot%A%A
    2777 #
    2778 sub _Generate166KeySetKey113 {
    2779   my($This) = @_;
    2780   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2781
    2782   $CentralAtomSymbol = 'A';
    2783   @NbrAtomSymbols = ('O', 'A');
    2784   @NbrBondSymbols = ('not%', '%');
    2785
    2786   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2787 }
    2788
    2789 # Generate key 114 value as 1/0 indicating its presence/absence or count of its
    2790 # presence in a molecule.
    2791 #
    2792 # Key 114 description: CH3CH2A
    2793 #
    2794 sub _Generate166KeySetKey114 {
    2795   my($This) = @_;
    2796   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    2797
    2798   $CentralAtomSymbol = 'C';
    2799   $CentralAtomMinHydrogenCount = 2;
    2800
    2801   @NbrAtomSymbols = ('C', 'A');
    2802   @NbrBondSymbols = (undef, undef);
    2803   @NbrAtomMinHydrogenCount = (3, undef);
    2804
    2805   $MinKeyCount = undef;
    2806
    2807   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    2808 }
    2809
    2810 # Generate key 115 value as 1/0 indicating its presence/absence or count of its
    2811 # presence in a molecule.
    2812 #
    2813 # Key 115 description: CH3ACH2A
    2814 #
    2815 sub _Generate166KeySetKey115 {
    2816   my($This) = @_;
    2817   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2818
    2819   @CentralAtomsSymbols = ('C', 'A', 'C', 'A');
    2820   @CentralAtomsBondSymbols = (undef, undef, undef);
    2821   @CentralAtomsMinHydrogenCount = (3, undef, 2, undef);
    2822
    2823   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2824 }
    2825
    2826 # Generate key 116 value as 1/0 indicating its presence/absence or count of its
    2827 # presence in a molecule.
    2828 #
    2829 # Key 116 description: CH3AACH2A
    2830 #
    2831 sub _Generate166KeySetKey116 {
    2832   my($This) = @_;
    2833   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2834
    2835   @CentralAtomsSymbols = ('C', 'A', 'A', 'C', 'A');
    2836   @CentralAtomsBondSymbols = (undef, undef, undef, undef);
    2837   @CentralAtomsMinHydrogenCount = (3, undef, undef, 2, undef);
    2838
    2839   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    2840 }
    2841
    2842 # Generate key 117 value as 1/0 indicating its presence/absence or count of its
    2843 # presence in a molecule.
    2844 #
    2845 # Key 117 description: NAO
    2846 #
    2847 sub _Generate166KeySetKey117 {
    2848   my($This) = @_;
    2849   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2850
    2851   $CentralAtomSymbol = 'A';
    2852   @NbrAtomSymbols = ('N', 'O');
    2853   @NbrBondSymbols = (undef, undef);
    2854
    2855   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2856 }
    2857
    2858 # Generate key 118 value as 1/0 indicating its presence/absence or count of its
    2859 # presence in a molecule.
    2860 #
    2861 # Key 118 description: ACH2CH2A > 1
    2862 #
    2863 sub _Generate166KeySetKey118 {
    2864   my($This) = @_;
    2865   my($MinKeyCount, @CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    2866
    2867   $MinKeyCount = 2;
    2868   @CentralAtomsSymbols = ('A', 'C', 'C', 'A');
    2869   @CentralAtomsBondSymbols = (undef, undef, undef);
    2870   @CentralAtomsMinHydrogenCount = (undef, 2, 2, undef);
    2871
    2872   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount, $MinKeyCount);
    2873 }
    2874
    2875 # Generate key 119 value as 1/0 indicating its presence/absence or count of its
    2876 # presence in a molecule.
    2877 #
    2878 # Key 119 description: N=A
    2879 #
    2880 sub _Generate166KeySetKey119 {
    2881   my($This) = @_;
    2882   my($BondOrder) = 2;
    2883
    2884   return $This->_DetectBondKeys('N', 'A', $BondOrder);
    2885 }
    2886
    2887 # Generate key 120 value as 1/0 indicating its presence/absence or count of its
    2888 # presence in a molecule.
    2889 #
    2890 # Key 120 description: HETEROCYCLIC ATOM > 1 (&...)
    2891 #
    2892 sub _Generate166KeySetKey120 {
    2893   my($This) = @_;
    2894   my($MinKeyCount, $IsInRing) = (2, 1);
    2895
    2896   return $This->_DetectAtomKeys('Q', $MinKeyCount, $IsInRing);
    2897 }
    2898
    2899 # Generate key 121 value as 1/0 indicating its presence/absence or count of its
    2900 # presence in a molecule.
    2901 #
    2902 # Key 121 description: N HETEROCYCLE
    2903 #
    2904 sub _Generate166KeySetKey121 {
    2905   my($This) = @_;
    2906   my($MinKeyCount, $IsInRing) = (undef, 1);
    2907
    2908   return $This->_DetectAtomKeys('N', $MinKeyCount, $IsInRing);
    2909 }
    2910
    2911 # Generate key 122 value as 1/0 indicating its presence/absence or count of its
    2912 # presence in a molecule.
    2913 #
    2914 # Key 122 description: AN(A)A
    2915 #
    2916 sub _Generate166KeySetKey122 {
    2917   my($This) = @_;
    2918   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2919
    2920   $CentralAtomSymbol = 'N';
    2921   @NbrAtomSymbols = ('A', 'A', 'A');
    2922   @NbrBondSymbols = (undef, undef, undef);
    2923
    2924   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2925 }
    2926
    2927 # Generate key 123 value as 1/0 indicating its presence/absence or count of its
    2928 # presence in a molecule.
    2929 #
    2930 # Key 123 description: OCO
    2931 #
    2932 sub _Generate166KeySetKey123 {
    2933   my($This) = @_;
    2934   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2935
    2936   $CentralAtomSymbol = 'C';
    2937   @NbrAtomSymbols = ('O', 'O');
    2938   @NbrBondSymbols = (undef, undef);
    2939
    2940   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2941 }
    2942
    2943 # Generate key 124 value as 1/0 indicating its presence/absence or count of its
    2944 # presence in a molecule.
    2945 #
    2946 # Key 124 description: QQ
    2947 #
    2948 sub _Generate166KeySetKey124 {
    2949   my($This) = @_;
    2950
    2951   return $This->_DetectBondKeys('Q', 'Q');
    2952 }
    2953
    2954 # Generate key 125 value as 1/0 indicating its presence/absence or count of its
    2955 # presence in a molecule.
    2956 #
    2957 # Key 125 description: AROMATIC RING > 1
    2958 #
    2959 sub _Generate166KeySetKey125 {
    2960   my($This) = @_;
    2961   my($Molecule, $NumOfAromaticRings, $KeyValue);
    2962
    2963   $Molecule = $This->GetMolecule();
    2964   $NumOfAromaticRings = $Molecule->GetNumOfAromaticRings();
    2965
    2966   if ($This->{KeyBits}) {
    2967     $KeyValue = ($NumOfAromaticRings > 1) ? 1 : 0;
    2968   }
    2969   else {
    2970     $KeyValue = $NumOfAromaticRings;
    2971   }
    2972   return $KeyValue;
    2973 }
    2974
    2975 # Generate key 126 value as 1/0 indicating its presence/absence or count of its
    2976 # presence in a molecule.
    2977 #
    2978 # Key 126 description: A!O!A
    2979 #
    2980 sub _Generate166KeySetKey126 {
    2981   my($This) = @_;
    2982   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    2983
    2984   $CentralAtomSymbol = 'O';
    2985   @NbrAtomSymbols = ('A', 'A');
    2986   @NbrBondSymbols = ('!', '!');
    2987
    2988   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    2989 }
    2990
    2991 # Generate key 127 value as 1/0 indicating its presence/absence or count of its
    2992 # presence in a molecule.
    2993 #
    2994 # Key 127 description: A$A!O > 1 (&...)
    2995 #
    2996 sub _Generate166KeySetKey127 {
    2997   my($This) = @_;
    2998   my($CentralAtomSymbol, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    2999
    3000   $CentralAtomSymbol = 'A';
    3001   @NbrAtomSymbols = ('A', 'O');
    3002   @NbrBondSymbols = ('$', '!');
    3003   $MinKeyCount = 2;
    3004
    3005   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount);
    3006 }
    3007
    3008 # Generate key 128 value as 1/0 indicating its presence/absence or count of its
    3009 # presence in a molecule.
    3010 #
    3011 # Key 128 description: ACH2AAACH2A
    3012 #
    3013 sub _Generate166KeySetKey128 {
    3014   my($This) = @_;
    3015   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    3016
    3017   @CentralAtomsSymbols = ('A', 'C', 'A', 'A', 'A', 'C', 'A');
    3018   @CentralAtomsBondSymbols = (undef, undef, undef, undef, undef, undef);
    3019   @CentralAtomsMinHydrogenCount = (undef, 2, undef, undef, undef, 2, undef);
    3020
    3021   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    3022 }
    3023
    3024 # Generate key 129 value as 1/0 indicating its presence/absence or count of its
    3025 # presence in a molecule.
    3026 #
    3027 # Key 129 description: ACH2AACH2A
    3028 #
    3029 sub _Generate166KeySetKey129 {
    3030   my($This) = @_;
    3031   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    3032
    3033   @CentralAtomsSymbols = ('A', 'C', 'A', 'A', 'C', 'A');
    3034   @CentralAtomsBondSymbols = (undef, undef, undef, undef, undef);
    3035   @CentralAtomsMinHydrogenCount = (undef, 2, undef, undef, 2, undef);
    3036
    3037   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    3038 }
    3039
    3040 # Generate key 130 value as 1/0 indicating its presence/absence or count of its
    3041 # presence in a molecule.
    3042 #
    3043 # Key 130 description: QQ > 1 (&...)
    3044 #
    3045 sub _Generate166KeySetKey130 {
    3046   my($This) = @_;
    3047   my($BondOrder, $MinKeyCount) = (undef, 2);
    3048
    3049   return $This->_DetectBondKeys('Q', 'Q', $BondOrder, $MinKeyCount);
    3050 }
    3051
    3052 # Generate key 131 value as 1/0 indicating its presence/absence or count of its
    3053 # presence in a molecule.
    3054 #
    3055 # Key 131 description: QH > 1
    3056 #
    3057 sub _Generate166KeySetKey131 {
    3058   my($This) = @_;
    3059   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (2, undef, 1);
    3060
    3061   return $This->_DetectAtomKeys('Q', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3062 }
    3063
    3064 # Generate key 132 value as 1/0 indicating its presence/absence or count of its
    3065 # presence in a molecule.
    3066 #
    3067 # Key 132 description: OACH2A
    3068 #
    3069 sub _Generate166KeySetKey132 {
    3070   my($This) = @_;
    3071   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    3072
    3073   @CentralAtomsSymbols = ('O', 'A', 'C', 'A');
    3074   @CentralAtomsBondSymbols = (undef, undef, undef);
    3075   @CentralAtomsMinHydrogenCount = (undef, undef, 2, undef);
    3076
    3077   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    3078 }
    3079
    3080 # Generate key 133 value as 1/0 indicating its presence/absence or count of its
    3081 # presence in a molecule.
    3082 #
    3083 # Key 133 description: A$A!N
    3084 #
    3085 sub _Generate166KeySetKey133 {
    3086   my($This) = @_;
    3087   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3088
    3089   $CentralAtomSymbol = 'A';
    3090   @NbrAtomSymbols = ('A', 'N');
    3091   @NbrBondSymbols = ('$', '!');
    3092
    3093   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3094 }
    3095
    3096 # Generate key 134 value as 1/0 indicating its presence/absence or count of its
    3097 # presence in a molecule.
    3098 #
    3099 # Key 134 description: X (HALOGEN)
    3100 #
    3101 sub _Generate166KeySetKey134 {
    3102   my($This) = @_;
    3103
    3104   return $This->_DetectAtomKeys('X');
    3105 }
    3106
    3107 # Generate key 135 value as 1/0 indicating its presence/absence or count of its
    3108 # presence in a molecule.
    3109 #
    3110 # Key 135 description: Nnot%A%A
    3111 #
    3112 sub _Generate166KeySetKey135 {
    3113   my($This) = @_;
    3114   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3115
    3116   $CentralAtomSymbol = 'A';
    3117   @NbrAtomSymbols = ('N', 'A');
    3118   @NbrBondSymbols = ('not%', '%');
    3119
    3120   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3121 }
    3122
    3123 # Generate key 136 value as 1/0 indicating its presence/absence or count of its
    3124 # presence in a molecule.
    3125 #
    3126 # Key 136 description: O=A > 1
    3127 #
    3128 sub _Generate166KeySetKey136 {
    3129   my($This) = @_;
    3130   my($BondOrder, $MinKeyCount) = (2, 2);
    3131
    3132   return $This->_DetectBondKeys('O', 'A', $BondOrder, $MinKeyCount);
    3133 }
    3134
    3135 # Generate key 137 value as 1/0 indicating its presence/absence or count of its
    3136 # presence in a molecule.
    3137 #
    3138 # Key 137 description: HETEROCYCLE
    3139 #
    3140 sub _Generate166KeySetKey137 {
    3141   my($This) = @_;
    3142   my($MinKeyCount, $IsInRing) = (1, 1);
    3143
    3144   return $This->_DetectAtomKeys('Q', $MinKeyCount, $IsInRing);
    3145 }
    3146
    3147 # Generate key 138 value as 1/0 indicating its presence/absence or count of its
    3148 # presence in a molecule.
    3149 #
    3150 # Key 138 description: QCH2A > 1 (&...)
    3151 #
    3152 sub _Generate166KeySetKey138 {
    3153   my($This) = @_;
    3154   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3155
    3156   $CentralAtomSymbol = 'C';
    3157   @NbrAtomSymbols = ('Q', 'A');
    3158   @NbrBondSymbols = (undef, undef);
    3159   $MinKeyCount = 2;
    3160   $CentralAtomMinHydrogenCount = 2;
    3161
    3162   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    3163 }
    3164
    3165 # Generate key 139 value as 1/0 indicating its presence/absence or count of its
    3166 # presence in a molecule.
    3167 #
    3168 # Key 139 description: OH
    3169 #
    3170 sub _Generate166KeySetKey139 {
    3171   my($This) = @_;
    3172   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (undef, undef, 1);
    3173
    3174   return $This->_DetectAtomKeys('O', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3175 }
    3176
    3177 # Generate key 140 value as 1/0 indicating its presence/absence or count of its
    3178 # presence in a molecule.
    3179 #
    3180 # Key 140 description: O > 3 (&...)
    3181 #
    3182 sub _Generate166KeySetKey140 {
    3183   my($This) = @_;
    3184   my($MinKeyCount) = 4;
    3185
    3186   return $This->_DetectAtomKeys('O', $MinKeyCount);
    3187 }
    3188
    3189 # Generate key 141 value as 1/0 indicating its presence/absence or count of its
    3190 # presence in a molecule.
    3191 #
    3192 # Key 141 description: CH3 > 2 (&...)
    3193 #
    3194 sub _Generate166KeySetKey141 {
    3195   my($This) = @_;
    3196   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (3, undef, 3);
    3197
    3198   return $This->_DetectAtomKeys('C', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3199 }
    3200
    3201 # Generate key 142 value as 1/0 indicating its presence/absence or count of its
    3202 # presence in a molecule.
    3203 #
    3204 # Key 142 description: N > 1
    3205 #
    3206 sub _Generate166KeySetKey142 {
    3207   my($This) = @_;
    3208   my($MinKeyCount) = 2;
    3209
    3210   return $This->_DetectAtomKeys('N', $MinKeyCount);
    3211 }
    3212
    3213 # Generate key 143 value as 1/0 indicating its presence/absence or count of its
    3214 # presence in a molecule.
    3215 #
    3216 # Key 143 description: A$A!O
    3217 #
    3218 sub _Generate166KeySetKey143 {
    3219   my($This) = @_;
    3220   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3221
    3222   $CentralAtomSymbol = 'A';
    3223   @NbrAtomSymbols = ('A', 'O');
    3224   @NbrBondSymbols = ('$', '!');
    3225
    3226   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3227 }
    3228
    3229 # Generate key 144 value as 1/0 indicating its presence/absence or count of its
    3230 # presence in a molecule.
    3231 #
    3232 # Key 144 description: Anot%A%Anot%A
    3233 #
    3234 sub _Generate166KeySetKey144 {
    3235   my($This) = @_;
    3236   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    3237
    3238   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    3239   $BondSymbol = '%';
    3240
    3241   @NbrAtomsSymbols = (['A'], ['A']);
    3242   @NbrAtomsBondSymbols = (['not%'], ['not%']);
    3243   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    3244 }
    3245
    3246 # Generate key 145 value as 1/0 indicating its presence/absence or count of its
    3247 # presence in a molecule.
    3248 #
    3249 # Key 145 description: 6M RING > 1
    3250 #
    3251 sub _Generate166KeySetKey145 {
    3252   my($This) = @_;
    3253   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    3254
    3255   $RingSize = 6;
    3256   $Molecule = $This->GetMolecule();
    3257   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    3258
    3259   if ($This->{KeyBits}) {
    3260     $KeyValue = ($NumOfRings > 1) ? 1 : 0;
    3261   }
    3262   else {
    3263     $KeyValue = $NumOfRings;
    3264   }
    3265   return $KeyValue;
    3266 }
    3267
    3268 # Generate key 146 value as 1/0 indicating its presence/absence or count of its
    3269 # presence in a molecule.
    3270 #
    3271 # Key 146 description: O > 2
    3272 #
    3273 sub _Generate166KeySetKey146 {
    3274   my($This) = @_;
    3275   my($MinKeyCount) = 3;
    3276
    3277   return $This->_DetectAtomKeys('O', $MinKeyCount);
    3278 }
    3279
    3280 # Generate key 147 value as 1/0 indicating its presence/absence or count of its
    3281 # presence in a molecule.
    3282 #
    3283 # Key 147 description: ACH2CH2A
    3284 #
    3285 sub _Generate166KeySetKey147 {
    3286   my($This) = @_;
    3287   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount);
    3288
    3289   @CentralAtomsSymbols = ('A', 'C', 'C', 'A');
    3290   @CentralAtomsBondSymbols = (undef, undef, undef);
    3291   @CentralAtomsMinHydrogenCount = (undef, 2, 2, undef);
    3292
    3293   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount);
    3294 }
    3295
    3296 # Generate key 148 value as 1/0 indicating its presence/absence or count of its
    3297 # presence in a molecule.
    3298 #
    3299 # Key 148 description: AQ(A)A
    3300 #
    3301 sub _Generate166KeySetKey148 {
    3302   my($This) = @_;
    3303   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3304
    3305   $CentralAtomSymbol = 'Q';
    3306   @NbrAtomSymbols = ('A', 'A', 'A');
    3307   @NbrBondSymbols = (undef, undef, undef);
    3308
    3309   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3310 }
    3311
    3312 # Generate key 149 value as 1/0 indicating its presence/absence or count of its
    3313 # presence in a molecule.
    3314 #
    3315 # Key 149 description: CH3 > 1
    3316 #
    3317 sub _Generate166KeySetKey149 {
    3318   my($This) = @_;
    3319   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (2, undef, 3);
    3320
    3321   return $This->_DetectAtomKeys('C', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3322 }
    3323
    3324 # Generate key 150 value as 1/0 indicating its presence/absence or count of its
    3325 # presence in a molecule.
    3326 #
    3327 # Key 150 description: A!A$A!A
    3328 #
    3329 sub _Generate166KeySetKey150 {
    3330   my($This) = @_;
    3331   my(@CentralAtomsSymbols, @CentralAtomsBondSymbols);
    3332
    3333   @CentralAtomsSymbols = ('A', 'A', 'A', 'A');
    3334   @CentralAtomsBondSymbols = ('!', '$', '!');
    3335
    3336   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols);
    3337 }
    3338
    3339 # Generate key 151 value as 1/0 indicating its presence/absence or count of its
    3340 # presence in a molecule.
    3341 #
    3342 # Key 151 description: NH
    3343 #
    3344 sub _Generate166KeySetKey151 {
    3345   my($This) = @_;
    3346   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (undef, undef, 1);
    3347
    3348   return $This->_DetectAtomKeys('N', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3349 }
    3350
    3351 # Generate key 152 value as 1/0 indicating its presence/absence or count of its
    3352 # presence in a molecule.
    3353 #
    3354 # Key 152 description: OC(C)C
    3355 #
    3356 sub _Generate166KeySetKey152 {
    3357   my($This) = @_;
    3358   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3359
    3360   $CentralAtomSymbol = 'C';
    3361   @NbrAtomSymbols = ('O', 'C', 'C');
    3362   @NbrBondSymbols = (undef, undef, undef);
    3363
    3364   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3365 }
    3366
    3367 # Generate key 153 value as 1/0 indicating its presence/absence or count of its
    3368 # presence in a molecule.
    3369 #
    3370 # Key 153 description: QCH2A
    3371 #
    3372 sub _Generate166KeySetKey153 {
    3373   my($This) = @_;
    3374   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3375
    3376   $CentralAtomSymbol = 'C';
    3377   @NbrAtomSymbols = ('Q', 'A');
    3378   @NbrBondSymbols = (undef, undef);
    3379   $MinKeyCount = undef;
    3380   $CentralAtomMinHydrogenCount = 2;
    3381
    3382   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    3383 }
    3384
    3385 # Generate key 154 value as 1/0 indicating its presence/absence or count of its
    3386 # presence in a molecule.
    3387 #
    3388 # Key 154 description: C=O
    3389 #
    3390 sub _Generate166KeySetKey154 {
    3391   my($This) = @_;
    3392   my($BondOrder) = 2;
    3393
    3394   return $This->_DetectBondKeys('C', 'O', $BondOrder);
    3395 }
    3396
    3397 # Generate key 155 value as 1/0 indicating its presence/absence or count of its
    3398 # presence in a molecule.
    3399 #
    3400 # Key 155 description: A!CH2!A
    3401 #
    3402 sub _Generate166KeySetKey155 {
    3403   my($This) = @_;
    3404   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3405
    3406   $CentralAtomSymbol = 'C';
    3407   @NbrAtomSymbols = ('A', 'A');
    3408   @NbrBondSymbols = ('!', '!');
    3409   $MinKeyCount = undef;
    3410   $CentralAtomMinHydrogenCount = 2;
    3411
    3412   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    3413 }
    3414
    3415 # Generate key 156 value as 1/0 indicating its presence/absence or count of its
    3416 # presence in a molecule.
    3417 #
    3418 # Key 156 description: NA(A)A
    3419 #
    3420 sub _Generate166KeySetKey156 {
    3421   my($This) = @_;
    3422   my($MinKeyCount, @CentralAtomsSymbols, @CentralAtomsBondSymbols, @CentralAtomsMinHydrogenCount, @CentralAtomNbrsAtomSymbols, @CentralAtomNbrsBondSymbols);
    3423
    3424   @CentralAtomsSymbols = ('N', 'A', 'A');
    3425   @CentralAtomsBondSymbols = (undef, undef);
    3426   @CentralAtomsMinHydrogenCount = (undef, undef, undef);
    3427
    3428   @CentralAtomNbrsAtomSymbols = (undef, ['A'], undef);
    3429   @CentralAtomNbrsBondSymbols = (undef, undef, undef);
    3430   $MinKeyCount = undef;
    3431
    3432   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, \@CentralAtomsBondSymbols, \@CentralAtomsMinHydrogenCount, $MinKeyCount, \@CentralAtomNbrsAtomSymbols, \@CentralAtomNbrsBondSymbols);
    3433 }
    3434
    3435 # Generate key 157 value as 1/0 indicating its presence/absence or count of its
    3436 # presence in a molecule.
    3437 #
    3438 # Key 157 description: C-O
    3439 #
    3440 sub _Generate166KeySetKey157 {
    3441   my($This) = @_;
    3442   my($BondOrder) = 1;
    3443
    3444   return $This->_DetectBondKeys('C', 'O', $BondOrder);
    3445 }
    3446
    3447 # Generate key 158 value as 1/0 indicating its presence/absence or count of its
    3448 # presence in a molecule.
    3449 #
    3450 # Key 158 description: C-N
    3451 #
    3452 sub _Generate166KeySetKey158 {
    3453   my($This) = @_;
    3454   my($BondOrder) = 1;
    3455
    3456   return $This->_DetectBondKeys('C', 'N', $BondOrder);
    3457 }
    3458
    3459 # Generate key 159 value as 1/0 indicating its presence/absence or count of its
    3460 # presence in a molecule.
    3461 #
    3462 # Key 159 description: O > 1
    3463 #
    3464 sub _Generate166KeySetKey159 {
    3465   my($This) = @_;
    3466   my($MinKeyCount) = 2;
    3467
    3468   return $This->_DetectAtomKeys('O', $MinKeyCount);
    3469 }
    3470
    3471 # Generate key 160 value as 1/0 indicating its presence/absence or count of its
    3472 # presence in a molecule.
    3473 #
    3474 # Key 160 description: CH3
    3475 #
    3476 sub _Generate166KeySetKey160 {
    3477   my($This) = @_;
    3478   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (undef, undef, 3);
    3479
    3480   return $This->_DetectAtomKeys('C', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3481 }
    3482
    3483 # Generate key 161 value as 1/0 indicating its presence/absence or count of its
    3484 # presence in a molecule.
    3485 #
    3486 # Key 161 description: N
    3487 #
    3488 sub _Generate166KeySetKey161 {
    3489   my($This) = @_;
    3490
    3491   return $This->_DetectAtomKeys('N');
    3492 }
    3493
    3494 # Generate key 162 value as 1/0 indicating its presence/absence or count of its
    3495 # presence in a molecule.
    3496 #
    3497 # Key 162 description: AROMATIC
    3498 #
    3499 sub _Generate166KeySetKey162 {
    3500   my($This) = @_;
    3501   my($Atom, $Molecule, $KeyValue);
    3502
    3503   # Check molecule aromatic property...
    3504   $Molecule = $This->GetMolecule();
    3505   if ($Molecule->IsAromatic()) {
    3506     return 1;
    3507   }
    3508
    3509   # Check aromatic property of each atom...
    3510   $KeyValue = 1;
    3511   ATOM: for $Atom (@{$This->{Atoms}}) {
    3512       if (!$Atom->IsAromatic()) {
    3513         $KeyValue = 0;
    3514         last ATOM;
    3515       }
    3516   }
    3517   return $KeyValue;
    3518 }
    3519
    3520 # Generate key 163 value as 1/0 indicating its presence/absence or count of its
    3521 # presence in a molecule.
    3522 #
    3523 # Key 163 description: 6M RING
    3524 #
    3525 sub _Generate166KeySetKey163 {
    3526   my($This) = @_;
    3527   my($Molecule, $KeyValue, $RingSize, $NumOfRings);
    3528
    3529   $RingSize = 6;
    3530   $Molecule = $This->GetMolecule();
    3531   $NumOfRings = $Molecule->GetNumOfRingsWithSize($RingSize);
    3532
    3533   if ($This->{KeyBits}) {
    3534     $KeyValue = $NumOfRings ? 1 : 0;
    3535   }
    3536   else {
    3537     $KeyValue = $NumOfRings;
    3538   }
    3539   return $KeyValue;
    3540 }
    3541
    3542 # Generate key 164 value as 1/0 indicating its presence/absence or count of its
    3543 # presence in a molecule.
    3544 #
    3545 # Key 164 description: O
    3546 #
    3547 sub _Generate166KeySetKey164 {
    3548   my($This) = @_;
    3549
    3550   return $This->_DetectAtomKeys('O');
    3551 }
    3552
    3553 # Generate key 165 value as 1/0 indicating its presence/absence or count of its
    3554 # presence in a molecule.
    3555 #
    3556 # Key 165 description: RING
    3557 #
    3558 sub _Generate166KeySetKey165 {
    3559   my($This) = @_;
    3560   my($Molecule, $KeyValue, $NumOfRings);
    3561
    3562   $Molecule = $This->GetMolecule();
    3563   $NumOfRings = $Molecule->GetNumOfRings();
    3564
    3565   if ($This->{KeyBits}) {
    3566     $KeyValue = $NumOfRings ? 1 : 0;
    3567   }
    3568   else {
    3569     $KeyValue = $NumOfRings;
    3570   }
    3571   return $KeyValue;
    3572 }
    3573
    3574 # Generate key 166 value as 1/0 indicating its presence/absence or count of its
    3575 # presence in a molecule.
    3576 #
    3577 # Key 166 description: FRAGMENTS
    3578 #
    3579 sub _Generate166KeySetKey166 {
    3580   my($This) = @_;
    3581   my($Molecule, $KeyValue, $NumOfComponents);
    3582
    3583   $Molecule = $This->GetMolecule();
    3584   $NumOfComponents = $Molecule->GetNumOfConnectedComponents();
    3585
    3586   if ($This->{KeyBits}) {
    3587     $KeyValue = ($NumOfComponents > 1) ? 1 : 0;
    3588   }
    3589   else {
    3590     $KeyValue = $NumOfComponents;
    3591   }
    3592   return $KeyValue;
    3593 }
    3594
    3595 ##################################
    3596 #
    3597 #  Implementation of MDL MACCS 322 keys...
    3598 #
    3599 ##################################
    3600
    3601 # Generate 322 keyset key 1 value as 1/0 indicating its presence/absence or
    3602 # count of its presence in a molecule.
    3603 #
    3604 # Key 1 description: A(AAA) or AA(A)A - atom with at least three neighbors
    3605 #
    3606 sub _Generate322KeySetKey1 {
    3607   my($This) = @_;
    3608   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3609
    3610   $CentralAtomSymbol = 'A';
    3611   @NbrAtomSymbols = ('A', 'A', 'A');
    3612   @NbrBondSymbols = (undef, undef, undef);
    3613
    3614   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3615 }
    3616
    3617 # Generate 322 keyset key 2 value as 1/0 indicating its presence/absence or
    3618 # count of its presence in a molecule.
    3619 #
    3620 # Key 2 description: Q - heteroatom
    3621 #
    3622 sub _Generate322KeySetKey2 {
    3623   my($This) = @_;
    3624
    3625   return $This->_DetectAtomKeys('Q');
    3626 }
    3627
    3628 # Generate 322 keyset key 3 value as 1/0 indicating its presence/absence or
    3629 # count of its presence in a molecule.
    3630 #
    3631 # Key 3 description: Anot%not-A - atom involved in one or more multiple bonds, not aromatic
    3632 #
    3633 sub _Generate322KeySetKey3 {
    3634   my($This) = @_;
    3635   my($BondSymbol) = 'not%not-';
    3636
    3637   return $This->_DetectBondKeys('A', 'A', $BondSymbol);
    3638 }
    3639
    3640 # Generate 322 keyset key 4 value as 1/0 indicating its presence/absence or
    3641 # count of its presence in a molecule.
    3642 #
    3643 # Key 4 description:      A(AAAA) or AA(A)(A)A - atom with at least four neighbors
    3644 #
    3645 sub _Generate322KeySetKey4 {
    3646   my($This) = @_;
    3647   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3648
    3649   $CentralAtomSymbol = 'A';
    3650   @NbrAtomSymbols = ('A', 'A', 'A', 'A');
    3651   @NbrBondSymbols = (undef, undef, undef, undef);
    3652
    3653   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3654 }
    3655
    3656 # Generate 322 keyset key 5 value as 1/0 indicating its presence/absence or
    3657 # count of its presence in a molecule.
    3658 #
    3659 # Key 5 description: A(QQ) or QA(Q) - atom with at least two heteroatom neighbors
    3660 #
    3661 sub _Generate322KeySetKey5 {
    3662   my($This) = @_;
    3663   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3664
    3665   $CentralAtomSymbol = 'A';
    3666   @NbrAtomSymbols = ('Q', 'Q');
    3667   @NbrBondSymbols = (undef, undef);
    3668
    3669   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3670 }
    3671
    3672 # Generate 322 keyset key 6 value as 1/0 indicating its presence/absence or
    3673 # count of its presence in a molecule.
    3674 #
    3675 # Key 6 description: A(QQQ) or QA(Q)Q - atom with at least three heteroatom neighbors
    3676 #
    3677 sub _Generate322KeySetKey6 {
    3678   my($This) = @_;
    3679   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3680
    3681   $CentralAtomSymbol = 'A';
    3682   @NbrAtomSymbols = ('Q', 'Q', 'Q');
    3683   @NbrBondSymbols = (undef, undef, undef);
    3684
    3685   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3686 }
    3687
    3688 # Generate 322 keyset key 7 value as 1/0 indicating its presence/absence or
    3689 # count of its presence in a molecule.
    3690 #
    3691 # Key 7 description:      QH - heteroatom with at least one hydrogen attached
    3692 #
    3693 sub _Generate322KeySetKey7 {
    3694   my($This) = @_;
    3695   my($MinKeyCount, $IsInRing, $MinHydrogenCount) = (undef, undef, 1);
    3696
    3697   return $This->_DetectAtomKeys('Q', $MinKeyCount, $IsInRing, $MinHydrogenCount);
    3698 }
    3699
    3700 # Generate 322 keyset key 8 value as 1/0 indicating its presence/absence or
    3701 # count of its presence in a molecule.
    3702 #
    3703 # Key 8 description: CH2(AA) or ACH2A - carbon with at least two single bonds and at least two hydrogens attached
    3704 #
    3705 sub _Generate322KeySetKey8 {
    3706   my($This) = @_;
    3707   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3708
    3709   $CentralAtomSymbol = 'C';
    3710   @NbrAtomSymbols = ('A', 'A');
    3711   @NbrBondSymbols = (undef, undef);
    3712   $MinKeyCount = undef;
    3713   $CentralAtomMinHydrogenCount = 2;
    3714
    3715   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    3716 }
    3717
    3718 # Generate 322 keyset key 9 value as 1/0 indicating its presence/absence or
    3719 # count of its presence in a molecule.
    3720 #
    3721 # Key 9 description: CH3(A) or ACH3 - carbon with at least one single bond and at least three hydrogens attached
    3722 #
    3723 sub _Generate322KeySetKey9 {
    3724   my($This) = @_;
    3725   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3726
    3727   $CentralAtomSymbol = 'C';
    3728   @NbrAtomSymbols = ('A');
    3729   @NbrBondSymbols = (undef);
    3730   $MinKeyCount = undef;
    3731   $CentralAtomMinHydrogenCount = 3;
    3732
    3733   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount);
    3734 }
    3735
    3736 # Generate 322 keyset key 10 value as 1/0 indicating its presence/absence or
    3737 # count of its presence in a molecule.
    3738 #
    3739 # Key 10 description: Halogen
    3740 #
    3741 sub _Generate322KeySetKey10 {
    3742   my($This) = @_;
    3743
    3744   return $This->_DetectAtomKeys('X');
    3745 }
    3746
    3747 # Generate 322 keyset key 11 value as 1/0 indicating its presence/absence or
    3748 # count of its presence in a molecule.
    3749 #
    3750 # Key 11 description: A(-A-A-A) or A-A(-A)-A - atom has at least three single bonds
    3751 #
    3752 sub _Generate322KeySetKey11 {
    3753   my($This) = @_;
    3754   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3755
    3756   $CentralAtomSymbol = 'A';
    3757   @NbrAtomSymbols = ('A', 'A', 'A');
    3758   @NbrBondSymbols = ('-', '-', '-');
    3759
    3760   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3761 }
    3762
    3763 # Generate 322 keyset key 12 value as 1/0 indicating its presence/absence or
    3764 # count of its presence in a molecule.
    3765 #
    3766 # Key 12 description: AAAAAA@1 >= 2 - atom is in at least two different six-membered rings
    3767 #
    3768 sub _Generate322KeySetKey12 {
    3769   my($This) = @_;
    3770   my($Atom, $KeyValue, $RingSize, $NumOfRings);
    3771
    3772   $RingSize = 6;
    3773   $KeyValue = 0;
    3774
    3775   ATOM: for $Atom (@{$This->{Atoms}}) {
    3776     if (!$This->_IsAtom($Atom)) {
    3777       next ATOM;
    3778     }
    3779     $NumOfRings = $Atom->GetNumOfRingsWithSize($RingSize);
    3780     if ($NumOfRings >= 2) {
    3781       $KeyValue++;
    3782       if ($This->{KeyBits}) {
    3783         $KeyValue = 1;
    3784         last ATOM;
    3785       }
    3786     }
    3787   }
    3788   return $KeyValue;
    3789 }
    3790
    3791 # Generate 322 keyset key 13 value as 1/0 indicating its presence/absence or
    3792 # count of its presence in a molecule.
    3793 #
    3794 # Key 13 description: A($A$A$A) or A$A($A)$A - atom has more than two ring bonds (at least three ring bonds)
    3795 #
    3796 sub _Generate322KeySetKey13 {
    3797   my($This) = @_;
    3798   my($CentralAtomSymbol, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols);
    3799
    3800   $CentralAtomSymbol = 'A';
    3801   @NbrAtomSymbols = ('A', 'A', 'A');
    3802   @NbrBondSymbols = ('$', '$', '$');
    3803
    3804   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3805 }
    3806
    3807 # Generate 322 keyset key 14 value as 1/0 indicating its presence/absence or
    3808 # count of its presence in a molecule.
    3809 #
    3810 # Key 14 description: A$A!A$A - atom is at a ring/chain boundary. When a comparison is
    3811 #                     done with another atom the path passes through the chain bond.
    3812 #
    3813 sub _Generate322KeySetKey14 {
    3814   my($This) = @_;
    3815   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    3816
    3817   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    3818   $BondSymbol = '!';
    3819
    3820   @NbrAtomsSymbols = (['A'], ['A']);
    3821   @NbrAtomsBondSymbols = (['$'], ['$']);
    3822   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    3823 }
    3824
    3825 # Generate 322 keyset key 15 value as 1/0 indicating its presence/absence or
    3826 # count of its presence in a molecule.
    3827 #
    3828 # Key 15 description:  Anot%A%Anot%A - atom is at an aromatic/nonaromatic boundary.
    3829 #                      When a comparison is done with another atom the path passes through the aromatic bond.
    3830 #
    3831 sub _Generate322KeySetKey15 {
    3832   my($This) = @_;
    3833   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    3834
    3835   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    3836   $BondSymbol = '%';
    3837
    3838   @NbrAtomsSymbols = (['A'], ['A']);
    3839   @NbrAtomsBondSymbols = (['not%'], ['not%']);
    3840   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    3841 }
    3842
    3843 # Generate 322 keyset key 16 value as 1/0 indicating its presence/absence or
    3844 # count of its presence in a molecule.
    3845 #
    3846 # Key 16 description:     A!A!A  - atom with more than one chain bond
    3847 #
    3848 sub _Generate322KeySetKey16 {
    3849   my($This) = @_;
    3850   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    3851
    3852   $CentralAtomSymbol = 'A';
    3853   @NbrAtomSymbols = ('A', 'A');
    3854   @NbrBondSymbols = ('!', '!');
    3855
    3856   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    3857 }
    3858
    3859 # Generate 322 keyset key 17 value as 1/0 indicating its presence/absence or
    3860 # count of its presence in a molecule.
    3861 #
    3862 # Key 17 description: A!A$A!A - atom is at a ring/chain boundary. When a comparison
    3863 #                     is done  with another atom the path passes through the ring bond.
    3864 #
    3865 sub _Generate322KeySetKey17 {
    3866   my($This) = @_;
    3867   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    3868
    3869   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    3870   $BondSymbol = '$';
    3871
    3872   @NbrAtomsSymbols = (['A'], ['A']);
    3873   @NbrAtomsBondSymbols = (['!'], ['!']);
    3874   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    3875 }
    3876
    3877 # Generate 322 keyset key 18 value as 1/0 indicating its presence/absence or
    3878 # count of its presence in a molecule.
    3879 #
    3880 # Key 18 description: A%Anot%A%A - atom is at an aromatic/nonaromatic boundary.
    3881 #                     When a comparison is done with another atom the path passes through
    3882 #                     the nonaromatic bond
    3883 #
    3884 sub _Generate322KeySetKey18 {
    3885   my($This) = @_;
    3886   my($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, @NbrAtomsSymbols, @NbrAtomsBondSymbols);
    3887
    3888   ($BondAtomSymbol1, $BondAtomSymbol2) = ('A', 'A');
    3889   $BondSymbol = 'not%';
    3890
    3891   @NbrAtomsSymbols = (['A'], ['A']);
    3892   @NbrAtomsBondSymbols = (['%'], ['%']);
    3893   return $This->_DetectBondNeighborhoodKeys($BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, \@NbrAtomsSymbols, \@NbrAtomsBondSymbols);
    3894 }
    3895
    3896 # Generate 322 keyset key 19 value as 1/0 indicating its presence/absence or
    3897 # count of its presence in a molecule.
    3898 #
    3899 # Key 19 description: HETEROCYCLE - atom is a heteroatom in a ring.
    3900 #
    3901 sub _Generate322KeySetKey19 {
    3902   my($This) = @_;
    3903   my($MinKeyCount, $IsInRing) = (undef, 1);
    3904
    3905   return $This->_DetectAtomKeys('Q', $MinKeyCount, $IsInRing);
    3906 }
    3907
    3908 # Generate 322 keyset key 20 value as 1/0 indicating its presence/absence or
    3909 # count of its presence in a molecule.
    3910 #
    3911 # Key 20 description: rare properties: atom with five or more neighbors, atom in four
    3912 #                     or more rings, or atom types other than  H, C, N, O, S, F, Cl, Br, or I
    3913 #
    3914 sub _Generate322KeySetKey20 {
    3915   my($This) = @_;
    3916   my($Atom, $KeyValue);
    3917
    3918   $KeyValue = 0;
    3919   ATOM: for $Atom (@{$This->{Atoms}}) {
    3920     if (!($Atom->GetAtomicNumber() !~ /^(1|6|7|8|9|16|17|35|53)$/) || ($Atom->GetNumOfRings() >= 4) || ($Atom->GetNumOfNeighbors() >= 5) ) {
    3921       next ATOM;
    3922     }
    3923     $KeyValue++;
    3924     if ($This->{KeyBits}) {
    3925       $KeyValue = 1;
    3926       last ATOM;
    3927     }
    3928   }
    3929   return $KeyValue;
    3930 }
    3931
    3932 # Generate 322 keyset key 21 value as 1/0 indicating its presence/absence or
    3933 # count of its presence in a molecule.
    3934 #
    3935 # Key 21 description: rare properties: atom has a charge, is an isotope, has
    3936 #                     two or more multiple bonds, or has a triple bond.
    3937 #
    3938 sub _Generate322KeySetKey21 {
    3939   my($This) = @_;
    3940   my($Atom, $KeyValue);
    3941
    3942   $KeyValue = 0;
    3943   ATOM: for $Atom (@{$This->{Atoms}}) {
    3944     if ( !($Atom->IsIsotope() || $Atom->GetFormalCharge()) ) {
    3945       # Look for multiple and triple bonds...
    3946       my($Bond, $NumOfTripleBonds, $NumOfMultipleBonds);
    3947
    3948       ($NumOfTripleBonds, $NumOfMultipleBonds) = (0, 0);
    3949       BOND: for $Bond ($Atom->GetBonds()) {
    3950         if ($Bond->IsSingle()) { next BOND; }
    3951         if ($Bond->IsDouble()) { $NumOfMultipleBonds++; next BOND; }
    3952         if ($Bond->IsTriple()) { $NumOfTripleBonds++; next BOND; }
    3953       }
    3954       if ( !($NumOfTripleBonds || ($NumOfMultipleBonds >= 2)) ) {
    3955         next ATOM;
    3956       }
    3957     }
    3958     $KeyValue++;
    3959     if ($This->{KeyBits}) {
    3960       $KeyValue = 1;
    3961       last ATOM;
    3962     }
    3963   }
    3964   return $KeyValue;
    3965 }
    3966
    3967 # Generate 322 keyset key 22 value as 1/0 indicating its presence/absence or
    3968 # count of its presence in a molecule.
    3969 #
    3970 # Key 22 description:  N - nitrogen
    3971 #
    3972 sub _Generate322KeySetKey22 {
    3973   my($This) = @_;
    3974
    3975   return $This->_DetectAtomKeys('N');
    3976 }
    3977
    3978 # Generate 322 keyset key 23 value as 1/0 indicating its presence/absence or
    3979 # count of its presence in a molecule.
    3980 #
    3981 # Key 23 description: S - sulfur
    3982 #
    3983 sub _Generate322KeySetKey23 {
    3984   my($This) = @_;
    3985
    3986   return $This->_DetectAtomKeys('S');
    3987 }
    3988
    3989 # Generate 322 keyset key 24 value as 1/0 indicating its presence/absence or
    3990 # count of its presence in a molecule.
    3991 #
    3992 # Key 24 description: O - oxygen
    3993 #
    3994 sub _Generate322KeySetKey24 {
    3995   my($This) = @_;
    3996
    3997   return $This->_DetectAtomKeys('O');
    3998 }
    3999
    4000 # Generate 322 keyset key 25 value as 1/0 indicating its presence/absence or
    4001 # count of its presence in a molecule.
    4002 #
    4003 # Key 25 description: A(AA)A(A)A(AA) - atom has two neighbors, each with
    4004 #                     three or more neighbors (including the central atom).
    4005 #
    4006 sub _Generate322KeySetKey25 {
    4007   my($This) = @_;
    4008   my($MinKeyCount, @CentralAtomsSymbols, @NbrAtomsSymbols);
    4009
    4010   @CentralAtomsSymbols = ('A', 'A', 'A');
    4011   @NbrAtomsSymbols = (['A', 'A'], ['A'], ['A', 'A']);
    4012
    4013   return $This->_DetectExtendedAtomNeighborhoodKeys(\@CentralAtomsSymbols, undef, undef, undef, \@NbrAtomsSymbols);
    4014 }
    4015
    4016 # Generate 322 keyset key 26 value as 1/0 indicating its presence/absence or
    4017 # count of its presence in a molecule.
    4018 #
    4019 # Key 26 description:     CH2ACH2 - atom has two hydrocarbon (CH2) neighbors
    4020 #
    4021 sub _Generate322KeySetKey26 {
    4022   my($This) = @_;
    4023   my($CentralAtomSymbol, $CentralAtomMinHydrogenCount, $MinKeyCount, @NbrAtomSymbols, @NbrBondSymbols, @NbrAtomMinHydrogenCount);
    4024
    4025   $CentralAtomSymbol = 'A';
    4026   $CentralAtomMinHydrogenCount = undef;
    4027
    4028   @NbrAtomSymbols = ('C', 'C');
    4029   @NbrBondSymbols = (undef, undef);
    4030   @NbrAtomMinHydrogenCount = (2, 2);
    4031
    4032   $MinKeyCount = undef;
    4033
    4034   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinKeyCount, $CentralAtomMinHydrogenCount, \@NbrAtomMinHydrogenCount);
    4035 }
    4036
    4037 # Generate 322 keyset key 27 value as 1/0 indicating its presence/absence or
    4038 # count of its presence in a molecule.
    4039 #
    4040 # Key 27 description: C(CC)
    4041 #
    4042 sub _Generate322KeySetKey27 {
    4043   my($This) = @_;
    4044   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4045
    4046   $CentralAtomSymbol = 'C';
    4047   @NbrAtomSymbols = ('C', 'C');
    4048   @NbrBondSymbols = (undef, undef);
    4049
    4050   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4051 }
    4052
    4053 # Generate 322 keyset key 28 value as 1/0 indicating its presence/absence or
    4054 # count of its presence in a molecule.
    4055 #
    4056 # Key 28 description: C(CCC)
    4057 #
    4058 sub _Generate322KeySetKey28 {
    4059   my($This) = @_;
    4060   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4061
    4062   $CentralAtomSymbol = 'C';
    4063   @NbrAtomSymbols = ('C', 'C', 'C');
    4064   @NbrBondSymbols = (undef, undef, undef);
    4065
    4066   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4067 }
    4068
    4069 # Generate 322 keyset key 29 value as 1/0 indicating its presence/absence or
    4070 # count of its presence in a molecule.
    4071 #
    4072 # Key 29 description: C(CN)
    4073 #
    4074 sub _Generate322KeySetKey29 {
    4075   my($This) = @_;
    4076   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4077
    4078   $CentralAtomSymbol = 'C';
    4079   @NbrAtomSymbols = ('C', 'N');
    4080   @NbrBondSymbols = (undef, undef);
    4081
    4082   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4083 }
    4084
    4085 # Generate 322 keyset key 30 value as 1/0 indicating its presence/absence or
    4086 # count of its presence in a molecule.
    4087 #
    4088 # Key 30 description: C(CCN)
    4089 #
    4090 sub _Generate322KeySetKey30 {
    4091   my($This) = @_;
    4092   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4093
    4094   $CentralAtomSymbol = 'C';
    4095   @NbrAtomSymbols = ('C', 'C', 'N');
    4096   @NbrBondSymbols = (undef, undef, undef);
    4097
    4098   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4099 }
    4100
    4101 # Generate 322 keyset key 31 value as 1/0 indicating its presence/absence or
    4102 # count of its presence in a molecule.
    4103 #
    4104 # Key 31 description: C(NN)
    4105 #
    4106 sub _Generate322KeySetKey31 {
    4107   my($This) = @_;
    4108   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4109
    4110   $CentralAtomSymbol = 'C';
    4111   @NbrAtomSymbols = ('N', 'N');
    4112   @NbrBondSymbols = (undef, undef);
    4113
    4114   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4115 }
    4116
    4117 # Generate 322 keyset key 32 value as 1/0 indicating its presence/absence or
    4118 # count of its presence in a molecule.
    4119 #
    4120 # Key 32 description: C(NNC)
    4121 #
    4122 sub _Generate322KeySetKey32 {
    4123   my($This) = @_;
    4124   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4125
    4126   $CentralAtomSymbol = 'C';
    4127   @NbrAtomSymbols = ('N', 'N', 'C');
    4128   @NbrBondSymbols = (undef, undef, undef);
    4129
    4130   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4131 }
    4132
    4133 # Generate 322 keyset key 33 value as 1/0 indicating its presence/absence or
    4134 # count of its presence in a molecule.
    4135 #
    4136 # Key 33 description: C(NNN)
    4137 #
    4138 sub _Generate322KeySetKey33 {
    4139   my($This) = @_;
    4140   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4141
    4142   $CentralAtomSymbol = 'C';
    4143   @NbrAtomSymbols = ('N', 'N', 'N');
    4144   @NbrBondSymbols = (undef, undef, undef);
    4145
    4146   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4147 }
    4148
    4149 # Generate 322 keyset key 34 value as 1/0 indicating its presence/absence or
    4150 # count of its presence in a molecule.
    4151 #
    4152 # Key 34 description: C(CO)
    4153 #
    4154 sub _Generate322KeySetKey34 {
    4155   my($This) = @_;
    4156   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4157
    4158   $CentralAtomSymbol = 'C';
    4159   @NbrAtomSymbols = ('C', 'O');
    4160   @NbrBondSymbols = (undef, undef);
    4161
    4162   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4163 }
    4164
    4165 # Generate 322 keyset key 35 value as 1/0 indicating its presence/absence or
    4166 # count of its presence in a molecule.
    4167 #
    4168 # Key 35 description: C(CCO)
    4169 #
    4170 sub _Generate322KeySetKey35 {
    4171   my($This) = @_;
    4172   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4173
    4174   $CentralAtomSymbol = 'C';
    4175   @NbrAtomSymbols = ('C', 'C', 'O');
    4176   @NbrBondSymbols = (undef, undef, undef);
    4177
    4178   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4179 }
    4180
    4181 # Generate 322 keyset key 36 value as 1/0 indicating its presence/absence or
    4182 # count of its presence in a molecule.
    4183 #
    4184 # Key 36 description: C(NO)
    4185 #
    4186 sub _Generate322KeySetKey36 {
    4187   my($This) = @_;
    4188   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4189
    4190   $CentralAtomSymbol = 'C';
    4191   @NbrAtomSymbols = ('N', 'O');
    4192   @NbrBondSymbols = (undef, undef);
    4193
    4194   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4195 }
    4196
    4197 # Generate 322 keyset key 37 value as 1/0 indicating its presence/absence or
    4198 # count of its presence in a molecule.
    4199 #
    4200 # Key 37 description: C(NCO)
    4201 #
    4202 sub _Generate322KeySetKey37 {
    4203   my($This) = @_;
    4204   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4205
    4206   $CentralAtomSymbol = 'C';
    4207   @NbrAtomSymbols = ('N', 'C', 'O');
    4208   @NbrBondSymbols = (undef, undef, undef);
    4209
    4210   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4211 }
    4212
    4213 # Generate 322 keyset key 38 value as 1/0 indicating its presence/absence or
    4214 # count of its presence in a molecule.
    4215 #
    4216 # Key 38 description: C(NNO)
    4217 #
    4218 sub _Generate322KeySetKey38 {
    4219   my($This) = @_;
    4220   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4221
    4222   $CentralAtomSymbol = 'C';
    4223   @NbrAtomSymbols = ('N', 'N', 'O');
    4224   @NbrBondSymbols = (undef, undef, undef);
    4225
    4226   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4227 }
    4228
    4229 # Generate 322 keyset key 39 value as 1/0 indicating its presence/absence or
    4230 # count of its presence in a molecule.
    4231 #
    4232 # Key 39 description: C(OO)
    4233 #
    4234 sub _Generate322KeySetKey39 {
    4235   my($This) = @_;
    4236   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4237
    4238   $CentralAtomSymbol = 'C';
    4239   @NbrAtomSymbols = ('O', 'O');
    4240   @NbrBondSymbols = (undef, undef);
    4241
    4242   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4243 }
    4244
    4245 # Generate 322 keyset key 40 value as 1/0 indicating its presence/absence or
    4246 # count of its presence in a molecule.
    4247 #
    4248 # Key 40 description: C(COO)
    4249 #
    4250 sub _Generate322KeySetKey40 {
    4251   my($This) = @_;
    4252   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4253
    4254   $CentralAtomSymbol = 'C';
    4255   @NbrAtomSymbols = ('C', 'O', 'O');
    4256   @NbrBondSymbols = (undef, undef, undef);
    4257
    4258   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4259 }
    4260
    4261 # Generate 322 keyset key 41 value as 1/0 indicating its presence/absence or
    4262 # count of its presence in a molecule.
    4263 #
    4264 # Key 41 description: C(NOO)
    4265 #
    4266 sub _Generate322KeySetKey41 {
    4267   my($This) = @_;
    4268   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4269
    4270   $CentralAtomSymbol = 'C';
    4271   @NbrAtomSymbols = ('N', 'O', 'O');
    4272   @NbrBondSymbols = (undef, undef, undef);
    4273
    4274   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4275 }
    4276
    4277 # Generate 322 keyset key 42 value as 1/0 indicating its presence/absence or
    4278 # count of its presence in a molecule.
    4279 #
    4280 # Key 42 description: C(OOO)
    4281 #
    4282 sub _Generate322KeySetKey42 {
    4283   my($This) = @_;
    4284   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4285
    4286   $CentralAtomSymbol = 'C';
    4287   @NbrAtomSymbols = ('O', 'O', 'O');
    4288   @NbrBondSymbols = (undef, undef, undef);
    4289
    4290   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4291 }
    4292
    4293 # Generate 322 keyset key 43 value as 1/0 indicating its presence/absence or
    4294 # count of its presence in a molecule.
    4295 #
    4296 # Key 43 description: Q(CC)
    4297 #
    4298 sub _Generate322KeySetKey43 {
    4299   my($This) = @_;
    4300   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4301
    4302   $CentralAtomSymbol = 'Q';
    4303   @NbrAtomSymbols = ('C', 'C');
    4304   @NbrBondSymbols = (undef, undef);
    4305
    4306   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4307 }
    4308
    4309 # Generate 322 keyset key 44 value as 1/0 indicating its presence/absence or
    4310 # count of its presence in a molecule.
    4311 #
    4312 # Key 44 description: Q(CCC)
    4313 #
    4314 sub _Generate322KeySetKey44 {
    4315   my($This) = @_;
    4316   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4317
    4318   $CentralAtomSymbol = 'Q';
    4319   @NbrAtomSymbols = ('C', 'C', 'C');
    4320   @NbrBondSymbols = (undef, undef, undef);
    4321
    4322   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4323 }
    4324
    4325 # Generate 322 keyset key 45 value as 1/0 indicating its presence/absence or
    4326 # count of its presence in a molecule.
    4327 #
    4328 # Key 45 description: Q(CN)
    4329 #
    4330 sub _Generate322KeySetKey45 {
    4331   my($This) = @_;
    4332   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4333
    4334   $CentralAtomSymbol = 'Q';
    4335   @NbrAtomSymbols = ('C', 'N');
    4336   @NbrBondSymbols = (undef, undef);
    4337
    4338   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4339 }
    4340
    4341 # Generate 322 keyset key 46 value as 1/0 indicating its presence/absence or
    4342 # count of its presence in a molecule.
    4343 #
    4344 # Key 46 description: Q(CCN)
    4345 #
    4346 sub _Generate322KeySetKey46 {
    4347   my($This) = @_;
    4348   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4349
    4350   $CentralAtomSymbol = 'Q';
    4351   @NbrAtomSymbols = ('C', 'C', 'N');
    4352   @NbrBondSymbols = (undef, undef, undef);
    4353
    4354   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4355 }
    4356
    4357 # Generate 322 keyset key 47 value as 1/0 indicating its presence/absence or
    4358 # count of its presence in a molecule.
    4359 #
    4360 # Key 47 description: Q(NN)
    4361 #
    4362 sub _Generate322KeySetKey47 {
    4363   my($This) = @_;
    4364   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4365
    4366   $CentralAtomSymbol = 'Q';
    4367   @NbrAtomSymbols = ('N', 'N');
    4368   @NbrBondSymbols = (undef, undef);
    4369
    4370   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4371 }
    4372
    4373 # Generate 322 keyset key 48 value as 1/0 indicating its presence/absence or
    4374 # count of its presence in a molecule.
    4375 #
    4376 # Key 48 description: Q(CNN)
    4377 #
    4378 sub _Generate322KeySetKey48 {
    4379   my($This) = @_;
    4380   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4381
    4382   $CentralAtomSymbol = 'Q';
    4383   @NbrAtomSymbols = ('C', 'N', 'N');
    4384   @NbrBondSymbols = (undef, undef, undef);
    4385
    4386   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4387 }
    4388
    4389 # Generate 322 keyset key 49 value as 1/0 indicating its presence/absence or
    4390 # count of its presence in a molecule.
    4391 #
    4392 # Key 49 description: Q(NNN)
    4393 #
    4394 sub _Generate322KeySetKey49 {
    4395   my($This) = @_;
    4396   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4397
    4398   $CentralAtomSymbol = 'Q';
    4399   @NbrAtomSymbols = ('N', 'N', 'N');
    4400   @NbrBondSymbols = (undef, undef, undef);
    4401
    4402   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4403 }
    4404
    4405 # Generate 322 keyset key 50 value as 1/0 indicating its presence/absence or
    4406 # count of its presence in a molecule.
    4407 #
    4408 # Key 50 description: Q(CO)
    4409 #
    4410 sub _Generate322KeySetKey50 {
    4411   my($This) = @_;
    4412   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4413
    4414   $CentralAtomSymbol = 'Q';
    4415   @NbrAtomSymbols = ('C', 'O');
    4416   @NbrBondSymbols = (undef, undef);
    4417
    4418   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4419 }
    4420
    4421 # Generate 322 keyset key 51 value as 1/0 indicating its presence/absence or
    4422 # count of its presence in a molecule.
    4423 #
    4424 # Key 51 description: Q(CCO)
    4425 #
    4426 sub _Generate322KeySetKey51 {
    4427   my($This) = @_;
    4428   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4429
    4430   $CentralAtomSymbol = 'Q';
    4431   @NbrAtomSymbols = ('C', 'C', 'O');
    4432   @NbrBondSymbols = (undef, undef, undef);
    4433
    4434   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4435 }
    4436
    4437 # Generate 322 keyset key 52 value as 1/0 indicating its presence/absence or
    4438 # count of its presence in a molecule.
    4439 #
    4440 # Key 52 description: Q(NO)
    4441 #
    4442 sub _Generate322KeySetKey52 {
    4443   my($This) = @_;
    4444   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4445
    4446   $CentralAtomSymbol = 'Q';
    4447   @NbrAtomSymbols = ('N', 'O');
    4448   @NbrBondSymbols = (undef, undef);
    4449
    4450   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4451 }
    4452
    4453 # Generate 322 keyset key 53 value as 1/0 indicating its presence/absence or
    4454 # count of its presence in a molecule.
    4455 #
    4456 # Key 53 description: Q(CNO)
    4457 #
    4458 sub _Generate322KeySetKey53 {
    4459   my($This) = @_;
    4460   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4461
    4462   $CentralAtomSymbol = 'Q';
    4463   @NbrAtomSymbols = ('C', 'N', 'O');
    4464   @NbrBondSymbols = (undef, undef, undef);
    4465
    4466   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4467 }
    4468
    4469 # Generate 322 keyset key 54 value as 1/0 indicating its presence/absence or
    4470 # count of its presence in a molecule.
    4471 #
    4472 # Key 54 description: Q(NNO)
    4473 #
    4474 sub _Generate322KeySetKey54 {
    4475   my($This) = @_;
    4476   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4477
    4478   $CentralAtomSymbol = 'Q';
    4479   @NbrAtomSymbols = ('N', 'N', 'O');
    4480   @NbrBondSymbols = (undef, undef, undef);
    4481
    4482   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4483 }
    4484
    4485 # Generate 322 keyset key 55 value as 1/0 indicating its presence/absence or
    4486 # count of its presence in a molecule.
    4487 #
    4488 # Key 55 description: Q(OO)
    4489 #
    4490 sub _Generate322KeySetKey55 {
    4491   my($This) = @_;
    4492   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4493
    4494   $CentralAtomSymbol = 'Q';
    4495   @NbrAtomSymbols = ('O', 'O');
    4496   @NbrBondSymbols = (undef, undef);
    4497
    4498   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4499 }
    4500
    4501 # Generate 322 keyset key 56 value as 1/0 indicating its presence/absence or
    4502 # count of its presence in a molecule.
    4503 #
    4504 # Key 56 description: Q(COO)
    4505 #
    4506 sub _Generate322KeySetKey56 {
    4507   my($This) = @_;
    4508   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4509
    4510   $CentralAtomSymbol = 'Q';
    4511   @NbrAtomSymbols = ('C', 'O', 'O');
    4512   @NbrBondSymbols = (undef, undef, undef);
    4513
    4514   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4515 }
    4516
    4517 # Generate 322 keyset key 57 value as 1/0 indicating its presence/absence or
    4518 # count of its presence in a molecule.
    4519 #
    4520 # Key 57 description: Q(NOO)
    4521 #
    4522 sub _Generate322KeySetKey57 {
    4523   my($This) = @_;
    4524   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4525
    4526   $CentralAtomSymbol = 'Q';
    4527   @NbrAtomSymbols = ('N', 'O', 'O');
    4528   @NbrBondSymbols = (undef, undef, undef);
    4529
    4530   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4531 }
    4532
    4533 # Generate 322 keyset key 58 value as 1/0 indicating its presence/absence or
    4534 # count of its presence in a molecule.
    4535 #
    4536 # Key 58 description: Q(OOO)
    4537 #
    4538 sub _Generate322KeySetKey58 {
    4539   my($This) = @_;
    4540   my($CentralAtomSymbol, @NbrAtomSymbols, @NbrBondSymbols);
    4541
    4542   $CentralAtomSymbol = 'Q';
    4543   @NbrAtomSymbols = ('O', 'O', 'O');
    4544   @NbrBondSymbols = (undef, undef, undef);
    4545
    4546   return $This->_DetectAtomNeighborhoodKeys($CentralAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols);
    4547 }
    4548
    4549 # Generate 322 keyset key 59 value as 1/0 indicating its presence/absence or
    4550 # count of its presence in a molecule.
    4551 #
    4552 # Key 59 description: C-C
    4553 #
    4554 sub _Generate322KeySetKey59 {
    4555   my($This) = @_;
    4556   my($BondSymbol) = '-';
    4557
    4558   return $This->_DetectBondKeys('C', 'C', $BondSymbol);
    4559 }
    4560
    4561 # Generate 322 keyset key 60 value as 1/0 indicating its presence/absence or
    4562 # count of its presence in a molecule.
    4563 #
    4564 # Key 60 description: C-N
    4565 #
    4566 sub _Generate322KeySetKey60 {
    4567   my($This) = @_;
    4568   my($BondSymbol) = '-';
    4569
    4570   return $This->_DetectBondKeys('C', 'N', $BondSymbol);
    4571 }
    4572
    4573 # Generate 322 keyset key 61 value as 1/0 indicating its presence/absence or
    4574 # count of its presence in a molecule.
    4575 #
    4576 # Key 61 description: C-O
    4577 #
    4578 sub _Generate322KeySetKey61 {
    4579   my($This) = @_;
    4580   my($BondSymbol) = '-';
    4581
    4582   return $This->_DetectBondKeys('C', 'O', $BondSymbol);
    4583 }
    4584
    4585 # Generate 322 keyset key 62 value as 1/0 indicating its presence/absence or
    4586 # count of its presence in a molecule.
    4587 #
    4588 # Key 62 description: C-S
    4589 #
    4590 sub _Generate322KeySetKey62 {
    4591   my($This) = @_;
    4592   my($BondSymbol) = '-';
    4593
    4594   return $This->_DetectBondKeys('C', 'S', $BondSymbol);
    4595 }
    4596
    4597 # Generate 322 keyset key 63 value as 1/0 indicating its presence/absence or
    4598 # count of its presence in a molecule.
    4599 #
    4600 # Key 63 description: C-Cl
    4601 #
    4602 sub _Generate322KeySetKey63 {
    4603   my($This) = @_;
    4604   my($BondSymbol) = '-';
    4605
    4606   return $This->_DetectBondKeys('C', 'Cl', $BondSymbol);
    4607 }
    4608
    4609 # Generate 322 keyset key 64 value as 1/0 indicating its presence/absence or
    4610 # count of its presence in a molecule.
    4611 #
    4612 # Key 64 description: C-P
    4613 #
    4614 sub _Generate322KeySetKey64 {
    4615   my($This) = @_;
    4616   my($BondSymbol) = '-';
    4617
    4618   return $This->_DetectBondKeys('C', 'P', $BondSymbol);
    4619 }
    4620
    4621 # Generate 322 keyset key 65 value as 1/0 indicating its presence/absence or
    4622 # count of its presence in a molecule.
    4623 #
    4624 # Key 65 description: C-F
    4625 #
    4626 sub _Generate322KeySetKey65 {
    4627   my($This) = @_;
    4628   my($BondSymbol) = '-';
    4629
    4630   return $This->_DetectBondKeys('C', 'F', $BondSymbol);
    4631 }
    4632
    4633 # Generate 322 keyset key 66 value as 1/0 indicating its presence/absence or
    4634 # count of its presence in a molecule.
    4635 #
    4636 # Key 66 description: C-Br
    4637 #
    4638 sub _Generate322KeySetKey66 {
    4639   my($This) = @_;
    4640   my($BondSymbol) = '-';
    4641
    4642   return $This->_DetectBondKeys('C', 'Br', $BondSymbol);
    4643 }
    4644
    4645 # Generate 322 keyset key 67 value as 1/0 indicating its presence/absence or
    4646 # count of its presence in a molecule.
    4647 #
    4648 # Key 67 description: C-Si
    4649 #
    4650 sub _Generate322KeySetKey67 {
    4651   my($This) = @_;
    4652   my($BondSymbol) = '-';
    4653
    4654   return $This->_DetectBondKeys('C', 'Si', $BondSymbol);
    4655 }
    4656
    4657 # Generate 322 keyset key 68 value as 1/0 indicating its presence/absence or
    4658 # count of its presence in a molecule.
    4659 #
    4660 # Key 68 description: C-I
    4661 #
    4662 sub _Generate322KeySetKey68 {
    4663   my($This) = @_;
    4664   my($BondSymbol) = '-';
    4665
    4666   return $This->_DetectBondKeys('C', 'I', $BondSymbol);
    4667 }
    4668
    4669 # Generate 322 keyset key 69 value as 1/0 indicating its presence/absence or
    4670 # count of its presence in a molecule.
    4671 #
    4672 # Key 69 description: C-X
    4673 #
    4674 sub _Generate322KeySetKey69 {
    4675   my($This) = @_;
    4676   my($BondSymbol) = '-';
    4677
    4678   return $This->_DetectBondKeys('C', 'Z', $BondSymbol);
    4679 }
    4680
    4681 # Generate 322 keyset key 70 value as 1/0 indicating its presence/absence or
    4682 # count of its presence in a molecule.
    4683 #
    4684 # Key 70 description: N-N
    4685 #
    4686 sub _Generate322KeySetKey70 {
    4687   my($This) = @_;
    4688   my($BondSymbol) = '-';
    4689
    4690   return $This->_DetectBondKeys('N', 'N', $BondSymbol);
    4691 }
    4692
    4693 # Generate 322 keyset key 71 value as 1/0 indicating its presence/absence or
    4694 # count of its presence in a molecule.
    4695 #
    4696 # Key 71 description: N-O
    4697 #
    4698 sub _Generate322KeySetKey71 {
    4699   my($This) = @_;
    4700   my($BondSymbol) = '-';
    4701
    4702   return $This->_DetectBondKeys('N', 'O', $BondSymbol);
    4703 }
    4704
    4705 # Generate 322 keyset key 72 value as 1/0 indicating its presence/absence or
    4706 # count of its presence in a molecule.
    4707 #
    4708 # Key 72 description: N-S
    4709 #
    4710 sub _Generate322KeySetKey72 {
    4711   my($This) = @_;
    4712   my($BondSymbol) = '-';
    4713
    4714   return $This->_DetectBondKeys('N', 'S', $BondSymbol);
    4715 }
    4716
    4717 # Generate 322 keyset key 73 value as 1/0 indicating its presence/absence or
    4718 # count of its presence in a molecule.
    4719 #
    4720 # Key 73 description: N-Cl
    4721 #
    4722 sub _Generate322KeySetKey73 {
    4723   my($This) = @_;
    4724   my($BondSymbol) = '-';
    4725
    4726   return $This->_DetectBondKeys('N', 'Cl', $BondSymbol);
    4727 }
    4728
    4729 # Generate 322 keyset key 74 value as 1/0 indicating its presence/absence or
    4730 # count of its presence in a molecule.
    4731 #
    4732 # Key 74 description: N-P
    4733 #
    4734 sub _Generate322KeySetKey74 {
    4735   my($This) = @_;
    4736   my($BondSymbol) = '-';
    4737
    4738   return $This->_DetectBondKeys('N', 'P', $BondSymbol);
    4739 }
    4740
    4741 # Generate 322 keyset key 75 value as 1/0 indicating its presence/absence or
    4742 # count of its presence in a molecule.
    4743 #
    4744 # Key 75 description: N-F
    4745 #
    4746 sub _Generate322KeySetKey75 {
    4747   my($This) = @_;
    4748   my($BondSymbol) = '-';
    4749
    4750   return $This->_DetectBondKeys('N', 'F', $BondSymbol);
    4751 }
    4752
    4753 # Generate 322 keyset key 76 value as 1/0 indicating its presence/absence or
    4754 # count of its presence in a molecule.
    4755 #
    4756 # Key 76 description: N-Br
    4757 #
    4758 sub _Generate322KeySetKey76 {
    4759   my($This) = @_;
    4760   my($BondSymbol) = '-';
    4761
    4762   return $This->_DetectBondKeys('N', 'Br', $BondSymbol);
    4763 }
    4764
    4765 # Generate 322 keyset key 77 value as 1/0 indicating its presence/absence or
    4766 # count of its presence in a molecule.
    4767 #
    4768 # Key 77 description: N-Si
    4769 #
    4770 sub _Generate322KeySetKey77 {
    4771   my($This) = @_;
    4772   my($BondSymbol) = '-';
    4773
    4774   return $This->_DetectBondKeys('N', 'Si', $BondSymbol);
    4775 }
    4776
    4777 # Generate 322 keyset key 78 value as 1/0 indicating its presence/absence or
    4778 # count of its presence in a molecule.
    4779 #
    4780 # Key 78 description: N-I
    4781 #
    4782 sub _Generate322KeySetKey78 {
    4783   my($This) = @_;
    4784   my($BondSymbol) = '-';
    4785
    4786   return $This->_DetectBondKeys('N', 'I', $BondSymbol);
    4787 }
    4788
    4789 # Generate 322 keyset key 79 value as 1/0 indicating its presence/absence or
    4790 # count of its presence in a molecule.
    4791 #
    4792 # Key 79 description: N-X
    4793 #
    4794 sub _Generate322KeySetKey79 {
    4795   my($This) = @_;
    4796   my($BondSymbol) = '-';
    4797
    4798   return $This->_DetectBondKeys('N', 'Z', $BondSymbol);
    4799 }
    4800
    4801 # Generate 322 keyset key 80 value as 1/0 indicating its presence/absence or
    4802 # count of its presence in a molecule.
    4803 #
    4804 # Key 80 description: O-O
    4805 #
    4806 sub _Generate322KeySetKey80 {
    4807   my($This) = @_;
    4808   my($BondSymbol) = '-';
    4809
    4810   return $This->_DetectBondKeys('O', 'O', $BondSymbol);
    4811 }
    4812
    4813 # Generate 322 keyset key 81 value as 1/0 indicating its presence/absence or
    4814 # count of its presence in a molecule.
    4815 #
    4816 # Key 81 description: O-S
    4817 #
    4818 sub _Generate322KeySetKey81 {
    4819   my($This) = @_;
    4820   my($BondSymbol) = '-';
    4821
    4822   return $This->_DetectBondKeys('O', 'S', $BondSymbol);
    4823 }
    4824
    4825 # Generate 322 keyset key 82 value as 1/0 indicating its presence/absence or
    4826 # count of its presence in a molecule.
    4827 #
    4828 # Key 82 description: O-Cl
    4829 #
    4830 sub _Generate322KeySetKey82 {
    4831   my($This) = @_;
    4832   my($BondSymbol) = '-';
    4833
    4834   return $This->_DetectBondKeys('O', 'Cl', $BondSymbol);
    4835 }
    4836
    4837 # Generate 322 keyset key 83 value as 1/0 indicating its presence/absence or
    4838 # count of its presence in a molecule.
    4839 #
    4840 # Key 83 description: O-P
    4841 #
    4842 sub _Generate322KeySetKey83 {
    4843   my($This) = @_;
    4844   my($BondSymbol) = '-';
    4845
    4846   return $This->_DetectBondKeys('O', 'P', $BondSymbol);
    4847 }
    4848
    4849 # Generate 322 keyset key 84 value as 1/0 indicating its presence/absence or
    4850 # count of its presence in a molecule.
    4851 #
    4852 # Key 84 description: O-F
    4853 #
    4854 sub _Generate322KeySetKey84 {
    4855   my($This) = @_;
    4856   my($BondSymbol) = '-';
    4857
    4858   return $This->_DetectBondKeys('O', 'F', $BondSymbol);
    4859 }
    4860
    4861 # Generate 322 keyset key 85 value as 1/0 indicating its presence/absence or
    4862 # count of its presence in a molecule.
    4863 #
    4864 # Key 85 description: O-Br
    4865 #
    4866 sub _Generate322KeySetKey85 {
    4867   my($This) = @_;
    4868   my($BondSymbol) = '-';
    4869
    4870   return $This->_DetectBondKeys('O', 'Br', $BondSymbol);
    4871 }
    4872
    4873 # Generate 322 keyset key 86 value as 1/0 indicating its presence/absence or
    4874 # count of its presence in a molecule.
    4875 #
    4876 # Key 86 description: O-Si
    4877 #
    4878 sub _Generate322KeySetKey86 {
    4879   my($This) = @_;
    4880   my($BondSymbol) = '-';
    4881
    4882   return $This->_DetectBondKeys('O', 'Si', $BondSymbol);
    4883 }
    4884
    4885 # Generate 322 keyset key 87 value as 1/0 indicating its presence/absence or
    4886 # count of its presence in a molecule.
    4887 #
    4888 # Key 87 description: O-I
    4889 #
    4890 sub _Generate322KeySetKey87 {
    4891   my($This) = @_;
    4892   my($BondSymbol) = '-';
    4893
    4894   return $This->_DetectBondKeys('O', 'I', $BondSymbol);
    4895 }
    4896
    4897 # Generate 322 keyset key 88 value as 1/0 indicating its presence/absence or
    4898 # count of its presence in a molecule.
    4899 #
    4900 # Key 88 description: O-X
    4901 #
    4902 sub _Generate322KeySetKey88 {
    4903   my($This) = @_;
    4904   my($BondSymbol) = '-';
    4905
    4906   return $This->_DetectBondKeys('O', 'Z', $BondSymbol);
    4907 }
    4908
    4909 # Generate 322 keyset key 89 value as 1/0 indicating its presence/absence or
    4910 # count of its presence in a molecule.
    4911 #
    4912 # Key 89 description: S-S
    4913 #
    4914 sub _Generate322KeySetKey89 {
    4915   my($This) = @_;
    4916   my($BondSymbol) = '-';
    4917
    4918   return $This->_DetectBondKeys('S', 'S', $BondSymbol);
    4919 }
    4920
    4921 # Generate 322 keyset key 90 value as 1/0 indicating its presence/absence or
    4922 # count of its presence in a molecule.
    4923 #
    4924 # Key 90 description: S-Cl
    4925 #
    4926 sub _Generate322KeySetKey90 {
    4927   my($This) = @_;
    4928   my($BondSymbol) = '-';
    4929
    4930   return $This->_DetectBondKeys('S', 'Cl', $BondSymbol);
    4931 }
    4932
    4933 # Generate 322 keyset key 91 value as 1/0 indicating its presence/absence or
    4934 # count of its presence in a molecule.
    4935 #
    4936 # Key 91 description: S-P
    4937 #
    4938 sub _Generate322KeySetKey91 {
    4939   my($This) = @_;
    4940   my($BondSymbol) = '-';
    4941
    4942   return $This->_DetectBondKeys('S', 'P', $BondSymbol);
    4943 }
    4944
    4945 # Generate 322 keyset key 92 value as 1/0 indicating its presence/absence or
    4946 # count of its presence in a molecule.
    4947 #
    4948 # Key 92 description: S-F
    4949 #
    4950 sub _Generate322KeySetKey92 {
    4951   my($This) = @_;
    4952   my($BondSymbol) = '-';
    4953
    4954   return $This->_DetectBondKeys('S', 'F', $BondSymbol);
    4955 }
    4956
    4957 # Generate 322 keyset key 93 value as 1/0 indicating its presence/absence or
    4958 # count of its presence in a molecule.
    4959 #
    4960 # Key 93 description: S-Br
    4961 #
    4962 sub _Generate322KeySetKey93 {
    4963   my($This) = @_;
    4964   my($BondSymbol) = '-';
    4965
    4966   return $This->_DetectBondKeys('S', 'Br', $BondSymbol);
    4967 }
    4968
    4969 # Generate 322 keyset key 94 value as 1/0 indicating its presence/absence or
    4970 # count of its presence in a molecule.
    4971 #
    4972 # Key 94 description: S-Si
    4973 #
    4974 sub _Generate322KeySetKey94 {
    4975   my($This) = @_;
    4976   my($BondSymbol) = '-';
    4977
    4978   return $This->_DetectBondKeys('S', 'Si', $BondSymbol);
    4979 }
    4980
    4981 # Generate 322 keyset key 95 value as 1/0 indicating its presence/absence or
    4982 # count of its presence in a molecule.
    4983 #
    4984 # Key 95 description: S-I
    4985 #
    4986 sub _Generate322KeySetKey95 {
    4987   my($This) = @_;
    4988   my($BondSymbol) = '-';
    4989
    4990   return $This->_DetectBondKeys('S', 'I', $BondSymbol);
    4991 }
    4992
    4993 # Generate 322 keyset key 96 value as 1/0 indicating its presence/absence or
    4994 # count of its presence in a molecule.
    4995 #
    4996 # Key 96 description: S-X
    4997 #
    4998 sub _Generate322KeySetKey96 {
    4999   my($This) = @_;
    5000   my($BondSymbol) = '-';
    5001
    5002   return $This->_DetectBondKeys('S', 'Z', $BondSymbol);
    5003 }
    5004
    5005 # Generate 322 keyset key 97 value as 1/0 indicating its presence/absence or
    5006 # count of its presence in a molecule.
    5007 #
    5008 # Key 97 description: Cl-Cl
    5009 #
    5010 sub _Generate322KeySetKey97 {
    5011   my($This) = @_;
    5012   my($BondSymbol) = '-';
    5013
    5014   return $This->_DetectBondKeys('Cl', 'Cl', $BondSymbol);
    5015 }
    5016
    5017 # Generate 322 keyset key 98 value as 1/0 indicating its presence/absence or
    5018 # count of its presence in a molecule.
    5019 #
    5020 # Key 98 description: Cl-P
    5021 #
    5022 sub _Generate322KeySetKey98 {
    5023   my($This) = @_;
    5024   my($BondSymbol) = '-';
    5025
    5026   return $This->_DetectBondKeys('Cl', 'P', $BondSymbol);
    5027 }
    5028
    5029 # Generate 322 keyset key 99 value as 1/0 indicating its presence/absence or
    5030 # count of its presence in a molecule.
    5031 #
    5032 # Key 99 description: Cl-F
    5033 #
    5034 sub _Generate322KeySetKey99 {
    5035   my($This) = @_;
    5036   my($BondSymbol) = '-';
    5037
    5038   return $This->_DetectBondKeys('Cl', 'F', $BondSymbol);
    5039 }
    5040
    5041 # Generate 322 keyset key 100 value as 1/0 indicating its presence/absence or
    5042 # count of its presence in a molecule.
    5043 #
    5044 # Key 100 description: Cl-Br
    5045 #
    5046 sub _Generate322KeySetKey100 {
    5047   my($This) = @_;
    5048   my($BondSymbol) = '-';
    5049
    5050   return $This->_DetectBondKeys('Cl', 'Br', $BondSymbol);
    5051 }
    5052
    5053 # Generate 322 keyset key 101 value as 1/0 indicating its presence/absence or
    5054 # count of its presence in a molecule.
    5055 #
    5056 # Key 101 description: Cl-Si
    5057 #
    5058 sub _Generate322KeySetKey101 {
    5059   my($This) = @_;
    5060   my($BondSymbol) = '-';
    5061
    5062   return $This->_DetectBondKeys('Cl', 'Si', $BondSymbol);
    5063 }
    5064
    5065 # Generate 322 keyset key 102 value as 1/0 indicating its presence/absence or
    5066 # count of its presence in a molecule.
    5067 #
    5068 # Key 102 description: Cl-I
    5069 #
    5070 sub _Generate322KeySetKey102 {
    5071   my($This) = @_;
    5072   my($BondSymbol) = '-';
    5073
    5074   return $This->_DetectBondKeys('Cl', 'I', $BondSymbol);
    5075 }
    5076
    5077 # Generate 322 keyset key 103 value as 1/0 indicating its presence/absence or
    5078 # count of its presence in a molecule.
    5079 #
    5080 # Key 103 description: Cl-X
    5081 #
    5082 sub _Generate322KeySetKey103 {
    5083   my($This) = @_;
    5084   my($BondSymbol) = '-';
    5085
    5086   return $This->_DetectBondKeys('Cl', 'Z', $BondSymbol);
    5087 }
    5088
    5089 # Generate 322 keyset key 104 value as 1/0 indicating its presence/absence or
    5090 # count of its presence in a molecule.
    5091 #
    5092 # Key 104 description: P-P
    5093 #
    5094 sub _Generate322KeySetKey104 {
    5095   my($This) = @_;
    5096   my($BondSymbol) = '-';
    5097
    5098   return $This->_DetectBondKeys('P', 'P', $BondSymbol);
    5099 }
    5100
    5101 # Generate 322 keyset key 105 value as 1/0 indicating its presence/absence or
    5102 # count of its presence in a molecule.
    5103 #
    5104 # Key 105 description: P-F
    5105 #
    5106 sub _Generate322KeySetKey105 {
    5107   my($This) = @_;
    5108   my($BondSymbol) = '-';
    5109
    5110   return $This->_DetectBondKeys('P', 'F', $BondSymbol);
    5111 }
    5112
    5113 # Generate 322 keyset key 106 value as 1/0 indicating its presence/absence or
    5114 # count of its presence in a molecule.
    5115 #
    5116 # Key 106 description: P-Br
    5117 #
    5118 sub _Generate322KeySetKey106 {
    5119   my($This) = @_;
    5120   my($BondSymbol) = '-';
    5121
    5122   return $This->_DetectBondKeys('P', 'Br', $BondSymbol);
    5123 }
    5124
    5125 # Generate 322 keyset key 107 value as 1/0 indicating its presence/absence or
    5126 # count of its presence in a molecule.
    5127 #
    5128 # Key 107 description: P-Si
    5129 #
    5130 sub _Generate322KeySetKey107 {
    5131   my($This) = @_;
    5132   my($BondSymbol) = '-';
    5133
    5134   return $This->_DetectBondKeys('P', 'Si', $BondSymbol);
    5135 }
    5136
    5137 # Generate 322 keyset key 108 value as 1/0 indicating its presence/absence or
    5138 # count of its presence in a molecule.
    5139 #
    5140 # Key 108 description: P-I
    5141 #
    5142 sub _Generate322KeySetKey108 {
    5143   my($This) = @_;
    5144   my($BondSymbol) = '-';
    5145
    5146   return $This->_DetectBondKeys('P', 'I', $BondSymbol);
    5147 }
    5148
    5149 # Generate 322 keyset key 109 value as 1/0 indicating its presence/absence or
    5150 # count of its presence in a molecule.
    5151 #
    5152 # Key 109 description: P-X
    5153 #
    5154 sub _Generate322KeySetKey109 {
    5155   my($This) = @_;
    5156   my($BondSymbol) = '-';
    5157
    5158   return $This->_DetectBondKeys('P', 'Z', $BondSymbol);
    5159 }
    5160
    5161 # Generate 322 keyset key 110 value as 1/0 indicating its presence/absence or
    5162 # count of its presence in a molecule.
    5163 #
    5164 # Key 110 description: F-F
    5165 #
    5166 sub _Generate322KeySetKey110 {
    5167   my($This) = @_;
    5168   my($BondSymbol) = '-';
    5169
    5170   return $This->_DetectBondKeys('F', 'F', $BondSymbol);
    5171 }
    5172
    5173 # Generate 322 keyset key 111 value as 1/0 indicating its presence/absence or
    5174 # count of its presence in a molecule.
    5175 #
    5176 # Key 111 description: F-Br
    5177 #
    5178 sub _Generate322KeySetKey111 {
    5179   my($This) = @_;
    5180   my($BondSymbol) = '-';
    5181
    5182   return $This->_DetectBondKeys('F', 'Br', $BondSymbol);
    5183 }
    5184
    5185 # Generate 322 keyset key 112 value as 1/0 indicating its presence/absence or
    5186 # count of its presence in a molecule.
    5187 #
    5188 # Key 112 description: F-Si
    5189 #
    5190 sub _Generate322KeySetKey112 {
    5191   my($This) = @_;
    5192   my($BondSymbol) = '-';
    5193
    5194   return $This->_DetectBondKeys('F', 'Si', $BondSymbol);
    5195 }
    5196
    5197 # Generate 322 keyset key 113 value as 1/0 indicating its presence/absence or
    5198 # count of its presence in a molecule.
    5199 #
    5200 # Key 113 description: F-I
    5201 #
    5202 sub _Generate322KeySetKey113 {
    5203   my($This) = @_;
    5204   my($BondSymbol) = '-';
    5205
    5206   return $This->_DetectBondKeys('F', 'I', $BondSymbol);
    5207 }
    5208
    5209 # Generate 322 keyset key 114 value as 1/0 indicating its presence/absence or
    5210 # count of its presence in a molecule.
    5211 #
    5212 # Key 114 description: F-X
    5213 #
    5214 sub _Generate322KeySetKey114 {
    5215   my($This) = @_;
    5216   my($BondSymbol) = '-';
    5217
    5218   return $This->_DetectBondKeys('F', 'Z', $BondSymbol);
    5219 }
    5220
    5221 # Generate 322 keyset key 115 value as 1/0 indicating its presence/absence or
    5222 # count of its presence in a molecule.
    5223 #
    5224 # Key 115 description: Br-Br
    5225 #
    5226 sub _Generate322KeySetKey115 {
    5227   my($This) = @_;
    5228   my($BondSymbol) = '-';
    5229
    5230   return $This->_DetectBondKeys('Br', 'Br', $BondSymbol);
    5231 }
    5232
    5233 # Generate 322 keyset key 116 value as 1/0 indicating its presence/absence or
    5234 # count of its presence in a molecule.
    5235 #
    5236 # Key 116 description: Br-Si
    5237 #
    5238 sub _Generate322KeySetKey116 {
    5239   my($This) = @_;
    5240   my($BondSymbol) = '-';
    5241
    5242   return $This->_DetectBondKeys('Br', 'Si', $BondSymbol);
    5243 }
    5244
    5245 # Generate 322 keyset key 117 value as 1/0 indicating its presence/absence or
    5246 # count of its presence in a molecule.
    5247 #
    5248 # Key 117 description: Br-I
    5249 #
    5250 sub _Generate322KeySetKey117 {
    5251   my($This) = @_;
    5252   my($BondSymbol) = '-';
    5253
    5254   return $This->_DetectBondKeys('Br', 'I', $BondSymbol);
    5255 }
    5256
    5257 # Generate 322 keyset key 118 value as 1/0 indicating its presence/absence or
    5258 # count of its presence in a molecule.
    5259 #
    5260 # Key 118 description: Br-X
    5261 #
    5262 sub _Generate322KeySetKey118 {
    5263   my($This) = @_;
    5264   my($BondSymbol) = '-';
    5265
    5266   return $This->_DetectBondKeys('Br', 'Z', $BondSymbol);
    5267 }
    5268
    5269 # Generate 322 keyset key 119 value as 1/0 indicating its presence/absence or
    5270 # count of its presence in a molecule.
    5271 #
    5272 # Key 119 description: Si-Si
    5273 #
    5274 sub _Generate322KeySetKey119 {
    5275   my($This) = @_;
    5276   my($BondSymbol) = '-';
    5277
    5278   return $This->_DetectBondKeys('Si', 'Si', $BondSymbol);
    5279 }
    5280
    5281 # Generate 322 keyset key 120 value as 1/0 indicating its presence/absence or
    5282 # count of its presence in a molecule.
    5283 #
    5284 # Key 120 description: Si-I
    5285 #
    5286 sub _Generate322KeySetKey120 {
    5287   my($This) = @_;
    5288   my($BondSymbol) = '-';
    5289
    5290   return $This->_DetectBondKeys('Si', 'I', $BondSymbol);
    5291 }
    5292
    5293 # Generate 322 keyset key 121 value as 1/0 indicating its presence/absence or
    5294 # count of its presence in a molecule.
    5295 #
    5296 # Key 121 description: Si-X
    5297 #
    5298 sub _Generate322KeySetKey121 {
    5299   my($This) = @_;
    5300   my($BondSymbol) = '-';
    5301
    5302   return $This->_DetectBondKeys('Si', 'Z', $BondSymbol);
    5303 }
    5304
    5305 # Generate 322 keyset key 122 value as 1/0 indicating its presence/absence or
    5306 # count of its presence in a molecule.
    5307 #
    5308 # Key 122 description: I-I
    5309 #
    5310 sub _Generate322KeySetKey122 {
    5311   my($This) = @_;
    5312   my($BondSymbol) = '-';
    5313
    5314   return $This->_DetectBondKeys('I', 'I', $BondSymbol);
    5315 }
    5316
    5317 # Generate 322 keyset key 123 value as 1/0 indicating its presence/absence or
    5318 # count of its presence in a molecule.
    5319 #
    5320 # Key 123 description: I-X
    5321 #
    5322 sub _Generate322KeySetKey123 {
    5323   my($This) = @_;
    5324   my($BondSymbol) = '-';
    5325
    5326   return $This->_DetectBondKeys('I', 'Z', $BondSymbol);
    5327 }
    5328
    5329 # Generate 322 keyset key 124 value as 1/0 indicating its presence/absence or
    5330 # count of its presence in a molecule.
    5331 #
    5332 # Key 124 description: X-X
    5333 #
    5334 sub _Generate322KeySetKey124 {
    5335   my($This) = @_;
    5336   my($BondSymbol) = '-';
    5337
    5338   return $This->_DetectBondKeys('Z', 'Z', $BondSymbol);
    5339 }
    5340
    5341 # Generate 322 keyset key 125 value as 1/0 indicating its presence/absence or
    5342 # count of its presence in a molecule.
    5343 #
    5344 # Key 125 description: C=C
    5345 #
    5346 sub _Generate322KeySetKey125 {
    5347   my($This) = @_;
    5348   my($BondSymbol) = '=';
    5349
    5350   return $This->_DetectBondKeys('C', 'C', $BondSymbol);
    5351 }
    5352
    5353 # Generate 322 keyset key 126 value as 1/0 indicating its presence/absence or
    5354 # count of its presence in a molecule.
    5355 #
    5356 # Key 126 description: C=N
    5357 #
    5358 sub _Generate322KeySetKey126 {
    5359   my($This) = @_;
    5360   my($BondSymbol) = '=';
    5361
    5362   return $This->_DetectBondKeys('C', 'N', $BondSymbol);
    5363 }
    5364
    5365 # Generate 322 keyset key 127 value as 1/0 indicating its presence/absence or
    5366 # count of its presence in a molecule.
    5367 #
    5368 # Key 127 description: C=O
    5369 #
    5370 sub _Generate322KeySetKey127 {
    5371   my($This) = @_;
    5372   my($BondSymbol) = '=';
    5373
    5374   return $This->_DetectBondKeys('C', 'O', $BondSymbol);
    5375 }
    5376
    5377 # Generate 322 keyset key 128 value as 1/0 indicating its presence/absence or
    5378 # count of its presence in a molecule.
    5379 #
    5380 # Key 128 description: C=S
    5381 #
    5382 sub _Generate322KeySetKey128 {
    5383   my($This) = @_;
    5384   my($BondSymbol) = '=';
    5385
    5386   return $This->_DetectBondKeys('C', 'S', $BondSymbol);
    5387 }
    5388
    5389 # Generate 322 keyset key 129 value as 1/0 indicating its presence/absence or
    5390 # count of its presence in a molecule.
    5391 #
    5392 # Key 129 description: C=Cl
    5393 #
    5394 sub _Generate322KeySetKey129 {
    5395   my($This) = @_;
    5396   my($BondSymbol) = '=';
    5397
    5398   return $This->_DetectBondKeys('C', 'Cl', $BondSymbol);
    5399 }
    5400
    5401 # Generate 322 keyset key 130 value as 1/0 indicating its presence/absence or
    5402 # count of its presence in a molecule.
    5403 #
    5404 # Key 130 description: C=P
    5405 #
    5406 sub _Generate322KeySetKey130 {
    5407   my($This) = @_;
    5408   my($BondSymbol) = '=';
    5409
    5410   return $This->_DetectBondKeys('C', 'P', $BondSymbol);
    5411 }
    5412
    5413 # Generate 322 keyset key 131 value as 1/0 indicating its presence/absence or
    5414 # count of its presence in a molecule.
    5415 #
    5416 # Key 131 description: C=F
    5417 #
    5418 sub _Generate322KeySetKey131 {
    5419   my($This) = @_;
    5420   my($BondSymbol) = '=';
    5421
    5422   return $This->_DetectBondKeys('C', 'F', $BondSymbol);
    5423 }
    5424
    5425 # Generate 322 keyset key 132 value as 1/0 indicating its presence/absence or
    5426 # count of its presence in a molecule.
    5427 #
    5428 # Key 132 description: C=Br
    5429 #
    5430 sub _Generate322KeySetKey132 {
    5431   my($This) = @_;
    5432   my($BondSymbol) = '=';
    5433
    5434   return $This->_DetectBondKeys('C', 'Br', $BondSymbol);
    5435 }
    5436
    5437 # Generate 322 keyset key 133 value as 1/0 indicating its presence/absence or
    5438 # count of its presence in a molecule.
    5439 #
    5440 # Key 133 description: C=Si
    5441 #
    5442 sub _Generate322KeySetKey133 {
    5443   my($This) = @_;
    5444   my($BondSymbol) = '=';
    5445
    5446   return $This->_DetectBondKeys('C', 'Si', $BondSymbol);
    5447 }
    5448
    5449 # Generate 322 keyset key 134 value as 1/0 indicating its presence/absence or
    5450 # count of its presence in a molecule.
    5451 #
    5452 # Key 134 description: C=I
    5453 #
    5454 sub _Generate322KeySetKey134 {
    5455   my($This) = @_;
    5456   my($BondSymbol) = '=';
    5457
    5458   return $This->_DetectBondKeys('C', 'I', $BondSymbol);
    5459 }
    5460
    5461 # Generate 322 keyset key 135 value as 1/0 indicating its presence/absence or
    5462 # count of its presence in a molecule.
    5463 #
    5464 # Key 135 description: C=X
    5465 #
    5466 sub _Generate322KeySetKey135 {
    5467   my($This) = @_;
    5468   my($BondSymbol) = '=';
    5469
    5470   return $This->_DetectBondKeys('C', 'Z', $BondSymbol);
    5471 }
    5472
    5473 # Generate 322 keyset key 136 value as 1/0 indicating its presence/absence or
    5474 # count of its presence in a molecule.
    5475 #
    5476 # Key 136 description: N=N
    5477 #
    5478 sub _Generate322KeySetKey136 {
    5479   my($This) = @_;
    5480   my($BondSymbol) = '=';
    5481
    5482   return $This->_DetectBondKeys('N', 'N', $BondSymbol);
    5483 }
    5484
    5485 # Generate 322 keyset key 137 value as 1/0 indicating its presence/absence or
    5486 # count of its presence in a molecule.
    5487 #
    5488 # Key 137 description: N=O
    5489 #
    5490 sub _Generate322KeySetKey137 {
    5491   my($This) = @_;
    5492   my($BondSymbol) = '=';
    5493
    5494   return $This->_DetectBondKeys('N', 'O', $BondSymbol);
    5495 }
    5496
    5497 # Generate 322 keyset key 138 value as 1/0 indicating its presence/absence or
    5498 # count of its presence in a molecule.
    5499 #
    5500 # Key 138 description: N=S
    5501 #
    5502 sub _Generate322KeySetKey138 {
    5503   my($This) = @_;
    5504   my($BondSymbol) = '=';
    5505
    5506   return $This->_DetectBondKeys('N', 'S', $BondSymbol);
    5507 }
    5508
    5509 # Generate 322 keyset key 139 value as 1/0 indicating its presence/absence or
    5510 # count of its presence in a molecule.
    5511 #
    5512 # Key 139 description: N=Cl
    5513 #
    5514 sub _Generate322KeySetKey139 {
    5515   my($This) = @_;
    5516   my($BondSymbol) = '=';
    5517
    5518   return $This->_DetectBondKeys('N', 'Cl', $BondSymbol);
    5519 }
    5520
    5521 # Generate 322 keyset key 140 value as 1/0 indicating its presence/absence or
    5522 # count of its presence in a molecule.
    5523 #
    5524 # Key 140 description: N=P
    5525 #
    5526 sub _Generate322KeySetKey140 {
    5527   my($This) = @_;
    5528   my($BondSymbol) = '=';
    5529
    5530   return $This->_DetectBondKeys('N', 'P', $BondSymbol);
    5531 }
    5532
    5533 # Generate 322 keyset key 141 value as 1/0 indicating its presence/absence or
    5534 # count of its presence in a molecule.
    5535 #
    5536 # Key 141 description: N=F
    5537 #
    5538 sub _Generate322KeySetKey141 {
    5539   my($This) = @_;
    5540   my($BondSymbol) = '=';
    5541
    5542   return $This->_DetectBondKeys('N', 'F', $BondSymbol);
    5543 }
    5544
    5545 # Generate 322 keyset key 142 value as 1/0 indicating its presence/absence or
    5546 # count of its presence in a molecule.
    5547 #
    5548 # Key 142 description: N=Br
    5549 #
    5550 sub _Generate322KeySetKey142 {
    5551   my($This) = @_;
    5552   my($BondSymbol) = '=';
    5553
    5554   return $This->_DetectBondKeys('N', 'Br', $BondSymbol);
    5555 }
    5556
    5557 # Generate 322 keyset key 143 value as 1/0 indicating its presence/absence or
    5558 # count of its presence in a molecule.
    5559 #
    5560 # Key 143 description: N=Si
    5561 #
    5562 sub _Generate322KeySetKey143 {
    5563   my($This) = @_;
    5564   my($BondSymbol) = '=';
    5565
    5566   return $This->_DetectBondKeys('N', 'Si', $BondSymbol);
    5567 }
    5568
    5569 # Generate 322 keyset key 144 value as 1/0 indicating its presence/absence or
    5570 # count of its presence in a molecule.
    5571 #
    5572 # Key 144 description: N=I
    5573 #
    5574 sub _Generate322KeySetKey144 {
    5575   my($This) = @_;
    5576   my($BondSymbol) = '=';
    5577
    5578   return $This->_DetectBondKeys('N', 'I', $BondSymbol);
    5579 }
    5580
    5581 # Generate 322 keyset key 145 value as 1/0 indicating its presence/absence or
    5582 # count of its presence in a molecule.
    5583 #
    5584 # Key 145 description: N=X
    5585 #
    5586 sub _Generate322KeySetKey145 {
    5587   my($This) = @_;
    5588   my($BondSymbol) = '=';
    5589
    5590   return $This->_DetectBondKeys('N', 'Z', $BondSymbol);
    5591 }
    5592
    5593 # Generate 322 keyset key 146 value as 1/0 indicating its presence/absence or
    5594 # count of its presence in a molecule.
    5595 #
    5596 # Key 146 description: O=O
    5597 #
    5598 sub _Generate322KeySetKey146 {
    5599   my($This) = @_;
    5600   my($BondSymbol) = '=';
    5601
    5602   return $This->_DetectBondKeys('O', 'O', $BondSymbol);
    5603 }
    5604
    5605 # Generate 322 keyset key 147 value as 1/0 indicating its presence/absence or
    5606 # count of its presence in a molecule.
    5607 #
    5608 # Key 147 description: O=S
    5609 #
    5610 sub _Generate322KeySetKey147 {
    5611   my($This) = @_;
    5612   my($BondSymbol) = '=';
    5613
    5614   return $This->_DetectBondKeys('O', 'S', $BondSymbol);
    5615 }
    5616
    5617 # Generate 322 keyset key 148 value as 1/0 indicating its presence/absence or
    5618 # count of its presence in a molecule.
    5619 #
    5620 # Key 148 description: O=Cl
    5621 #
    5622 sub _Generate322KeySetKey148 {
    5623   my($This) = @_;
    5624   my($BondSymbol) = '=';
    5625
    5626   return $This->_DetectBondKeys('O', 'Cl', $BondSymbol);
    5627 }
    5628
    5629 # Generate 322 keyset key 149 value as 1/0 indicating its presence/absence or
    5630 # count of its presence in a molecule.
    5631 #
    5632 # Key 149 description: O=P
    5633 #
    5634 sub _Generate322KeySetKey149 {
    5635   my($This) = @_;
    5636   my($BondSymbol) = '=';
    5637
    5638   return $This->_DetectBondKeys('O', 'P', $BondSymbol);
    5639 }
    5640
    5641 # Generate 322 keyset key 150 value as 1/0 indicating its presence/absence or
    5642 # count of its presence in a molecule.
    5643 #
    5644 # Key 150 description: O=F
    5645 #
    5646 sub _Generate322KeySetKey150 {
    5647   my($This) = @_;
    5648   my($BondSymbol) = '=';
    5649
    5650   return $This->_DetectBondKeys('O', 'F', $BondSymbol);
    5651 }
    5652
    5653 # Generate 322 keyset key 151 value as 1/0 indicating its presence/absence or
    5654 # count of its presence in a molecule.
    5655 #
    5656 # Key 151 description: O=Br
    5657 #
    5658 sub _Generate322KeySetKey151 {
    5659   my($This) = @_;
    5660   my($BondSymbol) = '=';
    5661
    5662   return $This->_DetectBondKeys('O', 'Br', $BondSymbol);
    5663 }
    5664
    5665 # Generate 322 keyset key 152 value as 1/0 indicating its presence/absence or
    5666 # count of its presence in a molecule.
    5667 #
    5668 # Key 152 description: O=Si
    5669 #
    5670 sub _Generate322KeySetKey152 {
    5671   my($This) = @_;
    5672   my($BondSymbol) = '=';
    5673
    5674   return $This->_DetectBondKeys('O', 'Si', $BondSymbol);
    5675 }
    5676
    5677 # Generate 322 keyset key 153 value as 1/0 indicating its presence/absence or
    5678 # count of its presence in a molecule.
    5679 #
    5680 # Key 153 description: O=I
    5681 #
    5682 sub _Generate322KeySetKey153 {
    5683   my($This) = @_;
    5684   my($BondSymbol) = '=';
    5685
    5686   return $This->_DetectBondKeys('O', 'I', $BondSymbol);
    5687 }
    5688
    5689 # Generate 322 keyset key 154 value as 1/0 indicating its presence/absence or
    5690 # count of its presence in a molecule.
    5691 #
    5692 # Key 154 description: O=X
    5693 #
    5694 sub _Generate322KeySetKey154 {
    5695   my($This) = @_;
    5696   my($BondSymbol) = '=';
    5697
    5698   return $This->_DetectBondKeys('O', 'Z', $BondSymbol);
    5699 }
    5700
    5701 # Generate 322 keyset key 155 value as 1/0 indicating its presence/absence or
    5702 # count of its presence in a molecule.
    5703 #
    5704 # Key 155 description: S=S
    5705 #
    5706 sub _Generate322KeySetKey155 {
    5707   my($This) = @_;
    5708   my($BondSymbol) = '=';
    5709
    5710   return $This->_DetectBondKeys('S', 'S', $BondSymbol);
    5711 }
    5712
    5713 # Generate 322 keyset key 156 value as 1/0 indicating its presence/absence or
    5714 # count of its presence in a molecule.
    5715 #
    5716 # Key 156 description: S=Cl
    5717 #
    5718 sub _Generate322KeySetKey156 {
    5719   my($This) = @_;
    5720   my($BondSymbol) = '=';
    5721
    5722   return $This->_DetectBondKeys('S', 'Cl', $BondSymbol);
    5723 }
    5724
    5725 # Generate 322 keyset key 157 value as 1/0 indicating its presence/absence or
    5726 # count of its presence in a molecule.
    5727 #
    5728 # Key 157 description: S=P
    5729 #
    5730 sub _Generate322KeySetKey157 {
    5731   my($This) = @_;
    5732   my($BondSymbol) = '=';
    5733
    5734   return $This->_DetectBondKeys('S', 'P', $BondSymbol);
    5735 }
    5736
    5737 # Generate 322 keyset key 158 value as 1/0 indicating its presence/absence or
    5738 # count of its presence in a molecule.
    5739 #
    5740 # Key 158 description: S=F
    5741 #
    5742 sub _Generate322KeySetKey158 {
    5743   my($This) = @_;
    5744   my($BondSymbol) = '=';
    5745
    5746   return $This->_DetectBondKeys('S', 'F', $BondSymbol);
    5747 }
    5748
    5749 # Generate 322 keyset key 159 value as 1/0 indicating its presence/absence or
    5750 # count of its presence in a molecule.
    5751 #
    5752 # Key 159 description: S=Br
    5753 #
    5754 sub _Generate322KeySetKey159 {
    5755   my($This) = @_;
    5756   my($BondSymbol) = '=';
    5757
    5758   return $This->_DetectBondKeys('S', 'Br', $BondSymbol);
    5759 }
    5760
    5761 # Generate 322 keyset key 160 value as 1/0 indicating its presence/absence or
    5762 # count of its presence in a molecule.
    5763 #
    5764 # Key 160 description: S=Si
    5765 #
    5766 sub _Generate322KeySetKey160 {
    5767   my($This) = @_;
    5768   my($BondSymbol) = '=';
    5769
    5770   return $This->_DetectBondKeys('S', 'Si', $BondSymbol);
    5771 }
    5772
    5773 # Generate 322 keyset key 161 value as 1/0 indicating its presence/absence or
    5774 # count of its presence in a molecule.
    5775 #
    5776 # Key 161 description: S=I
    5777 #
    5778 sub _Generate322KeySetKey161 {
    5779   my($This) = @_;
    5780   my($BondSymbol) = '=';
    5781
    5782   return $This->_DetectBondKeys('S', 'I', $BondSymbol);
    5783 }
    5784
    5785 # Generate 322 keyset key 162 value as 1/0 indicating its presence/absence or
    5786 # count of its presence in a molecule.
    5787 #
    5788 # Key 162 description: S=X
    5789 #
    5790 sub _Generate322KeySetKey162 {
    5791   my($This) = @_;
    5792   my($BondSymbol) = '=';
    5793
    5794   return $This->_DetectBondKeys('S', 'Z', $BondSymbol);
    5795 }
    5796
    5797 # Generate 322 keyset key 163 value as 1/0 indicating its presence/absence or
    5798 # count of its presence in a molecule.
    5799 #
    5800 # Key 163 description: Cl=Cl
    5801 #
    5802 sub _Generate322KeySetKey163 {
    5803   my($This) = @_;
    5804   my($BondSymbol) = '=';
    5805
    5806   return $This->_DetectBondKeys('Cl', 'Cl', $BondSymbol);
    5807 }
    5808
    5809 # Generate 322 keyset key 164 value as 1/0 indicating its presence/absence or
    5810 # count of its presence in a molecule.
    5811 #
    5812 # Key 164 description: Cl=P
    5813 #
    5814 sub _Generate322KeySetKey164 {
    5815   my($This) = @_;
    5816   my($BondSymbol) = '=';
    5817
    5818   return $This->_DetectBondKeys('Cl', 'P', $BondSymbol);
    5819 }
    5820
    5821 # Generate 322 keyset key 165 value as 1/0 indicating its presence/absence or
    5822 # count of its presence in a molecule.
    5823 #
    5824 # Key 165 description: Cl=F
    5825 #
    5826 sub _Generate322KeySetKey165 {
    5827   my($This) = @_;
    5828   my($BondSymbol) = '=';
    5829
    5830   return $This->_DetectBondKeys('Cl', 'F', $BondSymbol);
    5831 }
    5832
    5833 # Generate 322 keyset key 166 value as 1/0 indicating its presence/absence or
    5834 # count of its presence in a molecule.
    5835 #
    5836 # Key 166 description: Cl=Br
    5837 #
    5838 sub _Generate322KeySetKey166 {
    5839   my($This) = @_;
    5840   my($BondSymbol) = '=';
    5841
    5842   return $This->_DetectBondKeys('Cl', 'Br', $BondSymbol);
    5843 }
    5844
    5845 # Generate 322 keyset key 167 value as 1/0 indicating its presence/absence or
    5846 # count of its presence in a molecule.
    5847 #
    5848 # Key 167 description: Cl=Si
    5849 #
    5850 sub _Generate322KeySetKey167 {
    5851   my($This) = @_;
    5852   my($BondSymbol) = '=';
    5853
    5854   return $This->_DetectBondKeys('Cl', 'Si', $BondSymbol);
    5855 }
    5856
    5857 # Generate 322 keyset key 168 value as 1/0 indicating its presence/absence or
    5858 # count of its presence in a molecule.
    5859 #
    5860 # Key 168 description: Cl=I
    5861 #
    5862 sub _Generate322KeySetKey168 {
    5863   my($This) = @_;
    5864   my($BondSymbol) = '=';
    5865
    5866   return $This->_DetectBondKeys('Cl', 'I', $BondSymbol);
    5867 }
    5868
    5869 # Generate 322 keyset key 169 value as 1/0 indicating its presence/absence or
    5870 # count of its presence in a molecule.
    5871 #
    5872 # Key 169 description: Cl=X
    5873 #
    5874 sub _Generate322KeySetKey169 {
    5875   my($This) = @_;
    5876   my($BondSymbol) = '=';
    5877
    5878   return $This->_DetectBondKeys('Cl', 'Z', $BondSymbol);
    5879 }
    5880
    5881 # Generate 322 keyset key 170 value as 1/0 indicating its presence/absence or
    5882 # count of its presence in a molecule.
    5883 #
    5884 # Key 170 description: P=P
    5885 #
    5886 sub _Generate322KeySetKey170 {
    5887   my($This) = @_;
    5888   my($BondSymbol) = '=';
    5889
    5890   return $This->_DetectBondKeys('P', 'P', $BondSymbol);
    5891 }
    5892
    5893 # Generate 322 keyset key 171 value as 1/0 indicating its presence/absence or
    5894 # count of its presence in a molecule.
    5895 #
    5896 # Key 171 description: P=F
    5897 #
    5898 sub _Generate322KeySetKey171 {
    5899   my($This) = @_;
    5900   my($BondSymbol) = '=';
    5901
    5902   return $This->_DetectBondKeys('P', 'F', $BondSymbol);
    5903 }
    5904
    5905 # Generate 322 keyset key 172 value as 1/0 indicating its presence/absence or
    5906 # count of its presence in a molecule.
    5907 #
    5908 # Key 172 description: P=Br
    5909 #
    5910 sub _Generate322KeySetKey172 {
    5911   my($This) = @_;
    5912   my($BondSymbol) = '=';
    5913
    5914   return $This->_DetectBondKeys('P', 'Br', $BondSymbol);
    5915 }
    5916
    5917 # Generate 322 keyset key 173 value as 1/0 indicating its presence/absence or
    5918 # count of its presence in a molecule.
    5919 #
    5920 # Key 173 description: P=Si
    5921 #
    5922 sub _Generate322KeySetKey173 {
    5923   my($This) = @_;
    5924   my($BondSymbol) = '=';
    5925
    5926   return $This->_DetectBondKeys('P', 'Si', $BondSymbol);
    5927 }
    5928
    5929 # Generate 322 keyset key 174 value as 1/0 indicating its presence/absence or
    5930 # count of its presence in a molecule.
    5931 #
    5932 # Key 174 description: P=I
    5933 #
    5934 sub _Generate322KeySetKey174 {
    5935   my($This) = @_;
    5936   my($BondSymbol) = '=';
    5937
    5938   return $This->_DetectBondKeys('P', 'I', $BondSymbol);
    5939 }
    5940
    5941 # Generate 322 keyset key 175 value as 1/0 indicating its presence/absence or
    5942 # count of its presence in a molecule.
    5943 #
    5944 # Key 175 description: P=X
    5945 #
    5946 sub _Generate322KeySetKey175 {
    5947   my($This) = @_;
    5948   my($BondSymbol) = '=';
    5949
    5950   return $This->_DetectBondKeys('P', 'Z', $BondSymbol);
    5951 }
    5952
    5953 # Generate 322 keyset key 176 value as 1/0 indicating its presence/absence or
    5954 # count of its presence in a molecule.
    5955 #
    5956 # Key 176 description: F=F
    5957 #
    5958 sub _Generate322KeySetKey176 {
    5959   my($This) = @_;
    5960   my($BondSymbol) = '=';
    5961
    5962   return $This->_DetectBondKeys('F', 'F', $BondSymbol);
    5963 }
    5964
    5965 # Generate 322 keyset key 177 value as 1/0 indicating its presence/absence or
    5966 # count of its presence in a molecule.
    5967 #
    5968 # Key 177 description: F=Br
    5969 #
    5970 sub _Generate322KeySetKey177 {
    5971   my($This) = @_;
    5972   my($BondSymbol) = '=';
    5973
    5974   return $This->_DetectBondKeys('F', 'Br', $BondSymbol);
    5975 }
    5976
    5977 # Generate 322 keyset key 178 value as 1/0 indicating its presence/absence or
    5978 # count of its presence in a molecule.
    5979 #
    5980 # Key 178 description: F=Si
    5981 #
    5982 sub _Generate322KeySetKey178 {
    5983   my($This) = @_;
    5984   my($BondSymbol) = '=';
    5985
    5986   return $This->_DetectBondKeys('F', 'Si', $BondSymbol);
    5987 }
    5988
    5989 # Generate 322 keyset key 179 value as 1/0 indicating its presence/absence or
    5990 # count of its presence in a molecule.
    5991 #
    5992 # Key 179 description: F=I
    5993 #
    5994 sub _Generate322KeySetKey179 {
    5995   my($This) = @_;
    5996   my($BondSymbol) = '=';
    5997
    5998   return $This->_DetectBondKeys('F', 'I', $BondSymbol);
    5999 }
    6000
    6001 # Generate 322 keyset key 180 value as 1/0 indicating its presence/absence or
    6002 # count of its presence in a molecule.
    6003 #
    6004 # Key 180 description: F=X
    6005 #
    6006 sub _Generate322KeySetKey180 {
    6007   my($This) = @_;
    6008   my($BondSymbol) = '=';
    6009
    6010   return $This->_DetectBondKeys('F', 'Z', $BondSymbol);
    6011 }
    6012
    6013 # Generate 322 keyset key 181 value as 1/0 indicating its presence/absence or
    6014 # count of its presence in a molecule.
    6015 #
    6016 # Key 181 description: Br=Br
    6017 #
    6018 sub _Generate322KeySetKey181 {
    6019   my($This) = @_;
    6020   my($BondSymbol) = '=';
    6021
    6022   return $This->_DetectBondKeys('Br', 'Br', $BondSymbol);
    6023 }
    6024
    6025 # Generate 322 keyset key 182 value as 1/0 indicating its presence/absence or
    6026 # count of its presence in a molecule.
    6027 #
    6028 # Key 182 description: Br=Si
    6029 #
    6030 sub _Generate322KeySetKey182 {
    6031   my($This) = @_;
    6032   my($BondSymbol) = '=';
    6033
    6034   return $This->_DetectBondKeys('Br', 'Si', $BondSymbol);
    6035 }
    6036
    6037 # Generate 322 keyset key 183 value as 1/0 indicating its presence/absence or
    6038 # count of its presence in a molecule.
    6039 #
    6040 # Key 183 description: Br=I
    6041 #
    6042 sub _Generate322KeySetKey183 {
    6043   my($This) = @_;
    6044   my($BondSymbol) = '=';
    6045
    6046   return $This->_DetectBondKeys('Br', 'I', $BondSymbol);
    6047 }
    6048
    6049 # Generate 322 keyset key 184 value as 1/0 indicating its presence/absence or
    6050 # count of its presence in a molecule.
    6051 #
    6052 # Key 184 description: Br=X
    6053 #
    6054 sub _Generate322KeySetKey184 {
    6055   my($This) = @_;
    6056   my($BondSymbol) = '=';
    6057
    6058   return $This->_DetectBondKeys('Br', 'Z', $BondSymbol);
    6059 }
    6060
    6061 # Generate 322 keyset key 185 value as 1/0 indicating its presence/absence or
    6062 # count of its presence in a molecule.
    6063 #
    6064 # Key 185 description: Si=Si
    6065 #
    6066 sub _Generate322KeySetKey185 {
    6067   my($This) = @_;
    6068   my($BondSymbol) = '=';
    6069
    6070   return $This->_DetectBondKeys('Si', 'Si', $BondSymbol);
    6071 }
    6072
    6073 # Generate 322 keyset key 186 value as 1/0 indicating its presence/absence or
    6074 # count of its presence in a molecule.
    6075 #
    6076 # Key 186 description: Si=I
    6077 #
    6078 sub _Generate322KeySetKey186 {
    6079   my($This) = @_;
    6080   my($BondSymbol) = '=';
    6081
    6082   return $This->_DetectBondKeys('Si', 'I', $BondSymbol);
    6083 }
    6084
    6085 # Generate 322 keyset key 187 value as 1/0 indicating its presence/absence or
    6086 # count of its presence in a molecule.
    6087 #
    6088 # Key 187 description: Si=X
    6089 #
    6090 sub _Generate322KeySetKey187 {
    6091   my($This) = @_;
    6092   my($BondSymbol) = '=';
    6093
    6094   return $This->_DetectBondKeys('Si', 'Z', $BondSymbol);
    6095 }
    6096
    6097 # Generate 322 keyset key 188 value as 1/0 indicating its presence/absence or
    6098 # count of its presence in a molecule.
    6099 #
    6100 # Key 188 description: I=I
    6101 #
    6102 sub _Generate322KeySetKey188 {
    6103   my($This) = @_;
    6104   my($BondSymbol) = '=';
    6105
    6106   return $This->_DetectBondKeys('I', 'I', $BondSymbol);
    6107 }
    6108
    6109 # Generate 322 keyset key 189 value as 1/0 indicating its presence/absence or
    6110 # count of its presence in a molecule.
    6111 #
    6112 # Key 189 description: I=X
    6113 #
    6114 sub _Generate322KeySetKey189 {
    6115   my($This) = @_;
    6116   my($BondSymbol) = '=';
    6117
    6118   return $This->_DetectBondKeys('I', 'Z', $BondSymbol);
    6119 }
    6120
    6121 # Generate 322 keyset key 190 value as 1/0 indicating its presence/absence or
    6122 # count of its presence in a molecule.
    6123 #
    6124 # Key 190 description: X=X
    6125 #
    6126 sub _Generate322KeySetKey190 {
    6127   my($This) = @_;
    6128   my($BondSymbol) = '=';
    6129
    6130   return $This->_DetectBondKeys('Z', 'Z', $BondSymbol);
    6131 }
    6132
    6133 # Generate 322 keyset key 191 value as 1/0 indicating its presence/absence or
    6134 # count of its presence in a molecule.
    6135 #
    6136 # Key 191 description: C#C
    6137 #
    6138 sub _Generate322KeySetKey191 {
    6139   my($This) = @_;
    6140   my($BondSymbol) = '#';
    6141
    6142   return $This->_DetectBondKeys('C', 'C', $BondSymbol);
    6143 }
    6144
    6145 # Generate 322 keyset key 192 value as 1/0 indicating its presence/absence or
    6146 # count of its presence in a molecule.
    6147 #
    6148 # Key 192 description: C#N
    6149 #
    6150 sub _Generate322KeySetKey192 {
    6151   my($This) = @_;
    6152   my($BondSymbol) = '#';
    6153
    6154   return $This->_DetectBondKeys('C', 'N', $BondSymbol);
    6155 }
    6156
    6157 # Generate 322 keyset key 193 value as 1/0 indicating its presence/absence or
    6158 # count of its presence in a molecule.
    6159 #
    6160 # Key 193 description: C#O
    6161 #
    6162 sub _Generate322KeySetKey193 {
    6163   my($This) = @_;
    6164   my($BondSymbol) = '#';
    6165
    6166   return $This->_DetectBondKeys('C', 'O', $BondSymbol);
    6167 }
    6168
    6169 # Generate 322 keyset key 194 value as 1/0 indicating its presence/absence or
    6170 # count of its presence in a molecule.
    6171 #
    6172 # Key 194 description: C#S
    6173 #
    6174 sub _Generate322KeySetKey194 {
    6175   my($This) = @_;
    6176   my($BondSymbol) = '#';
    6177
    6178   return $This->_DetectBondKeys('C', 'S', $BondSymbol);
    6179 }
    6180
    6181 # Generate 322 keyset key 195 value as 1/0 indicating its presence/absence or
    6182 # count of its presence in a molecule.
    6183 #
    6184 # Key 195 description: C#Cl
    6185 #
    6186 sub _Generate322KeySetKey195 {
    6187   my($This) = @_;
    6188   my($BondSymbol) = '#';
    6189
    6190   return $This->_DetectBondKeys('C', 'Cl', $BondSymbol);
    6191 }
    6192
    6193 # Generate 322 keyset key 196 value as 1/0 indicating its presence/absence or
    6194 # count of its presence in a molecule.
    6195 #
    6196 # Key 196 description: C#P
    6197 #
    6198 sub _Generate322KeySetKey196 {
    6199   my($This) = @_;
    6200   my($BondSymbol) = '#';
    6201
    6202   return $This->_DetectBondKeys('C', 'P', $BondSymbol);
    6203 }
    6204
    6205 # Generate 322 keyset key 197 value as 1/0 indicating its presence/absence or
    6206 # count of its presence in a molecule.
    6207 #
    6208 # Key 197 description: C#F
    6209 #
    6210 sub _Generate322KeySetKey197 {
    6211   my($This) = @_;
    6212   my($BondSymbol) = '#';
    6213
    6214   return $This->_DetectBondKeys('C', 'F', $BondSymbol);
    6215 }
    6216
    6217 # Generate 322 keyset key 198 value as 1/0 indicating its presence/absence or
    6218 # count of its presence in a molecule.
    6219 #
    6220 # Key 198 description: C#Br
    6221 #
    6222 sub _Generate322KeySetKey198 {
    6223   my($This) = @_;
    6224   my($BondSymbol) = '#';
    6225
    6226   return $This->_DetectBondKeys('C', 'Br', $BondSymbol);
    6227 }
    6228
    6229 # Generate 322 keyset key 199 value as 1/0 indicating its presence/absence or
    6230 # count of its presence in a molecule.
    6231 #
    6232 # Key 199 description: C#Si
    6233 #
    6234 sub _Generate322KeySetKey199 {
    6235   my($This) = @_;
    6236   my($BondSymbol) = '#';
    6237
    6238   return $This->_DetectBondKeys('C', 'Si', $BondSymbol);
    6239 }
    6240
    6241 # Generate 322 keyset key 200 value as 1/0 indicating its presence/absence or
    6242 # count of its presence in a molecule.
    6243 #
    6244 # Key 200 description: C#I
    6245 #
    6246 sub _Generate322KeySetKey200 {
    6247   my($This) = @_;
    6248   my($BondSymbol) = '#';
    6249
    6250   return $This->_DetectBondKeys('C', 'I', $BondSymbol);
    6251 }
    6252
    6253 # Generate 322 keyset key 201 value as 1/0 indicating its presence/absence or
    6254 # count of its presence in a molecule.
    6255 #
    6256 # Key 201 description: C#X
    6257 #
    6258 sub _Generate322KeySetKey201 {
    6259   my($This) = @_;
    6260   my($BondSymbol) = '#';
    6261
    6262   return $This->_DetectBondKeys('C', 'Z', $BondSymbol);
    6263 }
    6264
    6265 # Generate 322 keyset key 202 value as 1/0 indicating its presence/absence or
    6266 # count of its presence in a molecule.
    6267 #
    6268 # Key 202 description: N#N
    6269 #
    6270 sub _Generate322KeySetKey202 {
    6271   my($This) = @_;
    6272   my($BondSymbol) = '#';
    6273
    6274   return $This->_DetectBondKeys('N', 'N', $BondSymbol);
    6275 }
    6276
    6277 # Generate 322 keyset key 203 value as 1/0 indicating its presence/absence or
    6278 # count of its presence in a molecule.
    6279 #
    6280 # Key 203 description: N#O
    6281 #
    6282 sub _Generate322KeySetKey203 {
    6283   my($This) = @_;
    6284   my($BondSymbol) = '#';
    6285
    6286   return $This->_DetectBondKeys('N', 'O', $BondSymbol);
    6287 }
    6288
    6289 # Generate 322 keyset key 204 value as 1/0 indicating its presence/absence or
    6290 # count of its presence in a molecule.
    6291 #
    6292 # Key 204 description: N#S
    6293 #
    6294 sub _Generate322KeySetKey204 {
    6295   my($This) = @_;
    6296   my($BondSymbol) = '#';
    6297
    6298   return $This->_DetectBondKeys('N', 'S', $BondSymbol);
    6299 }
    6300
    6301 # Generate 322 keyset key 205 value as 1/0 indicating its presence/absence or
    6302 # count of its presence in a molecule.
    6303 #
    6304 # Key 205 description: N#Cl
    6305 #
    6306 sub _Generate322KeySetKey205 {
    6307   my($This) = @_;
    6308   my($BondSymbol) = '#';
    6309
    6310   return $This->_DetectBondKeys('N', 'Cl', $BondSymbol);
    6311 }
    6312
    6313 # Generate 322 keyset key 206 value as 1/0 indicating its presence/absence or
    6314 # count of its presence in a molecule.
    6315 #
    6316 # Key 206 description: N#P
    6317 #
    6318 sub _Generate322KeySetKey206 {
    6319   my($This) = @_;
    6320   my($BondSymbol) = '#';
    6321
    6322   return $This->_DetectBondKeys('N', 'P', $BondSymbol);
    6323 }
    6324
    6325 # Generate 322 keyset key 207 value as 1/0 indicating its presence/absence or
    6326 # count of its presence in a molecule.
    6327 #
    6328 # Key 207 description: N#F
    6329 #
    6330 sub _Generate322KeySetKey207 {
    6331   my($This) = @_;
    6332   my($BondSymbol) = '#';
    6333
    6334   return $This->_DetectBondKeys('N', 'F', $BondSymbol);
    6335 }
    6336
    6337 # Generate 322 keyset key 208 value as 1/0 indicating its presence/absence or
    6338 # count of its presence in a molecule.
    6339 #
    6340 # Key 208 description: N#Br
    6341 #
    6342 sub _Generate322KeySetKey208 {
    6343   my($This) = @_;
    6344   my($BondSymbol) = '#';
    6345
    6346   return $This->_DetectBondKeys('N', 'Br', $BondSymbol);
    6347 }
    6348
    6349 # Generate 322 keyset key 209 value as 1/0 indicating its presence/absence or
    6350 # count of its presence in a molecule.
    6351 #
    6352 # Key 209 description: N#Si
    6353 #
    6354 sub _Generate322KeySetKey209 {
    6355   my($This) = @_;
    6356   my($BondSymbol) = '#';
    6357
    6358   return $This->_DetectBondKeys('N', 'Si', $BondSymbol);
    6359 }
    6360
    6361 # Generate 322 keyset key 210 value as 1/0 indicating its presence/absence or
    6362 # count of its presence in a molecule.
    6363 #
    6364 # Key 210 description: N#I
    6365 #
    6366 sub _Generate322KeySetKey210 {
    6367   my($This) = @_;
    6368   my($BondSymbol) = '#';
    6369
    6370   return $This->_DetectBondKeys('N', 'I', $BondSymbol);
    6371 }
    6372
    6373 # Generate 322 keyset key 211 value as 1/0 indicating its presence/absence or
    6374 # count of its presence in a molecule.
    6375 #
    6376 # Key 211 description: N#X
    6377 #
    6378 sub _Generate322KeySetKey211 {
    6379   my($This) = @_;
    6380   my($BondSymbol) = '#';
    6381
    6382   return $This->_DetectBondKeys('N', 'Z', $BondSymbol);
    6383 }
    6384
    6385 # Generate 322 keyset key 212 value as 1/0 indicating its presence/absence or
    6386 # count of its presence in a molecule.
    6387 #
    6388 # Key 212 description: O#O
    6389 #
    6390 sub _Generate322KeySetKey212 {
    6391   my($This) = @_;
    6392   my($BondSymbol) = '#';
    6393
    6394   return $This->_DetectBondKeys('O', 'O', $BondSymbol);
    6395 }
    6396
    6397 # Generate 322 keyset key 213 value as 1/0 indicating its presence/absence or
    6398 # count of its presence in a molecule.
    6399 #
    6400 # Key 213 description: O#S
    6401 #
    6402 sub _Generate322KeySetKey213 {
    6403   my($This) = @_;
    6404   my($BondSymbol) = '#';
    6405
    6406   return $This->_DetectBondKeys('O', 'S', $BondSymbol);
    6407 }
    6408
    6409 # Generate 322 keyset key 214 value as 1/0 indicating its presence/absence or
    6410 # count of its presence in a molecule.
    6411 #
    6412 # Key 214 description: O#Cl
    6413 #
    6414 sub _Generate322KeySetKey214 {
    6415   my($This) = @_;
    6416   my($BondSymbol) = '#';
    6417
    6418   return $This->_DetectBondKeys('O', 'Cl', $BondSymbol);
    6419 }
    6420
    6421 # Generate 322 keyset key 215 value as 1/0 indicating its presence/absence or
    6422 # count of its presence in a molecule.
    6423 #
    6424 # Key 215 description: O#P
    6425 #
    6426 sub _Generate322KeySetKey215 {
    6427   my($This) = @_;
    6428   my($BondSymbol) = '#';
    6429
    6430   return $This->_DetectBondKeys('O', 'P', $BondSymbol);
    6431 }
    6432
    6433 # Generate 322 keyset key 216 value as 1/0 indicating its presence/absence or
    6434 # count of its presence in a molecule.
    6435 #
    6436 # Key 216 description: O#F
    6437 #
    6438 sub _Generate322KeySetKey216 {
    6439   my($This) = @_;
    6440   my($BondSymbol) = '#';
    6441
    6442   return $This->_DetectBondKeys('O', 'F', $BondSymbol);
    6443 }
    6444
    6445 # Generate 322 keyset key 217 value as 1/0 indicating its presence/absence or
    6446 # count of its presence in a molecule.
    6447 #
    6448 # Key 217 description: O#Br
    6449 #
    6450 sub _Generate322KeySetKey217 {
    6451   my($This) = @_;
    6452   my($BondSymbol) = '#';
    6453
    6454   return $This->_DetectBondKeys('O', 'Br', $BondSymbol);
    6455 }
    6456
    6457 # Generate 322 keyset key 218 value as 1/0 indicating its presence/absence or
    6458 # count of its presence in a molecule.
    6459 #
    6460 # Key 218 description: O#Si
    6461 #
    6462 sub _Generate322KeySetKey218 {
    6463   my($This) = @_;
    6464   my($BondSymbol) = '#';
    6465
    6466   return $This->_DetectBondKeys('O', 'Si', $BondSymbol);
    6467 }
    6468
    6469 # Generate 322 keyset key 219 value as 1/0 indicating its presence/absence or
    6470 # count of its presence in a molecule.
    6471 #
    6472 # Key 219 description: O#I
    6473 #
    6474 sub _Generate322KeySetKey219 {
    6475   my($This) = @_;
    6476   my($BondSymbol) = '#';
    6477
    6478   return $This->_DetectBondKeys('O', 'I', $BondSymbol);
    6479 }
    6480
    6481 # Generate 322 keyset key 220 value as 1/0 indicating its presence/absence or
    6482 # count of its presence in a molecule.
    6483 #
    6484 # Key 220 description: O#X
    6485 #
    6486 sub _Generate322KeySetKey220 {
    6487   my($This) = @_;
    6488   my($BondSymbol) = '#';
    6489
    6490   return $This->_DetectBondKeys('O', 'Z', $BondSymbol);
    6491 }
    6492
    6493 # Generate 322 keyset key 221 value as 1/0 indicating its presence/absence or
    6494 # count of its presence in a molecule.
    6495 #
    6496 # Key 221 description: S#S
    6497 #
    6498 sub _Generate322KeySetKey221 {
    6499   my($This) = @_;
    6500   my($BondSymbol) = '#';
    6501
    6502   return $This->_DetectBondKeys('S', 'S', $BondSymbol);
    6503 }
    6504
    6505 # Generate 322 keyset key 222 value as 1/0 indicating its presence/absence or
    6506 # count of its presence in a molecule.
    6507 #
    6508 # Key 222 description: S#Cl
    6509 #
    6510 sub _Generate322KeySetKey222 {
    6511   my($This) = @_;
    6512   my($BondSymbol) = '#';
    6513
    6514   return $This->_DetectBondKeys('S', 'Cl', $BondSymbol);
    6515 }
    6516
    6517 # Generate 322 keyset key 223 value as 1/0 indicating its presence/absence or
    6518 # count of its presence in a molecule.
    6519 #
    6520 # Key 223 description: S#P
    6521 #
    6522 sub _Generate322KeySetKey223 {
    6523   my($This) = @_;
    6524   my($BondSymbol) = '#';
    6525
    6526   return $This->_DetectBondKeys('S', 'P', $BondSymbol);
    6527 }
    6528
    6529 # Generate 322 keyset key 224 value as 1/0 indicating its presence/absence or
    6530 # count of its presence in a molecule.
    6531 #
    6532 # Key 224 description: S#F
    6533 #
    6534 sub _Generate322KeySetKey224 {
    6535   my($This) = @_;
    6536   my($BondSymbol) = '#';
    6537
    6538   return $This->_DetectBondKeys('S', 'F', $BondSymbol);
    6539 }
    6540
    6541 # Generate 322 keyset key 225 value as 1/0 indicating its presence/absence or
    6542 # count of its presence in a molecule.
    6543 #
    6544 # Key 225 description: S#Br
    6545 #
    6546 sub _Generate322KeySetKey225 {
    6547   my($This) = @_;
    6548   my($BondSymbol) = '#';
    6549
    6550   return $This->_DetectBondKeys('S', 'Br', $BondSymbol);
    6551 }
    6552
    6553 # Generate 322 keyset key 226 value as 1/0 indicating its presence/absence or
    6554 # count of its presence in a molecule.
    6555 #
    6556 # Key 226 description: S#Si
    6557 #
    6558 sub _Generate322KeySetKey226 {
    6559   my($This) = @_;
    6560   my($BondSymbol) = '#';
    6561
    6562   return $This->_DetectBondKeys('S', 'Si', $BondSymbol);
    6563 }
    6564
    6565 # Generate 322 keyset key 227 value as 1/0 indicating its presence/absence or
    6566 # count of its presence in a molecule.
    6567 #
    6568 # Key 227 description: S#I
    6569 #
    6570 sub _Generate322KeySetKey227 {
    6571   my($This) = @_;
    6572   my($BondSymbol) = '#';
    6573
    6574   return $This->_DetectBondKeys('S', 'I', $BondSymbol);
    6575 }
    6576
    6577 # Generate 322 keyset key 228 value as 1/0 indicating its presence/absence or
    6578 # count of its presence in a molecule.
    6579 #
    6580 # Key 228 description: S#X
    6581 #
    6582 sub _Generate322KeySetKey228 {
    6583   my($This) = @_;
    6584   my($BondSymbol) = '#';
    6585
    6586   return $This->_DetectBondKeys('S', 'Z', $BondSymbol);
    6587 }
    6588
    6589 # Generate 322 keyset key 229 value as 1/0 indicating its presence/absence or
    6590 # count of its presence in a molecule.
    6591 #
    6592 # Key 229 description: Cl#Cl
    6593 #
    6594 sub _Generate322KeySetKey229 {
    6595   my($This) = @_;
    6596   my($BondSymbol) = '#';
    6597
    6598   return $This->_DetectBondKeys('Cl', 'Cl', $BondSymbol);
    6599 }
    6600
    6601 # Generate 322 keyset key 230 value as 1/0 indicating its presence/absence or
    6602 # count of its presence in a molecule.
    6603 #
    6604 # Key 230 description: Cl#P
    6605 #
    6606 sub _Generate322KeySetKey230 {
    6607   my($This) = @_;
    6608   my($BondSymbol) = '#';
    6609
    6610   return $This->_DetectBondKeys('Cl', 'P', $BondSymbol);
    6611 }
    6612
    6613 # Generate 322 keyset key 231 value as 1/0 indicating its presence/absence or
    6614 # count of its presence in a molecule.
    6615 #
    6616 # Key 231 description: Cl#F
    6617 #
    6618 sub _Generate322KeySetKey231 {
    6619   my($This) = @_;
    6620   my($BondSymbol) = '#';
    6621
    6622   return $This->_DetectBondKeys('Cl', 'F', $BondSymbol);
    6623 }
    6624
    6625 # Generate 322 keyset key 232 value as 1/0 indicating its presence/absence or
    6626 # count of its presence in a molecule.
    6627 #
    6628 # Key 232 description: Cl#Br
    6629 #
    6630 sub _Generate322KeySetKey232 {
    6631   my($This) = @_;
    6632   my($BondSymbol) = '#';
    6633
    6634   return $This->_DetectBondKeys('Cl', 'Br', $BondSymbol);
    6635 }
    6636
    6637 # Generate 322 keyset key 233 value as 1/0 indicating its presence/absence or
    6638 # count of its presence in a molecule.
    6639 #
    6640 # Key 233 description: Cl#Si
    6641 #
    6642 sub _Generate322KeySetKey233 {
    6643   my($This) = @_;
    6644   my($BondSymbol) = '#';
    6645
    6646   return $This->_DetectBondKeys('Cl', 'Si', $BondSymbol);
    6647 }
    6648
    6649 # Generate 322 keyset key 234 value as 1/0 indicating its presence/absence or
    6650 # count of its presence in a molecule.
    6651 #
    6652 # Key 234 description: Cl#I
    6653 #
    6654 sub _Generate322KeySetKey234 {
    6655   my($This) = @_;
    6656   my($BondSymbol) = '#';
    6657
    6658   return $This->_DetectBondKeys('Cl', 'I', $BondSymbol);
    6659 }
    6660
    6661 # Generate 322 keyset key 235 value as 1/0 indicating its presence/absence or
    6662 # count of its presence in a molecule.
    6663 #
    6664 # Key 235 description: Cl#X
    6665 #
    6666 sub _Generate322KeySetKey235 {
    6667   my($This) = @_;
    6668   my($BondSymbol) = '#';
    6669
    6670   return $This->_DetectBondKeys('Cl', 'Z', $BondSymbol);
    6671 }
    6672
    6673 # Generate 322 keyset key 236 value as 1/0 indicating its presence/absence or
    6674 # count of its presence in a molecule.
    6675 #
    6676 # Key 236 description: P#P
    6677 #
    6678 sub _Generate322KeySetKey236 {
    6679   my($This) = @_;
    6680   my($BondSymbol) = '#';
    6681
    6682   return $This->_DetectBondKeys('P', 'P', $BondSymbol);
    6683 }
    6684
    6685 # Generate 322 keyset key 237 value as 1/0 indicating its presence/absence or
    6686 # count of its presence in a molecule.
    6687 #
    6688 # Key 237 description: P#F
    6689 #
    6690 sub _Generate322KeySetKey237 {
    6691   my($This) = @_;
    6692   my($BondSymbol) = '#';
    6693
    6694   return $This->_DetectBondKeys('P', 'F', $BondSymbol);
    6695 }
    6696
    6697 # Generate 322 keyset key 238 value as 1/0 indicating its presence/absence or
    6698 # count of its presence in a molecule.
    6699 #
    6700 # Key 238 description: P#Br
    6701 #
    6702 sub _Generate322KeySetKey238 {
    6703   my($This) = @_;
    6704   my($BondSymbol) = '#';
    6705
    6706   return $This->_DetectBondKeys('P', 'Br', $BondSymbol);
    6707 }
    6708
    6709 # Generate 322 keyset key 239 value as 1/0 indicating its presence/absence or
    6710 # count of its presence in a molecule.
    6711 #
    6712 # Key 239 description: P#Si
    6713 #
    6714 sub _Generate322KeySetKey239 {
    6715   my($This) = @_;
    6716   my($BondSymbol) = '#';
    6717
    6718   return $This->_DetectBondKeys('P', 'Si', $BondSymbol);
    6719 }
    6720
    6721 # Generate 322 keyset key 240 value as 1/0 indicating its presence/absence or
    6722 # count of its presence in a molecule.
    6723 #
    6724 # Key 240 description: P#I
    6725 #
    6726 sub _Generate322KeySetKey240 {
    6727   my($This) = @_;
    6728   my($BondSymbol) = '#';
    6729
    6730   return $This->_DetectBondKeys('P', 'I', $BondSymbol);
    6731 }
    6732
    6733 # Generate 322 keyset key 241 value as 1/0 indicating its presence/absence or
    6734 # count of its presence in a molecule.
    6735 #
    6736 # Key 241 description: P#X
    6737 #
    6738 sub _Generate322KeySetKey241 {
    6739   my($This) = @_;
    6740   my($BondSymbol) = '#';
    6741
    6742   return $This->_DetectBondKeys('P', 'Z', $BondSymbol);
    6743 }
    6744
    6745 # Generate 322 keyset key 242 value as 1/0 indicating its presence/absence or
    6746 # count of its presence in a molecule.
    6747 #
    6748 # Key 242 description: F#F
    6749 #
    6750 sub _Generate322KeySetKey242 {
    6751   my($This) = @_;
    6752   my($BondSymbol) = '#';
    6753
    6754   return $This->_DetectBondKeys('F', 'F', $BondSymbol);
    6755 }
    6756
    6757 # Generate 322 keyset key 243 value as 1/0 indicating its presence/absence or
    6758 # count of its presence in a molecule.
    6759 #
    6760 # Key 243 description: F#Br
    6761 #
    6762 sub _Generate322KeySetKey243 {
    6763   my($This) = @_;
    6764   my($BondSymbol) = '#';
    6765
    6766   return $This->_DetectBondKeys('F', 'Br', $BondSymbol);
    6767 }
    6768
    6769 # Generate 322 keyset key 244 value as 1/0 indicating its presence/absence or
    6770 # count of its presence in a molecule.
    6771 #
    6772 # Key 244 description: F#Si
    6773 #
    6774 sub _Generate322KeySetKey244 {
    6775   my($This) = @_;
    6776   my($BondSymbol) = '#';
    6777
    6778   return $This->_DetectBondKeys('F', 'Si', $BondSymbol);
    6779 }
    6780
    6781 # Generate 322 keyset key 245 value as 1/0 indicating its presence/absence or
    6782 # count of its presence in a molecule.
    6783 #
    6784 # Key 245 description: F#I
    6785 #
    6786 sub _Generate322KeySetKey245 {
    6787   my($This) = @_;
    6788   my($BondSymbol) = '#';
    6789
    6790   return $This->_DetectBondKeys('F', 'I', $BondSymbol);
    6791 }
    6792
    6793 # Generate 322 keyset key 246 value as 1/0 indicating its presence/absence or
    6794 # count of its presence in a molecule.
    6795 #
    6796 # Key 246 description: F#X
    6797 #
    6798 sub _Generate322KeySetKey246 {
    6799   my($This) = @_;
    6800   my($BondSymbol) = '#';
    6801
    6802   return $This->_DetectBondKeys('F', 'Z', $BondSymbol);
    6803 }
    6804
    6805 # Generate 322 keyset key 247 value as 1/0 indicating its presence/absence or
    6806 # count of its presence in a molecule.
    6807 #
    6808 # Key 247 description: Br#Br
    6809 #
    6810 sub _Generate322KeySetKey247 {
    6811   my($This) = @_;
    6812   my($BondSymbol) = '#';
    6813
    6814   return $This->_DetectBondKeys('Br', 'Br', $BondSymbol);
    6815 }
    6816
    6817 # Generate 322 keyset key 248 value as 1/0 indicating its presence/absence or
    6818 # count of its presence in a molecule.
    6819 #
    6820 # Key 248 description: Br#Si
    6821 #
    6822 sub _Generate322KeySetKey248 {
    6823   my($This) = @_;
    6824   my($BondSymbol) = '#';
    6825
    6826   return $This->_DetectBondKeys('Br', 'Si', $BondSymbol);
    6827 }
    6828
    6829 # Generate 322 keyset key 249 value as 1/0 indicating its presence/absence or
    6830 # count of its presence in a molecule.
    6831 #
    6832 # Key 249 description: Br#I
    6833 #
    6834 sub _Generate322KeySetKey249 {
    6835   my($This) = @_;
    6836   my($BondSymbol) = '#';
    6837
    6838   return $This->_DetectBondKeys('Br', 'I', $BondSymbol);
    6839 }
    6840
    6841 # Generate 322 keyset key 250 value as 1/0 indicating its presence/absence or
    6842 # count of its presence in a molecule.
    6843 #
    6844 # Key 250 description: Br#X
    6845 #
    6846 sub _Generate322KeySetKey250 {
    6847   my($This) = @_;
    6848   my($BondSymbol) = '#';
    6849
    6850   return $This->_DetectBondKeys('Br', 'Z', $BondSymbol);
    6851 }
    6852
    6853 # Generate 322 keyset key 251 value as 1/0 indicating its presence/absence or
    6854 # count of its presence in a molecule.
    6855 #
    6856 # Key 251 description: Si#Si
    6857 #
    6858 sub _Generate322KeySetKey251 {
    6859   my($This) = @_;
    6860   my($BondSymbol) = '#';
    6861
    6862   return $This->_DetectBondKeys('Si', 'Si', $BondSymbol);
    6863 }
    6864
    6865 # Generate 322 keyset key 252 value as 1/0 indicating its presence/absence or
    6866 # count of its presence in a molecule.
    6867 #
    6868 # Key 252 description: Si#I
    6869 #
    6870 sub _Generate322KeySetKey252 {
    6871   my($This) = @_;
    6872   my($BondSymbol) = '#';
    6873
    6874   return $This->_DetectBondKeys('Si', 'I', $BondSymbol);
    6875 }
    6876
    6877 # Generate 322 keyset key 253 value as 1/0 indicating its presence/absence or
    6878 # count of its presence in a molecule.
    6879 #
    6880 # Key 253 description: Si#X
    6881 #
    6882 sub _Generate322KeySetKey253 {
    6883   my($This) = @_;
    6884   my($BondSymbol) = '#';
    6885
    6886   return $This->_DetectBondKeys('Si', 'Z', $BondSymbol);
    6887 }
    6888
    6889 # Generate 322 keyset key 254 value as 1/0 indicating its presence/absence or
    6890 # count of its presence in a molecule.
    6891 #
    6892 # Key 254 description: I#I
    6893 #
    6894 sub _Generate322KeySetKey254 {
    6895   my($This) = @_;
    6896   my($BondSymbol) = '#';
    6897
    6898   return $This->_DetectBondKeys('I', 'I', $BondSymbol);
    6899 }
    6900
    6901 # Generate 322 keyset key 255 value as 1/0 indicating its presence/absence or
    6902 # count of its presence in a molecule.
    6903 #
    6904 # Key 255 description: I#X
    6905 #
    6906 sub _Generate322KeySetKey255 {
    6907   my($This) = @_;
    6908   my($BondSymbol) = '#';
    6909
    6910   return $This->_DetectBondKeys('I', 'Z', $BondSymbol);
    6911 }
    6912
    6913 # Generate 322 keyset key 256 value as 1/0 indicating its presence/absence or
    6914 # count of its presence in a molecule.
    6915 #
    6916 # Key 256 description: X#X
    6917 #
    6918 sub _Generate322KeySetKey256 {
    6919   my($This) = @_;
    6920   my($BondSymbol) = '#';
    6921
    6922   return $This->_DetectBondKeys('Z', 'Z', $BondSymbol);
    6923 }
    6924
    6925 # Generate 322 keyset key 257 value as 1/0 indicating its presence/absence or
    6926 # count of its presence in a molecule.
    6927 #
    6928 # Key 257 description: C$C
    6929 #
    6930 sub _Generate322KeySetKey257 {
    6931   my($This) = @_;
    6932   my($BondSymbol) = '$';
    6933
    6934   return $This->_DetectBondKeys('C', 'C', $BondSymbol);
    6935 }
    6936
    6937 # Generate 322 keyset key 258 value as 1/0 indicating its presence/absence or
    6938 # count of its presence in a molecule.
    6939 #
    6940 # Key 258 description: C$N
    6941 #
    6942 sub _Generate322KeySetKey258 {
    6943   my($This) = @_;
    6944   my($BondSymbol) = '$';
    6945
    6946   return $This->_DetectBondKeys('C', 'N', $BondSymbol);
    6947 }
    6948
    6949 # Generate 322 keyset key 259 value as 1/0 indicating its presence/absence or
    6950 # count of its presence in a molecule.
    6951 #
    6952 # Key 259 description: C$O
    6953 #
    6954 sub _Generate322KeySetKey259 {
    6955   my($This) = @_;
    6956   my($BondSymbol) = '$';
    6957
    6958   return $This->_DetectBondKeys('C', 'O', $BondSymbol);
    6959 }
    6960
    6961 # Generate 322 keyset key 260 value as 1/0 indicating its presence/absence or
    6962 # count of its presence in a molecule.
    6963 #
    6964 # Key 260 description: C$S
    6965 #
    6966 sub _Generate322KeySetKey260 {
    6967   my($This) = @_;
    6968   my($BondSymbol) = '$';
    6969
    6970   return $This->_DetectBondKeys('C', 'S', $BondSymbol);
    6971 }
    6972
    6973 # Generate 322 keyset key 261 value as 1/0 indicating its presence/absence or
    6974 # count of its presence in a molecule.
    6975 #
    6976 # Key 261 description: C$Cl
    6977 #
    6978 sub _Generate322KeySetKey261 {
    6979   my($This) = @_;
    6980   my($BondSymbol) = '$';
    6981
    6982   return $This->_DetectBondKeys('C', 'Cl', $BondSymbol);
    6983 }
    6984
    6985 # Generate 322 keyset key 262 value as 1/0 indicating its presence/absence or
    6986 # count of its presence in a molecule.
    6987 #
    6988 # Key 262 description: C$P
    6989 #
    6990 sub _Generate322KeySetKey262 {
    6991   my($This) = @_;
    6992   my($BondSymbol) = '$';
    6993
    6994   return $This->_DetectBondKeys('C', 'P', $BondSymbol);
    6995 }
    6996
    6997 # Generate 322 keyset key 263 value as 1/0 indicating its presence/absence or
    6998 # count of its presence in a molecule.
    6999 #
    7000 # Key 263 description: C$F
    7001 #
    7002 sub _Generate322KeySetKey263 {
    7003   my($This) = @_;
    7004   my($BondSymbol) = '$';
    7005
    7006   return $This->_DetectBondKeys('C', 'F', $BondSymbol);
    7007 }
    7008
    7009 # Generate 322 keyset key 264 value as 1/0 indicating its presence/absence or
    7010 # count of its presence in a molecule.
    7011 #
    7012 # Key 264 description: C$Br
    7013 #
    7014 sub _Generate322KeySetKey264 {
    7015   my($This) = @_;
    7016   my($BondSymbol) = '$';
    7017
    7018   return $This->_DetectBondKeys('C', 'Br', $BondSymbol);
    7019 }
    7020
    7021 # Generate 322 keyset key 265 value as 1/0 indicating its presence/absence or
    7022 # count of its presence in a molecule.
    7023 #
    7024 # Key 265 description: C$Si
    7025 #
    7026 sub _Generate322KeySetKey265 {
    7027   my($This) = @_;
    7028   my($BondSymbol) = '$';
    7029
    7030   return $This->_DetectBondKeys('C', 'Si', $BondSymbol);
    7031 }
    7032
    7033 # Generate 322 keyset key 266 value as 1/0 indicating its presence/absence or
    7034 # count of its presence in a molecule.
    7035 #
    7036 # Key 266 description: C$I
    7037 #
    7038 sub _Generate322KeySetKey266 {
    7039   my($This) = @_;
    7040   my($BondSymbol) = '$';
    7041
    7042   return $This->_DetectBondKeys('C', 'I', $BondSymbol);
    7043 }
    7044
    7045 # Generate 322 keyset key 267 value as 1/0 indicating its presence/absence or
    7046 # count of its presence in a molecule.
    7047 #
    7048 # Key 267 description: C$X
    7049 #
    7050 sub _Generate322KeySetKey267 {
    7051   my($This) = @_;
    7052   my($BondSymbol) = '$';
    7053
    7054   return $This->_DetectBondKeys('C', 'Z', $BondSymbol);
    7055 }
    7056
    7057 # Generate 322 keyset key 268 value as 1/0 indicating its presence/absence or
    7058 # count of its presence in a molecule.
    7059 #
    7060 # Key 268 description: N$N
    7061 #
    7062 sub _Generate322KeySetKey268 {
    7063   my($This) = @_;
    7064   my($BondSymbol) = '$';
    7065
    7066   return $This->_DetectBondKeys('N', 'N', $BondSymbol);
    7067 }
    7068
    7069 # Generate 322 keyset key 269 value as 1/0 indicating its presence/absence or
    7070 # count of its presence in a molecule.
    7071 #
    7072 # Key 269 description: N$O
    7073 #
    7074 sub _Generate322KeySetKey269 {
    7075   my($This) = @_;
    7076   my($BondSymbol) = '$';
    7077
    7078   return $This->_DetectBondKeys('N', 'O', $BondSymbol);
    7079 }
    7080
    7081 # Generate 322 keyset key 270 value as 1/0 indicating its presence/absence or
    7082 # count of its presence in a molecule.
    7083 #
    7084 # Key 270 description: N$S
    7085 #
    7086 sub _Generate322KeySetKey270 {
    7087   my($This) = @_;
    7088   my($BondSymbol) = '$';
    7089
    7090   return $This->_DetectBondKeys('N', 'S', $BondSymbol);
    7091 }
    7092
    7093 # Generate 322 keyset key 271 value as 1/0 indicating its presence/absence or
    7094 # count of its presence in a molecule.
    7095 #
    7096 # Key 271 description: N$Cl
    7097 #
    7098 sub _Generate322KeySetKey271 {
    7099   my($This) = @_;
    7100   my($BondSymbol) = '$';
    7101
    7102   return $This->_DetectBondKeys('N', 'Cl', $BondSymbol);
    7103 }
    7104
    7105 # Generate 322 keyset key 272 value as 1/0 indicating its presence/absence or
    7106 # count of its presence in a molecule.
    7107 #
    7108 # Key 272 description: N$P
    7109 #
    7110 sub _Generate322KeySetKey272 {
    7111   my($This) = @_;
    7112   my($BondSymbol) = '$';
    7113
    7114   return $This->_DetectBondKeys('N', 'P', $BondSymbol);
    7115 }
    7116
    7117 # Generate 322 keyset key 273 value as 1/0 indicating its presence/absence or
    7118 # count of its presence in a molecule.
    7119 #
    7120 # Key 273 description: N$F
    7121 #
    7122 sub _Generate322KeySetKey273 {
    7123   my($This) = @_;
    7124   my($BondSymbol) = '$';
    7125
    7126   return $This->_DetectBondKeys('N', 'F', $BondSymbol);
    7127 }
    7128
    7129 # Generate 322 keyset key 274 value as 1/0 indicating its presence/absence or
    7130 # count of its presence in a molecule.
    7131 #
    7132 # Key 274 description: N$Br
    7133 #
    7134 sub _Generate322KeySetKey274 {
    7135   my($This) = @_;
    7136   my($BondSymbol) = '$';
    7137
    7138   return $This->_DetectBondKeys('N', 'Br', $BondSymbol);
    7139 }
    7140
    7141 # Generate 322 keyset key 275 value as 1/0 indicating its presence/absence or
    7142 # count of its presence in a molecule.
    7143 #
    7144 # Key 275 description: N$Si
    7145 #
    7146 sub _Generate322KeySetKey275 {
    7147   my($This) = @_;
    7148   my($BondSymbol) = '$';
    7149
    7150   return $This->_DetectBondKeys('N', 'Si', $BondSymbol);
    7151 }
    7152
    7153 # Generate 322 keyset key 276 value as 1/0 indicating its presence/absence or
    7154 # count of its presence in a molecule.
    7155 #
    7156 # Key 276 description: N$I
    7157 #
    7158 sub _Generate322KeySetKey276 {
    7159   my($This) = @_;
    7160   my($BondSymbol) = '$';
    7161
    7162   return $This->_DetectBondKeys('N', 'I', $BondSymbol);
    7163 }
    7164
    7165 # Generate 322 keyset key 277 value as 1/0 indicating its presence/absence or
    7166 # count of its presence in a molecule.
    7167 #
    7168 # Key 277 description: N$X
    7169 #
    7170 sub _Generate322KeySetKey277 {
    7171   my($This) = @_;
    7172   my($BondSymbol) = '$';
    7173
    7174   return $This->_DetectBondKeys('N', 'Z', $BondSymbol);
    7175 }
    7176
    7177 # Generate 322 keyset key 278 value as 1/0 indicating its presence/absence or
    7178 # count of its presence in a molecule.
    7179 #
    7180 # Key 278 description: O$O
    7181 #
    7182 sub _Generate322KeySetKey278 {
    7183   my($This) = @_;
    7184   my($BondSymbol) = '$';
    7185
    7186   return $This->_DetectBondKeys('O', 'O', $BondSymbol);
    7187 }
    7188
    7189 # Generate 322 keyset key 279 value as 1/0 indicating its presence/absence or
    7190 # count of its presence in a molecule.
    7191 #
    7192 # Key 279 description: O$S
    7193 #
    7194 sub _Generate322KeySetKey279 {
    7195   my($This) = @_;
    7196   my($BondSymbol) = '$';
    7197
    7198   return $This->_DetectBondKeys('O', 'S', $BondSymbol);
    7199 }
    7200
    7201 # Generate 322 keyset key 280 value as 1/0 indicating its presence/absence or
    7202 # count of its presence in a molecule.
    7203 #
    7204 # Key 280 description: O$Cl
    7205 #
    7206 sub _Generate322KeySetKey280 {
    7207   my($This) = @_;
    7208   my($BondSymbol) = '$';
    7209
    7210   return $This->_DetectBondKeys('O', 'Cl', $BondSymbol);
    7211 }
    7212
    7213 # Generate 322 keyset key 281 value as 1/0 indicating its presence/absence or
    7214 # count of its presence in a molecule.
    7215 #
    7216 # Key 281 description: O$P
    7217 #
    7218 sub _Generate322KeySetKey281 {
    7219   my($This) = @_;
    7220   my($BondSymbol) = '$';
    7221
    7222   return $This->_DetectBondKeys('O', 'P', $BondSymbol);
    7223 }
    7224
    7225 # Generate 322 keyset key 282 value as 1/0 indicating its presence/absence or
    7226 # count of its presence in a molecule.
    7227 #
    7228 # Key 282 description: O$F
    7229 #
    7230 sub _Generate322KeySetKey282 {
    7231   my($This) = @_;
    7232   my($BondSymbol) = '$';
    7233
    7234   return $This->_DetectBondKeys('O', 'F', $BondSymbol);
    7235 }
    7236
    7237 # Generate 322 keyset key 283 value as 1/0 indicating its presence/absence or
    7238 # count of its presence in a molecule.
    7239 #
    7240 # Key 283 description: O$Br
    7241 #
    7242 sub _Generate322KeySetKey283 {
    7243   my($This) = @_;
    7244   my($BondSymbol) = '$';
    7245
    7246   return $This->_DetectBondKeys('O', 'Br', $BondSymbol);
    7247 }
    7248
    7249 # Generate 322 keyset key 284 value as 1/0 indicating its presence/absence or
    7250 # count of its presence in a molecule.
    7251 #
    7252 # Key 284 description: O$Si
    7253 #
    7254 sub _Generate322KeySetKey284 {
    7255   my($This) = @_;
    7256   my($BondSymbol) = '$';
    7257
    7258   return $This->_DetectBondKeys('O', 'Si', $BondSymbol);
    7259 }
    7260
    7261 # Generate 322 keyset key 285 value as 1/0 indicating its presence/absence or
    7262 # count of its presence in a molecule.
    7263 #
    7264 # Key 285 description: O$I
    7265 #
    7266 sub _Generate322KeySetKey285 {
    7267   my($This) = @_;
    7268   my($BondSymbol) = '$';
    7269
    7270   return $This->_DetectBondKeys('O', 'I', $BondSymbol);
    7271 }
    7272
    7273 # Generate 322 keyset key 286 value as 1/0 indicating its presence/absence or
    7274 # count of its presence in a molecule.
    7275 #
    7276 # Key 286 description: O$X
    7277 #
    7278 sub _Generate322KeySetKey286 {
    7279   my($This) = @_;
    7280   my($BondSymbol) = '$';
    7281
    7282   return $This->_DetectBondKeys('O', 'Z', $BondSymbol);
    7283 }
    7284
    7285 # Generate 322 keyset key 287 value as 1/0 indicating its presence/absence or
    7286 # count of its presence in a molecule.
    7287 #
    7288 # Key 287 description: S$S
    7289 #
    7290 sub _Generate322KeySetKey287 {
    7291   my($This) = @_;
    7292   my($BondSymbol) = '$';
    7293
    7294   return $This->_DetectBondKeys('S', 'S', $BondSymbol);
    7295 }
    7296
    7297 # Generate 322 keyset key 288 value as 1/0 indicating its presence/absence or
    7298 # count of its presence in a molecule.
    7299 #
    7300 # Key 288 description: S$Cl
    7301 #
    7302 sub _Generate322KeySetKey288 {
    7303   my($This) = @_;
    7304   my($BondSymbol) = '$';
    7305
    7306   return $This->_DetectBondKeys('S', 'Cl', $BondSymbol);
    7307 }
    7308
    7309 # Generate 322 keyset key 289 value as 1/0 indicating its presence/absence or
    7310 # count of its presence in a molecule.
    7311 #
    7312 # Key 289 description: S$P
    7313 #
    7314 sub _Generate322KeySetKey289 {
    7315   my($This) = @_;
    7316   my($BondSymbol) = '$';
    7317
    7318   return $This->_DetectBondKeys('S', 'P', $BondSymbol);
    7319 }
    7320
    7321 # Generate 322 keyset key 290 value as 1/0 indicating its presence/absence or
    7322 # count of its presence in a molecule.
    7323 #
    7324 # Key 290 description: S$F
    7325 #
    7326 sub _Generate322KeySetKey290 {
    7327   my($This) = @_;
    7328   my($BondSymbol) = '$';
    7329
    7330   return $This->_DetectBondKeys('S', 'F', $BondSymbol);
    7331 }
    7332
    7333 # Generate 322 keyset key 291 value as 1/0 indicating its presence/absence or
    7334 # count of its presence in a molecule.
    7335 #
    7336 # Key 291 description: S$Br
    7337 #
    7338 sub _Generate322KeySetKey291 {
    7339   my($This) = @_;
    7340   my($BondSymbol) = '$';
    7341
    7342   return $This->_DetectBondKeys('S', 'Br', $BondSymbol);
    7343 }
    7344
    7345 # Generate 322 keyset key 292 value as 1/0 indicating its presence/absence or
    7346 # count of its presence in a molecule.
    7347 #
    7348 # Key 292 description: S$Si
    7349 #
    7350 sub _Generate322KeySetKey292 {
    7351   my($This) = @_;
    7352   my($BondSymbol) = '$';
    7353
    7354   return $This->_DetectBondKeys('S', 'Si', $BondSymbol);
    7355 }
    7356
    7357 # Generate 322 keyset key 293 value as 1/0 indicating its presence/absence or
    7358 # count of its presence in a molecule.
    7359 #
    7360 # Key 293 description: S$I
    7361 #
    7362 sub _Generate322KeySetKey293 {
    7363   my($This) = @_;
    7364   my($BondSymbol) = '$';
    7365
    7366   return $This->_DetectBondKeys('S', 'I', $BondSymbol);
    7367 }
    7368
    7369 # Generate 322 keyset key 294 value as 1/0 indicating its presence/absence or
    7370 # count of its presence in a molecule.
    7371 #
    7372 # Key 294 description: S$X
    7373 #
    7374 sub _Generate322KeySetKey294 {
    7375   my($This) = @_;
    7376   my($BondSymbol) = '$';
    7377
    7378   return $This->_DetectBondKeys('S', 'Z', $BondSymbol);
    7379 }
    7380
    7381 # Generate 322 keyset key 295 value as 1/0 indicating its presence/absence or
    7382 # count of its presence in a molecule.
    7383 #
    7384 # Key 295 description: Cl$Cl
    7385 #
    7386 sub _Generate322KeySetKey295 {
    7387   my($This) = @_;
    7388   my($BondSymbol) = '$';
    7389
    7390   return $This->_DetectBondKeys('Cl', 'Cl', $BondSymbol);
    7391 }
    7392
    7393 # Generate 322 keyset key 296 value as 1/0 indicating its presence/absence or
    7394 # count of its presence in a molecule.
    7395 #
    7396 # Key 296 description: Cl$P
    7397 #
    7398 sub _Generate322KeySetKey296 {
    7399   my($This) = @_;
    7400   my($BondSymbol) = '$';
    7401
    7402   return $This->_DetectBondKeys('Cl', 'P', $BondSymbol);
    7403 }
    7404
    7405 # Generate 322 keyset key 297 value as 1/0 indicating its presence/absence or
    7406 # count of its presence in a molecule.
    7407 #
    7408 # Key 297 description: Cl$F
    7409 #
    7410 sub _Generate322KeySetKey297 {
    7411   my($This) = @_;
    7412   my($BondSymbol) = '$';
    7413
    7414   return $This->_DetectBondKeys('Cl', 'F', $BondSymbol);
    7415 }
    7416
    7417 # Generate 322 keyset key 298 value as 1/0 indicating its presence/absence or
    7418 # count of its presence in a molecule.
    7419 #
    7420 # Key 298 description: Cl$Br
    7421 #
    7422 sub _Generate322KeySetKey298 {
    7423   my($This) = @_;
    7424   my($BondSymbol) = '$';
    7425
    7426   return $This->_DetectBondKeys('Cl', 'Br', $BondSymbol);
    7427 }
    7428
    7429 # Generate 322 keyset key 299 value as 1/0 indicating its presence/absence or
    7430 # count of its presence in a molecule.
    7431 #
    7432 # Key 299 description: Cl$Si
    7433 #
    7434 sub _Generate322KeySetKey299 {
    7435   my($This) = @_;
    7436   my($BondSymbol) = '$';
    7437
    7438   return $This->_DetectBondKeys('Cl', 'Si', $BondSymbol);
    7439 }
    7440
    7441 # Generate 322 keyset key 300 value as 1/0 indicating its presence/absence or
    7442 # count of its presence in a molecule.
    7443 #
    7444 # Key 300 description: Cl$I
    7445 #
    7446 sub _Generate322KeySetKey300 {
    7447   my($This) = @_;
    7448   my($BondSymbol) = '$';
    7449
    7450   return $This->_DetectBondKeys('Cl', 'I', $BondSymbol);
    7451 }
    7452
    7453 # Generate 322 keyset key 301 value as 1/0 indicating its presence/absence or
    7454 # count of its presence in a molecule.
    7455 #
    7456 # Key 301 description: Cl$X
    7457 #
    7458 sub _Generate322KeySetKey301 {
    7459   my($This) = @_;
    7460   my($BondSymbol) = '$';
    7461
    7462   return $This->_DetectBondKeys('Cl', 'Z', $BondSymbol);
    7463 }
    7464
    7465 # Generate 322 keyset key 302 value as 1/0 indicating its presence/absence or
    7466 # count of its presence in a molecule.
    7467 #
    7468 # Key 302 description: P$P
    7469 #
    7470 sub _Generate322KeySetKey302 {
    7471   my($This) = @_;
    7472   my($BondSymbol) = '$';
    7473
    7474   return $This->_DetectBondKeys('P', 'P', $BondSymbol);
    7475 }
    7476
    7477 # Generate 322 keyset key 303 value as 1/0 indicating its presence/absence or
    7478 # count of its presence in a molecule.
    7479 #
    7480 # Key 303 description: P$F
    7481 #
    7482 sub _Generate322KeySetKey303 {
    7483   my($This) = @_;
    7484   my($BondSymbol) = '$';
    7485
    7486   return $This->_DetectBondKeys('P', 'F', $BondSymbol);
    7487 }
    7488
    7489 # Generate 322 keyset key 304 value as 1/0 indicating its presence/absence or
    7490 # count of its presence in a molecule.
    7491 #
    7492 # Key 304 description: P$Br
    7493 #
    7494 sub _Generate322KeySetKey304 {
    7495   my($This) = @_;
    7496   my($BondSymbol) = '$';
    7497
    7498   return $This->_DetectBondKeys('P', 'Br', $BondSymbol);
    7499 }
    7500
    7501 # Generate 322 keyset key 305 value as 1/0 indicating its presence/absence or
    7502 # count of its presence in a molecule.
    7503 #
    7504 # Key 305 description: P$Si
    7505 #
    7506 sub _Generate322KeySetKey305 {
    7507   my($This) = @_;
    7508   my($BondSymbol) = '$';
    7509
    7510   return $This->_DetectBondKeys('P', 'Si', $BondSymbol);
    7511 }
    7512
    7513 # Generate 322 keyset key 306 value as 1/0 indicating its presence/absence or
    7514 # count of its presence in a molecule.
    7515 #
    7516 # Key 306 description: P$I
    7517 #
    7518 sub _Generate322KeySetKey306 {
    7519   my($This) = @_;
    7520   my($BondSymbol) = '$';
    7521
    7522   return $This->_DetectBondKeys('P', 'I', $BondSymbol);
    7523 }
    7524
    7525 # Generate 322 keyset key 307 value as 1/0 indicating its presence/absence or
    7526 # count of its presence in a molecule.
    7527 #
    7528 # Key 307 description: P$X
    7529 #
    7530 sub _Generate322KeySetKey307 {
    7531   my($This) = @_;
    7532   my($BondSymbol) = '$';
    7533
    7534   return $This->_DetectBondKeys('P', 'Z', $BondSymbol);
    7535 }
    7536
    7537 # Generate 322 keyset key 308 value as 1/0 indicating its presence/absence or
    7538 # count of its presence in a molecule.
    7539 #
    7540 # Key 308 description: F$F
    7541 #
    7542 sub _Generate322KeySetKey308 {
    7543   my($This) = @_;
    7544   my($BondSymbol) = '$';
    7545
    7546   return $This->_DetectBondKeys('F', 'F', $BondSymbol);
    7547 }
    7548
    7549 # Generate 322 keyset key 309 value as 1/0 indicating its presence/absence or
    7550 # count of its presence in a molecule.
    7551 #
    7552 # Key 309 description: F$Br
    7553 #
    7554 sub _Generate322KeySetKey309 {
    7555   my($This) = @_;
    7556   my($BondSymbol) = '$';
    7557
    7558   return $This->_DetectBondKeys('F', 'Br', $BondSymbol);
    7559 }
    7560
    7561 # Generate 322 keyset key 310 value as 1/0 indicating its presence/absence or
    7562 # count of its presence in a molecule.
    7563 #
    7564 # Key 310 description: F$Si
    7565 #
    7566 sub _Generate322KeySetKey310 {
    7567   my($This) = @_;
    7568   my($BondSymbol) = '$';
    7569
    7570   return $This->_DetectBondKeys('F', 'Si', $BondSymbol);
    7571 }
    7572
    7573 # Generate 322 keyset key 311 value as 1/0 indicating its presence/absence or
    7574 # count of its presence in a molecule.
    7575 #
    7576 # Key 311 description: F$I
    7577 #
    7578 sub _Generate322KeySetKey311 {
    7579   my($This) = @_;
    7580   my($BondSymbol) = '$';
    7581
    7582   return $This->_DetectBondKeys('F', 'I', $BondSymbol);
    7583 }
    7584
    7585 # Generate 322 keyset key 312 value as 1/0 indicating its presence/absence or
    7586 # count of its presence in a molecule.
    7587 #
    7588 # Key 312 description: F$X
    7589 #
    7590 sub _Generate322KeySetKey312 {
    7591   my($This) = @_;
    7592   my($BondSymbol) = '$';
    7593
    7594   return $This->_DetectBondKeys('F', 'Z', $BondSymbol);
    7595 }
    7596
    7597 # Generate 322 keyset key 313 value as 1/0 indicating its presence/absence or
    7598 # count of its presence in a molecule.
    7599 #
    7600 # Key 313 description: Br$Br
    7601 #
    7602 sub _Generate322KeySetKey313 {
    7603   my($This) = @_;
    7604   my($BondSymbol) = '$';
    7605
    7606   return $This->_DetectBondKeys('Br', 'Br', $BondSymbol);
    7607 }
    7608
    7609 # Generate 322 keyset key 314 value as 1/0 indicating its presence/absence or
    7610 # count of its presence in a molecule.
    7611 #
    7612 # Key 314 description: Br$Si
    7613 #
    7614 sub _Generate322KeySetKey314 {
    7615   my($This) = @_;
    7616   my($BondSymbol) = '$';
    7617
    7618   return $This->_DetectBondKeys('Br', 'Si', $BondSymbol);
    7619 }
    7620
    7621 # Generate 322 keyset key 315 value as 1/0 indicating its presence/absence or
    7622 # count of its presence in a molecule.
    7623 #
    7624 # Key 315 description: Br$I
    7625 #
    7626 sub _Generate322KeySetKey315 {
    7627   my($This) = @_;
    7628   my($BondSymbol) = '$';
    7629
    7630   return $This->_DetectBondKeys('Br', 'I', $BondSymbol);
    7631 }
    7632
    7633 # Generate 322 keyset key 316 value as 1/0 indicating its presence/absence or
    7634 # count of its presence in a molecule.
    7635 #
    7636 # Key 316 description: Br$X
    7637 #
    7638 sub _Generate322KeySetKey316 {
    7639   my($This) = @_;
    7640   my($BondSymbol) = '$';
    7641
    7642   return $This->_DetectBondKeys('Br', 'Z', $BondSymbol);
    7643 }
    7644
    7645 # Generate 322 keyset key 317 value as 1/0 indicating its presence/absence or
    7646 # count of its presence in a molecule.
    7647 #
    7648 # Key 317 description: Si$Si
    7649 #
    7650 sub _Generate322KeySetKey317 {
    7651   my($This) = @_;
    7652   my($BondSymbol) = '$';
    7653
    7654   return $This->_DetectBondKeys('Si', 'Si', $BondSymbol);
    7655 }
    7656
    7657 # Generate 322 keyset key 318 value as 1/0 indicating its presence/absence or
    7658 # count of its presence in a molecule.
    7659 #
    7660 # Key 318 description: Si$I
    7661 #
    7662 sub _Generate322KeySetKey318 {
    7663   my($This) = @_;
    7664   my($BondSymbol) = '$';
    7665
    7666   return $This->_DetectBondKeys('Si', 'I', $BondSymbol);
    7667 }
    7668
    7669 # Generate 322 keyset key 319 value as 1/0 indicating its presence/absence or
    7670 # count of its presence in a molecule.
    7671 #
    7672 # Key 319 description: Si$X
    7673 #
    7674 sub _Generate322KeySetKey319 {
    7675   my($This) = @_;
    7676   my($BondSymbol) = '$';
    7677
    7678   return $This->_DetectBondKeys('Si', 'Z', $BondSymbol);
    7679 }
    7680
    7681 # Generate 322 keyset key 320 value as 1/0 indicating its presence/absence or
    7682 # count of its presence in a molecule.
    7683 #
    7684 # Key 320 description: I$I
    7685 #
    7686 sub _Generate322KeySetKey320 {
    7687   my($This) = @_;
    7688   my($BondSymbol) = '$';
    7689
    7690   return $This->_DetectBondKeys('I', 'I', $BondSymbol);
    7691 }
    7692
    7693 # Generate 322 keyset key 321 value as 1/0 indicating its presence/absence or
    7694 # count of its presence in a molecule.
    7695 #
    7696 # Key 321 description: I$X
    7697 #
    7698 sub _Generate322KeySetKey321 {
    7699   my($This) = @_;
    7700   my($BondSymbol) = '$';
    7701
    7702   return $This->_DetectBondKeys('I', 'Z', $BondSymbol);
    7703 }
    7704
    7705 # Generate 322 keyset key 322 value as 1/0 indicating its presence/absence or
    7706 # count of its presence in a molecule.
    7707 #
    7708 # Key 322 description: X$X
    7709 #
    7710 sub _Generate322KeySetKey322 {
    7711   my($This) = @_;
    7712   my($BondSymbol) = '$';
    7713
    7714   return $This->_DetectBondKeys('Z', 'Z', $BondSymbol);
    7715 }
    7716
    7717 # A : Any valid perodic table elemnet symbol
    7718 sub _IsAtom {
    7719   my($This, $Atom) = @_;
    7720
    7721   return $Atom->GetAtomicNumber() ? 1 : 0;
    7722 }
    7723
    7724 # Q  : Hetro atoms; any non-C or non-H atom
    7725 sub _IsHeteroAtom {
    7726   my($This, $Atom) = @_;
    7727
    7728   return ($Atom->GetAtomicNumber() =~ /^(1|6)$/) ? 0 : 1;
    7729 }
    7730
    7731 # X  : Halogens; F, Cl, Br, I
    7732 sub _IsHalogenAtom {
    7733   my($This, $Atom) = @_;
    7734
    7735   return ($Atom->GetAtomicNumber() =~ /^(9|17|35|53)$/) ? 1 : 0;
    7736 }
    7737
    7738 # Z  : Others; other than H, C, N, O, Si, P, S, F, Cl, Br, I
    7739 sub _IsOtherAtom {
    7740   my($This, $Atom) = @_;
    7741
    7742   return ($Atom->GetAtomicNumber() =~ /^(1|6|7|8|9|14|15|16|17|35|53)$/) ? 0 : 1;
    7743 }
    7744
    7745 # Detect atom keys like Cl, Br and so on...
    7746 #
    7747 sub _DetectAtomKeys {
    7748   my($This, $AtomSymbol, $MinKeyCount, $IsInRing, $MinHydrogenCount) = @_;
    7749   my($Atom, $KeyValue);
    7750
    7751   $KeyValue = 0;
    7752   ATOM: for $Atom (@{$This->{Atoms}}) {
    7753     if (!$This->_DoesAtomMatchesSymbol($Atom, $AtomSymbol)) {
    7754       next ATOM;
    7755     }
    7756     if (defined($IsInRing) && $IsInRing && !$Atom->IsInRing()) {
    7757       next ATOM;
    7758     }
    7759     if (defined $MinHydrogenCount) {
    7760       if (!$This->_DoesAtomMinHydrogenCountMatch($Atom, $MinHydrogenCount)) {
    7761         next ATOM;
    7762       }
    7763     }
    7764     $KeyValue++;
    7765     if (defined($MinKeyCount) && $KeyValue < $MinKeyCount) {
    7766       next ATOM;
    7767     }
    7768     if ($This->{KeyBits}) {
    7769       $KeyValue = 1;
    7770       last ATOM;
    7771     }
    7772   }
    7773   return $KeyValue;
    7774 }
    7775
    7776 # Detect bond keys like S-S, N-O and so on...
    7777 #
    7778 sub _DetectBondKeys {
    7779   my($This, $AtomSymbol1, $AtomSymbol2, $BondSymbol, $MinKeyCount, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount) = @_;
    7780   my($Atom1, $Atom2, $Bond, $KeyValue, $MatchSpecifiedAtomOrder);
    7781
    7782   $MatchSpecifiedAtomOrder = 0;
    7783
    7784   $KeyValue = 0;
    7785   BOND: for $Bond (@{$This->{Bonds}}) {
    7786     ($Atom1, $Atom2) = $Bond->GetAtoms();
    7787     if (!$This->_DoBondAtomsMatchBondSymbols($Atom1, $Atom2, $AtomSymbol1, $AtomSymbol2, $BondSymbol, $MatchSpecifiedAtomOrder, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount)) {
    7788       next BOND;
    7789     }
    7790     $KeyValue++;
    7791     if (defined($MinKeyCount) && $KeyValue < $MinKeyCount) {
    7792       next BOND;
    7793     }
    7794     if ($This->{KeyBits}) {
    7795       $KeyValue = 1;
    7796       last BOND;
    7797     }
    7798   }
    7799   return $KeyValue;
    7800 }
    7801
    7802 # Detect atom neighborhood keys like ON(C)C, OC(O)O and so on.
    7803 #
    7804 sub _DetectAtomNeighborhoodKeys {
    7805   my($This, $CentralAtomSymbol, $NbrAtomSymbolsRef, $NbrBondSymbolsRef, $MinKeyCount, $CentralAtomMinHydrogenCount, $NbrAtomMinHydrogenCountRef) = @_;
    7806   my($KeyValue, $CentralAtom);
    7807
    7808   $KeyValue = 0;
    7809
    7810   CENTRALATOM: for $CentralAtom (@{$This->{Atoms}}) {
    7811     if (!$This->_DoesAtomNeighborhoodMatch($CentralAtom, $CentralAtomSymbol, $NbrAtomSymbolsRef, $NbrBondSymbolsRef, $CentralAtomMinHydrogenCount, $NbrAtomMinHydrogenCountRef)) {
    7812       next CENTRALATOM;
    7813     }
    7814     $KeyValue++;
    7815     if (defined($MinKeyCount) && $KeyValue < $MinKeyCount) {
    7816       next CENTRALATOM;
    7817     }
    7818     if ($This->{KeyBits}) {
    7819       $KeyValue = 1;
    7820       last CENTRALATOM;
    7821     }
    7822   }
    7823   return $KeyValue;
    7824 }
    7825
    7826 # Detect bond neighborhood keys like A%Anot%A%A and so on.
    7827 #
    7828 sub _DetectBondNeighborhoodKeys {
    7829   my($This, $BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, $NbrAtomSymbolsRef, $NbrBondSymbolsRef, $MinKeyCount, $BondAtomMinHydrogenCountRef, $NbrsMinHydrogenCountRef) = @_;
    7830   my($BondAtomIndex, $BondAtom1, $BondAtom2, $MatchedBondAtom1, $MatchedBondAtom2, $BondAtom, $Bond, $KeyValue, $BondAtomSymbol, $MatchSpecifiedAtomOrder, $BondAtom1MinHydrogenCount, $BondAtom2MinHydrogenCount, $MinHydrogenCount, @NbrsToExcludeFromMatch, @NbrAtomSymbols, @NbrBondSymbols, @NbrMinHydrogenCount, );
    7831
    7832   $MatchSpecifiedAtomOrder = 1;
    7833   ($BondAtom1MinHydrogenCount, $BondAtom2MinHydrogenCount) = defined($BondAtomMinHydrogenCountRef) ? ( @{$BondAtomMinHydrogenCountRef} ) : (undef, undef);
    7834
    7835   $KeyValue = 0;
    7836   BOND: for $Bond (@{$This->{Bonds}}) {
    7837     ($BondAtom1, $BondAtom2) = $Bond->GetAtoms();
    7838
    7839     # Match bond first...
    7840     if ($This->_DoBondAtomsMatchBondSymbols($BondAtom1, $BondAtom2, $BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, $MatchSpecifiedAtomOrder, $BondAtom1MinHydrogenCount, $BondAtom2MinHydrogenCount)) {
    7841       ($MatchedBondAtom1, $MatchedBondAtom2) = ($BondAtom1, $BondAtom2);
    7842     }
    7843     elsif ($This->_DoBondAtomsMatchBondSymbols($BondAtom2, $BondAtom1, $BondAtomSymbol1, $BondAtomSymbol2, $BondSymbol, $MatchSpecifiedAtomOrder, $BondAtom1MinHydrogenCount, $BondAtom2MinHydrogenCount)) {
    7844       ($MatchedBondAtom1, $MatchedBondAtom2) = ($BondAtom2, $BondAtom1);
    7845     }
    7846     else {
    7847       next BOND;
    7848     }
    7849     # Match neighbors of bonded atoms...
    7850     for $BondAtomIndex (0 .. 1) {
    7851       $MinHydrogenCount = undef;
    7852       @NbrsToExcludeFromMatch = ();
    7853
    7854       if ($BondAtomIndex == 0) {
    7855         $BondAtom = $MatchedBondAtom1;
    7856         $BondAtomSymbol = $BondAtomSymbol1;
    7857         push @NbrsToExcludeFromMatch, $MatchedBondAtom2;
    7858       }
    7859       elsif ($BondAtomIndex == 1) {
    7860         $BondAtom = $MatchedBondAtom2;
    7861         $BondAtomSymbol = $BondAtomSymbol2;
    7862         push @NbrsToExcludeFromMatch, $MatchedBondAtom1;
    7863       }
    7864
    7865       @NbrAtomSymbols = (defined($NbrAtomSymbolsRef) && defined($NbrAtomSymbolsRef->[$BondAtomIndex])) ? @{$NbrAtomSymbolsRef->[$BondAtomIndex]} : ();
    7866       @NbrBondSymbols = (defined($NbrBondSymbolsRef) && defined($NbrBondSymbolsRef->[$BondAtomIndex]) ) ? @{$NbrBondSymbolsRef->[$BondAtomIndex]} : ();
    7867       @NbrMinHydrogenCount = (defined($NbrsMinHydrogenCountRef) && defined($NbrsMinHydrogenCountRef->[$BondAtomIndex]) ) ? @{$NbrsMinHydrogenCountRef->[$BondAtomIndex]} : ();
    7868       if (!$This->_DoesAtomNeighborhoodMatch($BondAtom, $BondAtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinHydrogenCount, \@NbrMinHydrogenCount, \@NbrsToExcludeFromMatch)) {
    7869         next BOND;
    7870       }
    7871     }
    7872     $KeyValue++;
    7873     if (defined($MinKeyCount) && $KeyValue < $MinKeyCount) {
    7874       next BOND;
    7875     }
    7876     if ($This->{KeyBits}) {
    7877       $KeyValue = 1;
    7878       last BOND;
    7879     }
    7880   }
    7881   return $KeyValue;
    7882 }
    7883
    7884 # Detect extended atom neighborhood keys like QHAQH, QHAAQH, and so on...
    7885 #
    7886 sub _DetectExtendedAtomNeighborhoodKeys {
    7887   my($This, $CentralAtomsSymbolsRef, $CentralAtomsBondSymbolsRef, $CentralAtomsMinHydrogenCountRef, $MinKeyCount, $NbrAtomSymbolsRef, $NbrBondSymbolsRef, $NbrsMinHydrogenCountRef) = @_;
    7888   my($KeyValue, $Molecule, $FirstCentralAtomIndex, $LastCentralAtomIndex, $NumOfCentralAtoms);
    7889
    7890   $KeyValue = 0;
    7891
    7892   $Molecule = $This->GetMolecule();
    7893   $NumOfCentralAtoms = @{$CentralAtomsSymbolsRef};
    7894   $FirstCentralAtomIndex = 0;
    7895   $LastCentralAtomIndex = $NumOfCentralAtoms - 1;
    7896
    7897   # Retrieve first central atom information...
    7898   my($FirstCentralAtomSymbol, $FirstCentralAtomMinHydrogenCount);
    7899   $FirstCentralAtomSymbol = $CentralAtomsSymbolsRef->[$FirstCentralAtomIndex];
    7900   $FirstCentralAtomMinHydrogenCount = defined($CentralAtomsMinHydrogenCountRef) ? $CentralAtomsMinHydrogenCountRef->[$FirstCentralAtomIndex] : undef;
    7901
    7902   # Retrieve last central atom information...
    7903   my($LastCentralAtomSymbol, $LastCentralAtomMinHydrogenCount);
    7904   $LastCentralAtomSymbol = $CentralAtomsSymbolsRef->[$LastCentralAtomIndex];
    7905   $LastCentralAtomMinHydrogenCount = defined($CentralAtomsMinHydrogenCountRef) ? $CentralAtomsMinHydrogenCountRef->[$LastCentralAtomIndex] : undef;
    7906
    7907   my($Atom, $AtomPathRef, $AtomPathsRef, $FirstAtomIndex, $LastAtomIndex, $AtomIndex, $FirstPathAtom, $LastPathAtom, $FirstPathAtomID, $LastPathAtomID, $DetectedPathID, $PathAtom, $NextPathAtom, $PreviousPathAtom, $AtomSymbol, $NextAtomSymbol, $BondSymbol, $MatchSpecifiedAtomOrder, $MinHydrogenCount, @NbrsToExcludeFromMatch, @NbrAtomSymbols, @NbrBondSymbols, @NbrMinHydrogenCount, %AlreadyDetectedPaths);
    7908
    7909   # Go over all the atoms...
    7910   #
    7911   ATOM: for $Atom (@{$This->{Atoms}}) {
    7912     # Match first central atom...
    7913     if (!$This->_DoesAtomNeighborhoodMatch($Atom, $FirstCentralAtomSymbol, undef, undef, $FirstCentralAtomMinHydrogenCount, undef)) {
    7914       next ATOM;
    7915     }
    7916     # Get atom paths starting from matched central atom with length equal to NumOfCentralAtoms...
    7917     #
    7918     $AtomPathsRef = $Molecule->GetAllAtomPathsStartingAtWithLength($Atom, $NumOfCentralAtoms);
    7919     if (!(defined($AtomPathsRef) && @{$AtomPathsRef})) {
    7920       next ATOM;
    7921     }
    7922     ATOMPATH: for $AtomPathRef (@{$AtomPathsRef}) {
    7923       $FirstAtomIndex = 0;
    7924       $FirstPathAtom = $AtomPathRef->[$FirstAtomIndex];
    7925       $LastAtomIndex = @{$AtomPathRef} - 1;
    7926       $LastPathAtom = $AtomPathRef->[$LastAtomIndex];
    7927
    7928       # Match last central atom to the last atom in path...
    7929       if (!$This->_DoesAtomNeighborhoodMatch($LastPathAtom, $LastCentralAtomSymbol, undef, undef, $LastCentralAtomMinHydrogenCount, undef)) {
    7930         next ATOMPATH;
    7931       }
    7932
    7933       # Match other path atoms with central atoms..
    7934       for $AtomIndex ($FirstAtomIndex .. $LastAtomIndex) {
    7935         $PathAtom = $AtomPathRef->[$AtomIndex];
    7936         $AtomSymbol = $CentralAtomsSymbolsRef->[$AtomIndex];
    7937         $MinHydrogenCount = defined($CentralAtomsMinHydrogenCountRef) ? $CentralAtomsMinHydrogenCountRef->[$AtomIndex] : undef;
    7938
    7939         @NbrsToExcludeFromMatch = ();
    7940         if ($AtomIndex == $FirstAtomIndex) {
    7941           $NextPathAtom = $AtomPathRef->[$AtomIndex + 1]; $PreviousPathAtom = undef;
    7942           push @NbrsToExcludeFromMatch, $NextPathAtom;
    7943         }
    7944         elsif ($AtomIndex == $LastAtomIndex) {
    7945           $NextPathAtom = undef; $PreviousPathAtom = $AtomPathRef->[$AtomIndex - 1];
    7946           push @NbrsToExcludeFromMatch, $PreviousPathAtom;
    7947         }
    7948         else {
    7949           $NextPathAtom = $AtomPathRef->[$AtomIndex + 1]; $PreviousPathAtom = $AtomPathRef->[$AtomIndex - 1];
    7950           push @NbrsToExcludeFromMatch, ($PreviousPathAtom, $NextPathAtom);
    7951         }
    7952
    7953         @NbrAtomSymbols = (defined($NbrAtomSymbolsRef) && defined($NbrAtomSymbolsRef->[$AtomIndex])) ? @{$NbrAtomSymbolsRef->[$AtomIndex]} : ();
    7954         @NbrBondSymbols = (defined($NbrBondSymbolsRef) && defined($NbrBondSymbolsRef->[$AtomIndex]) ) ? @{$NbrBondSymbolsRef->[$AtomIndex]} : ();
    7955         @NbrMinHydrogenCount = (defined($NbrsMinHydrogenCountRef) && defined($NbrsMinHydrogenCountRef->[$AtomIndex]) ) ? @{$NbrsMinHydrogenCountRef->[$AtomIndex]} : ();
    7956
    7957         if (!$This->_DoesAtomNeighborhoodMatch($PathAtom, $AtomSymbol, \@NbrAtomSymbols, \@NbrBondSymbols, $MinHydrogenCount, \@NbrMinHydrogenCount, \@NbrsToExcludeFromMatch)) {
    7958           next ATOMPATH;
    7959         }
    7960         # Match path bond symbols...
    7961         if (defined($CentralAtomsBondSymbolsRef) && ($AtomIndex < $LastAtomIndex)) {
    7962           $NextAtomSymbol = $CentralAtomsSymbolsRef->[$AtomIndex + 1];
    7963           $BondSymbol = $CentralAtomsBondSymbolsRef->[$AtomIndex];
    7964           $MatchSpecifiedAtomOrder = 1;
    7965           if (!$This->_DoBondAtomsMatchBondSymbols($PathAtom, $NextPathAtom, $AtomSymbol, $NextAtomSymbol, $BondSymbol, $MatchSpecifiedAtomOrder)) {
    7966             next ATOMPATH;
    7967           }
    7968         }
    7969       }
    7970       # Keep track of the first and last atom ID in the matched path to avoid double counting of paths...
    7971       if (defined($MinKeyCount) || !$This->{KeyBits}) {
    7972         $FirstPathAtomID = $FirstPathAtom->GetID(); $LastPathAtomID = $LastPathAtom->GetID();
    7973         $DetectedPathID = ($FirstPathAtomID < $LastPathAtomID) ? "${FirstPathAtomID}-${LastPathAtomID}" : "${LastPathAtomID}-${FirstPathAtomID}";
    7974         if (exists $AlreadyDetectedPaths{$DetectedPathID}) {
    7975           $AlreadyDetectedPaths{$DetectedPathID} += 1;
    7976           next ATOMPATH;
    7977         }
    7978         $AlreadyDetectedPaths{$DetectedPathID} = 1;
    7979       }
    7980
    7981       $KeyValue++;
    7982       if (defined($MinKeyCount) && $KeyValue < $MinKeyCount) {
    7983         next ATOMPATH;
    7984       }
    7985       if ($This->{KeyBits}) {
    7986         $KeyValue = 1;
    7987         last ATOM;
    7988       }
    7989     }
    7990   }
    7991   return $KeyValue;
    7992 }
    7993
    7994 # Go over the atoms attached to central atom and match 'em against specified
    7995 # neighborhood atom symbol and bond symbols...
    7996 #
    7997 sub _DoesAtomNeighborhoodMatch {
    7998   my($This, $CentralAtom, $CentralAtomSymbol, $NbrAtomSymbolsRef, $NbrBondSymbolsRef, $CentralAtomMinHydrogenCount, $NbrAtomMinHydrogenCountRef, $NbrsToExcludeRef) = @_;
    7999
    8000   # Match central atom first...
    8001   if (!$This->_DoesAtomMatchesSymbol($CentralAtom, $CentralAtomSymbol)) {
    8002     return 0;
    8003   }
    8004   if (defined $CentralAtomMinHydrogenCount) {
    8005     if (!$This->_DoesAtomMinHydrogenCountMatch($CentralAtom, $CentralAtomMinHydrogenCount)) {
    8006       return 0;
    8007     }
    8008   }
    8009   if (!defined $NbrAtomSymbolsRef) {
    8010     # No neighbors to match...
    8011     return 1;
    8012   }
    8013
    8014   # Match neighbors...
    8015   my($NbrAtom, $Index, $NbrAtomSymbol, $NbrBondSymbol, $NbrAtomMinHydrogenCount, $NbrAtomMatchCount, $MinNbrAtomMatchCount, $MatchSpecifiedAtomOrder, @CentralAtomNeighbors, %NbrAtomAlreadyMatchedMap);
    8016
    8017   $MinNbrAtomMatchCount = @$NbrAtomSymbolsRef;
    8018   if (!$MinNbrAtomMatchCount) {
    8019     # No neighbors to match...
    8020     return 1;
    8021   }
    8022
    8023   $NbrAtomMatchCount = 0;
    8024
    8025   %NbrAtomAlreadyMatchedMap = ();
    8026   $MatchSpecifiedAtomOrder = 1;
    8027
    8028   @CentralAtomNeighbors = ();
    8029   if (defined($NbrsToExcludeRef) && @{$NbrsToExcludeRef}) {
    8030     push @CentralAtomNeighbors, $CentralAtom->GetNeighbors(@{$NbrsToExcludeRef});
    8031   }
    8032   else {
    8033     push @CentralAtomNeighbors, $CentralAtom->GetNeighbors();
    8034   }
    8035
    8036   NBRATOM: for $NbrAtom (@CentralAtomNeighbors) {
    8037     NBRATOMSYMBOL: for $Index (0 .. ($MinNbrAtomMatchCount - 1)) {
    8038       if (exists $NbrAtomAlreadyMatchedMap{$Index}) {
    8039         next NBRATOMSYMBOL;
    8040       }
    8041       $NbrAtomSymbol = $NbrAtomSymbolsRef->[$Index];
    8042       $NbrBondSymbol = $NbrBondSymbolsRef->[$Index];
    8043       if (!$This->_DoBondAtomsMatchBondSymbols($CentralAtom, $NbrAtom, $CentralAtomSymbol, $NbrAtomSymbol, $NbrBondSymbol, $MatchSpecifiedAtomOrder)) {
    8044         next NBRATOMSYMBOL;
    8045       }
    8046
    8047       if (defined($NbrAtomMinHydrogenCountRef) && $NbrAtomMinHydrogenCountRef->[$Index]) {
    8048         $NbrAtomMinHydrogenCount = $NbrAtomMinHydrogenCountRef->[$Index];
    8049         if (!$This->_DoesAtomMinHydrogenCountMatch($NbrAtom, $NbrAtomMinHydrogenCount)) {
    8050           next NBRATOMSYMBOL;
    8051         }
    8052       }
    8053       $NbrAtomAlreadyMatchedMap{$Index} = $Index;
    8054       $NbrAtomMatchCount++;
    8055
    8056       if ($NbrAtomMatchCount == $MinNbrAtomMatchCount) {
    8057         last NBRATOM;
    8058       }
    8059       next NBRATOM;
    8060     }
    8061   }
    8062
    8063   return ($NbrAtomMatchCount == $MinNbrAtomMatchCount) ? 1 : 0;
    8064 }
    8065
    8066 # Checks whether bond atoms match bond symbols...
    8067 #
    8068 sub _DoBondAtomsMatchBondSymbols {
    8069   my($This, $Atom1, $Atom2, $AtomSymbol1, $AtomSymbol2, $BondSymbol, $MatchSpecifiedAtomOrder, $Atom1MinHydrogenCount, $Atom2MinHydrogenCount) = @_;
    8070   my($Status, $ReverseMinHydrogenCountMatch);
    8071
    8072   $ReverseMinHydrogenCountMatch = 0;
    8073
    8074   if (defined($MatchSpecifiedAtomOrder) && $MatchSpecifiedAtomOrder) {
    8075     if (!($This->_DoesAtomMatchesSymbol($Atom1, $AtomSymbol1) && $This->_DoesAtomMatchesSymbol($Atom2, $AtomSymbol2))) {
    8076       return 0;
    8077     }
    8078   }
    8079   else {
    8080     if ($This->_DoesAtomMatchesSymbol($Atom1, $AtomSymbol1) && $This->_DoesAtomMatchesSymbol($Atom2, $AtomSymbol2)) {
    8081       $ReverseMinHydrogenCountMatch = 0;
    8082     }
    8083     elsif ($This->_DoesAtomMatchesSymbol($Atom1, $AtomSymbol2) && $This->_DoesAtomMatchesSymbol($Atom2, $AtomSymbol1)) {
    8084       $ReverseMinHydrogenCountMatch = 1;
    8085     }
    8086     else {
    8087       return 0;
    8088     }
    8089   }
    8090
    8091   # Match any hydrogen count...
    8092   if (defined($Atom1MinHydrogenCount) || defined($Atom2MinHydrogenCount)) {
    8093     my($MinHydrogenCountMatchAtom1, $MinHydrogenCountMatchAtom2);
    8094
    8095     ($MinHydrogenCountMatchAtom1, $MinHydrogenCountMatchAtom2) = $ReverseMinHydrogenCountMatch ? ($Atom2, $Atom1) : ($Atom1, $Atom2);
    8096     if (defined $Atom1MinHydrogenCount ) {
    8097       if (!$This->_DoesAtomMinHydrogenCountMatch($MinHydrogenCountMatchAtom1, $Atom1MinHydrogenCount)) {
    8098         return 0;
    8099       }
    8100     }
    8101     if (defined $Atom2MinHydrogenCount ) {
    8102       if (!$This->_DoesAtomMinHydrogenCountMatch($MinHydrogenCountMatchAtom2, $Atom2MinHydrogenCount)) {
    8103         return 0;
    8104       }
    8105     }
    8106   }
    8107
    8108   if (defined($BondSymbol) && $BondSymbol) {
    8109     my($Bond);
    8110     $Bond = $Atom1->GetBondToAtom($Atom2);
    8111     if (!$This->_DoesBondMatchesSymbol($Bond, $BondSymbol)) {
    8112       return 0;
    8113     }
    8114   }
    8115   return 1;
    8116 }
    8117
    8118 # Match both implicit and explicit hydrogens on central atom...
    8119 sub _DoesAtomMinHydrogenCountMatch {
    8120   my($This, $Atom, $MinHydrogenCount) = @_;
    8121
    8122   if (!(defined($MinHydrogenCount) && $MinHydrogenCount)) {
    8123     return 0;
    8124   }
    8125   return ($Atom->GetNumOfHydrogens() <  $MinHydrogenCount) ? 0 : 1;
    8126 }
    8127
    8128 # Checks whether atom matches supported symbol...
    8129 #
    8130 sub _DoesAtomMatchesSymbol {
    8131   my($This, $Atom, $Symbol) = @_;
    8132   my($Status);
    8133
    8134   $Status = 0;
    8135   SYMBOL: {
    8136     if ($Symbol =~ /^Q$/i) { $Status = $This->_IsHeteroAtom($Atom) ? 1 : 0; last SYMBOL; }
    8137     if ($Symbol =~ /^X$/i) { $Status = $This->_IsHalogenAtom($Atom) ? 1 : 0; last SYMBOL; }
    8138     if ($Symbol =~ /^Z$/i) { $Status = $This->_IsOtherAtom($Atom) ? 1 : 0; last SYMBOL; }
    8139     if ($Symbol =~ /^A$/i) { $Status = $This->_IsAtom($Atom) ? 1 : 0; last SYMBOL; }
    8140     $Status = ($Atom->GetAtomSymbol() =~ /^$Symbol$/i) ? 1 : 0;
    8141   }
    8142   return $Status;
    8143 }
    8144
    8145 # Checks whether bond matches supported symbol...
    8146 #
    8147 sub _DoesBondMatchesSymbol {
    8148   my($This, $Bond, $Symbol) = @_;
    8149   my($Status, $BondOrder);
    8150
    8151   $Status = 0;
    8152   SYMBOL: {
    8153     if ($Symbol =~ /^(1|-)$/i) { $Status = $Bond->IsSingle() ? 1 : 0; last SYMBOL; }
    8154     if ($Symbol =~ /^(2|=)$/i) { $Status = $Bond->IsDouble() ? 1 : 0; last SYMBOL; }
    8155     if ($Symbol =~ /^(3|#|T)$/i) { $Status = $Bond->IsTriple() ? 1 : 0; last SYMBOL; }
    8156     if ($Symbol =~ /^(1.5|%)$/i) { $Status = $Bond->IsAromatic() ? 1 : 0; last SYMBOL; }
    8157
    8158     if ($Symbol =~ /^\~$/i) { $Status = ($Bond->IsSingle() || $Bond->IsDouble()) ? 1 : 0; last SYMBOL; }
    8159
    8160     if ($Symbol =~ /^\$$/i) { $Status = $Bond->IsInRing() ? 1 : 0; last SYMBOL; }
    8161     if ($Symbol =~ /^\!$/i) { $Status = $Bond->IsInRing() ? 0 : 1; last SYMBOL; }
    8162
    8163     if ($Symbol =~ /^(\$-)$/i) { $Status = ($Bond->IsInRing() && $Bond->IsSingle()) ? 1 : 0; last SYMBOL; }
    8164     if ($Symbol =~ /^(\$=)$/i) { $Status = ($Bond->IsInRing() && $Bond->IsDouble()) ? 1 : 0; last SYMBOL; }
    8165     if ($Symbol =~ /^(\$#|\$T)$/i) { $Status = ($Bond->IsInRing() && $Bond->IsTriple()) ? 1 : 0; last SYMBOL; }
    8166
    8167     if ($Symbol =~ /^(not%)$/i) { $Status = $Bond->IsAromatic() ? 0 : 1; last SYMBOL; }
    8168     if ($Symbol =~ /^(not%not-)$/i) { $Status = $Bond->IsAromatic() ? 0 : ($Bond->IsSingle() ? 0 : 1); last SYMBOL; }
    8169     if ($Symbol =~ /^(not%not=)$/i) { $Status = $Bond->IsAromatic() ? 0 : ($Bond->IsDouble() ? 0 : 1); last SYMBOL; }
    8170
    8171     $Status = 0;
    8172   }
    8173   return $Status;
    8174 }
    8175
    8176 # Cache  appropriate molecule data...
    8177 #
    8178 sub _SetupMoleculeDataCache {
    8179   my($This) = @_;
    8180
    8181   @{$This->{Atoms}} = $This->GetMolecule()->GetAtoms();
    8182   @{$This->{Bonds}} = $This->GetMolecule()->GetBonds();
    8183
    8184   return $This;
    8185 }
    8186
    8187 # Clear cached molecule data...
    8188 #
    8189 sub _ClearMoleculeDataCache {
    8190   my($This) = @_;
    8191
    8192   @{$This->{Atoms}} = ();
    8193   @{$This->{Bonds}} = ();
    8194
    8195   return $This;
    8196 }
    8197
    8198 # Return a string containg data for MACCSKeys object...
    8199 sub StringifyMACCSKeys {
    8200   my($This) = @_;
    8201   my($MACCSKeysString);
    8202
    8203   # Type of Keys...
    8204   $MACCSKeysString = "Type: $This->{Type}; Size: $This->{Size}";
    8205
    8206   if ($This->{Type} =~ /^MACCSKeyBits$/i) {
    8207     $MACCSKeysString .= "; FingerprintsBitVector: < $This->{FingerprintsBitVector} >";
    8208   }
    8209   elsif ($This->{Type} =~ /^MACCSKeyCount$/i) {
    8210     $MACCSKeysString .= "; FingerprintsVector: < $This->{FingerprintsVector} >";
    8211   }
    8212
    8213   return $MACCSKeysString;
    8214 }
    8215