@@ -538,21 +538,37 @@ public int getConnAtom(int atom, int i) {
538
538
539
539
/**
540
540
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
541
- * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
541
+ * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
542
+ * 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
543
+ * 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
544
+ * Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
545
+ * Note: This method includes neighbours marked as being part of an exclude group!
546
+ * @param atom
547
+ * @return count of category 1 neighbour atoms (excludes plain H and bond zero orders)
548
+ */
549
+ public int getNotExcludedConnAtoms (int atom ) {
550
+ return mConnAtoms [atom ] - getExcludedNeighbourCount (atom );
551
+ }
552
+
553
+
554
+ /**
555
+ * The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
556
+ * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non-natural abundance isotops, custom labelled hydrogen, etc.)<br>
542
557
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
543
558
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
544
559
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
560
+ * Note: This method includes neighbours marked as being part of an exclude group!
545
561
* @param atom
546
562
* @return count of category 1 neighbour atoms (excludes plain H and bond zero orders)
547
563
*/
548
564
public int getConnAtoms (int atom ) {
549
565
return mConnAtoms [atom ];
550
- }
566
+ }
551
567
552
568
553
569
/**
554
570
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
555
- * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
571
+ * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non- natural abundance isotops, custom labelled hydrogen, etc.)<br>
556
572
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
557
573
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
558
574
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
@@ -566,7 +582,7 @@ public int getAllConnAtomsPlusMetalBonds(int atom) {
566
582
567
583
/**
568
584
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
569
- * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
585
+ * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non- natural abundance isotops, custom labelled hydrogen, etc.)<br>
570
586
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
571
587
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
572
588
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
@@ -581,7 +597,7 @@ public int getConnBond(int atom, int i) {
581
597
582
598
/**
583
599
* The neighbours (connected atoms) of any atom are sorted by their relevance:<br>
584
- * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non natural abundance isotops, custom labelled hydrogen, etc.)<br>
600
+ * 1. non-hydrogen atoms (bond order 1 and above) and unusual hydrogen atoms (non- natural abundance isotops, custom labelled hydrogen, etc.)<br>
585
601
* 2. plain-hydrogen atoms (natural abundance, bond order 1)<br>
586
602
* 3. loosely connected atoms (bond order 0, i.e. metall ligand bond)<br>
587
603
* Only valid after calling ensureHelperArrays(cHelperNeighbours or higher);
@@ -616,13 +632,14 @@ public int getNonHydrogenNeighbourCount(int atom) {
616
632
/**
617
633
* This method returns the count of atom neighbours which are marked as being an exclude group.
618
634
* @param atom
619
- * @return the number of non-hydrogen neighbor atoms
635
+ * @return the number of non-hydrogen neighbor atoms marked as being part of an exclude group
620
636
*/
621
637
public int getExcludedNeighbourCount (int atom ) {
622
638
int count = 0 ;
623
- for (int i =0 ; i <mConnAtoms [atom ]; i ++)
624
- if ((mAtomQueryFeatures [mConnAtom [atom ][i ]] & Molecule .cAtomQFExcludeGroup ) != 0 )
625
- count ++;
639
+ if (mIsFragment )
640
+ for (int i =0 ; i <mConnAtoms [atom ]; i ++)
641
+ if ((mAtomQueryFeatures [mConnAtom [atom ][i ]] & Molecule .cAtomQFExcludeGroup ) != 0 )
642
+ count ++;
626
643
return count ;
627
644
}
628
645
@@ -1736,17 +1753,17 @@ public boolean isHeteroAromaticAtom(int atom) {
1736
1753
* @return whether the atom is a member of a delocalized ring (subset of aromatic rings)
1737
1754
*/
1738
1755
public boolean isDelocalizedAtom (int atom ) {
1739
- return ( atom < mAtoms ) ? mRingSet .isDelocalizedAtom (atom ) : false ;
1756
+ return atom < mAtoms && mRingSet .isDelocalizedAtom (atom );
1740
1757
}
1741
1758
1742
1759
1743
1760
public boolean isAromaticBond (int bond ) {
1744
- return ( bond < mBonds ) ? mRingSet .isAromaticBond (bond ) : false ;
1761
+ return bond < mBonds && mRingSet .isAromaticBond (bond );
1745
1762
}
1746
1763
1747
1764
1748
1765
public boolean isHeteroAromaticBond (int bond ) {
1749
- return ( bond < mBonds ) ? mRingSet .isHeteroAromaticBond (bond ) : false ;
1766
+ return bond < mBonds && mRingSet .isHeteroAromaticBond (bond );
1750
1767
}
1751
1768
1752
1769
@@ -3482,12 +3499,12 @@ public void ensureHelperArrays(int required) {
3482
3499
if ((mValidHelperArrays & cHelperBitNeighbours ) == 0 ) {
3483
3500
handleHydrogens ();
3484
3501
calculateNeighbours ();
3485
-
3486
3502
mValidHelperArrays |= cHelperBitNeighbours ;
3487
3503
3488
3504
if (convertHydrogenToQueryFeatures ()) {
3489
3505
handleHydrogens ();
3490
3506
calculateNeighbours ();
3507
+ mValidHelperArrays |= cHelperBitNeighbours ;
3491
3508
}
3492
3509
}
3493
3510
0 commit comments