MayaChemTools

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