diff --git a/src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java b/src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java index 0961a8d3aaa..1fcba35f0eb 100644 --- a/src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java +++ b/src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java @@ -563,6 +563,11 @@ private IAtomType perceiveNitrogens(IAtomContainer atomContainer, IAtom atom) th } // but an sp2 hyb N might N.sp2 or N.planar3 (pyrrole), so check for the latter int neighborCount = atomContainer.getConnectedAtomsCount(atom); + if (neighborCount == 4 && + IBond.Order.DOUBLE == atomContainer.getMaximumBondOrder(atom)) { + IAtomType type = getAtomType("N.oxide"); + if (isAcceptable(atom, atomContainer, type)) return type; + } else if (neighborCount > 1 && bothNeighborsAreSp2(atom, atomContainer)) { IRing ring = getRing(atom, atomContainer); int ringSize = ring == null ? 0 : ring.getAtomCount(); @@ -655,7 +660,11 @@ private IAtomType perceiveNitrogens(IAtomContainer atomContainer, IAtom atom) th } } } else if (atomContainer.getConnectedBondsCount(atom) > 3) { - // FIXME: I don't perceive carbons with more than 3 connections yet + if (atomContainer.getConnectedBondsCount(atom) == 4 && + countAttachedDoubleBonds(atomContainer, atom) == 1) { + IAtomType type = getAtomType("N.oxide"); + if (isAcceptable(atom, atomContainer, type)) return type; + } return null; } else if (atomContainer.getConnectedBondsCount(atom) == 0) { IAtomType type = getAtomType("N.sp3"); diff --git a/src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl b/src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl index 934945120a2..8405de86604 100644 --- a/src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl +++ b/src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl @@ -487,6 +487,15 @@ + + 0 + + 4 + 0 + 1 + + + 0 diff --git a/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java b/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java index 1920972633a..21e2d7ae39d 100644 --- a/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java +++ b/src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java @@ -642,6 +642,28 @@ public void testTetrahydropyran() throws Exception { assertAtomTypes(testedAtomTypes, expectedTypes, mol); } + + @Test public void testAmineOxide() throws Exception { + IMolecule mol = new Molecule(); + IAtom atom = new Atom("O"); + IAtom atom2 = new Atom("N"); + IAtom atom3 = new Atom("C"); + IAtom atom4 = new Atom("C"); + IAtom atom5 = new Atom("C"); + mol.addAtom(atom); + mol.addAtom(atom2); + mol.addAtom(atom3); + mol.addAtom(atom4); + mol.addAtom(atom5); + mol.addBond(0,1,CDKConstants.BONDORDER_DOUBLE); + mol.addBond(1,2,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,3,CDKConstants.BONDORDER_SINGLE); + mol.addBond(1,4,CDKConstants.BONDORDER_SINGLE); + + String[] expectedTypes = {"O.sp2", "N.oxide", "C.sp3", "C.sp3", "C.sp3"}; + assertAtomTypes(testedAtomTypes, expectedTypes, mol); + } + @Test public void testThioAmide() throws Exception { IMolecule mol = new Molecule(); IAtom atom = new Atom("S");