Skip to content

Commit

Permalink
Added the N.oxide atom type, for structures like (CH3)N=O
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Jul 22, 2010
1 parent 3133a18 commit bb431e3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/org/openscience/cdk/atomtype/CDKAtomTypeMatcher.java
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
Expand Down
9 changes: 9 additions & 0 deletions src/main/org/openscience/cdk/dict/data/cdk-atom-types.owl
Expand Up @@ -487,6 +487,15 @@
<at:hybridization rdf:resource="&at;sp2"/>
</at:AtomType>

<at:AtomType rdf:ID="N.oxide">
<at:formalCharge>0</at:formalCharge>
<at:hasElement rdf:resource="&elem;N"/>
<at:formalNeighbourCount>4</at:formalNeighbourCount>
<at:lonePairCount>0</at:lonePairCount>
<at:piBondCount>1</at:piBondCount>
<at:hybridization rdf:resource="&at;sp2"/>
</at:AtomType>

<at:AtomType rdf:ID="N.thioamide">
<at:broader rdf:resource="&cdkat;N.sp2"/>
<at:formalCharge>0</at:formalCharge>
Expand Down
22 changes: 22 additions & 0 deletions src/test/org/openscience/cdk/atomtype/CDKAtomTypeMatcherTest.java
Expand Up @@ -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");
Expand Down

0 comments on commit bb431e3

Please sign in to comment.