Skip to content

Commit a96f8a0

Browse files
committed
elem != 6 also means Hydrogen, which is wrong. The paper gives a strict definition of hetreo atoms allows so let's use that.
1 parent b964090 commit a96f8a0

File tree

1 file changed

+19
-3
lines changed
  • descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular

1 file changed

+19
-3
lines changed

descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ALOGPDescriptor.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,23 @@ private double[] calculate(IAtomContainer atomContainer, String[] fragment, IRin
444444

445445
}
446446

447+
private static boolean isHetero(IAtom atom) {
448+
switch (atom.getAtomicNumber()) {
449+
case 7: // N
450+
case 8: // O
451+
case 9: // F
452+
case 15: // P
453+
case 16: // S
454+
case 17: // Cl
455+
case 34: // Se
456+
case 35: // Br
457+
case 53: // I
458+
return true;
459+
default:
460+
return false;
461+
}
462+
}
463+
447464
private void calcGroup001_005(int i) {
448465
// C in CH3R
449466
if (fragment[i].equals("SsCH3")) {
@@ -1016,9 +1033,8 @@ private int getHAtomType(IAtom ai, List connectedAtoms) {
10161033
IAtom aCarbon = ca.get(j);
10171034
for (IBond bond : aCarbon.bonds()) {
10181035
IAtom nbor = bond.getOther(aCarbon);
1019-
if (nbor.getAtomicNumber() != 6)
1020-
if (bond.isAromatic() || bond.getOrder() != IBond.Order.SINGLE)
1021-
return 51;
1036+
if (isHetero(nbor) && (bond.isAromatic() || bond.getOrder() != IBond.Order.SINGLE))
1037+
xInSecondShell = true;
10221038
}
10231039
} // end if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == IBond.Order.SINGLE) {
10241040
}// end j loop

0 commit comments

Comments
 (0)