Hi, I'm using cdk 1.2 and I think I'm having a simple problem, tho I can't figure out how to fix it.
I'm reading in a test molfile containing cycloheptane (code below) and iterating through each atom trying to find which atoms are members of a ring (they all should be considered members of a ring). I've removed the try/catch blocks, but when this code is run I get a NPE when calling the "matches()" method of the RingAtom class. The NPE disappears if i remove the line "CDKHueckelAromaticityDetector.detectAromaticity(cphep);", but then the atoms are all mis-characterized as not being part of a ring. the specific error trace is this: java.lang.NullPointerException at org.openscience.cdk.isomorphism.matchers.smarts.RingAtom.matches(RingAtom.java:66) Strangely (at least to me), AliphaticAtom.matches() and AromaticAtom.matches() work properly, but not RingAtom. Any ideas as to what I'm doing wrong? TIA! //////////////////////// begin code ////////////////////////////////////// MolReader mr = new MolReader("C:\\cycloheptane.mol"); //MolReader is a home-built class MDMolecule cphep = mr.getMDMolecule(); //home-built method AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(cphep); CDKHueckelAromaticityDetector.detectAromaticity(cphep); Iterator a = cphep.atoms().iterator(); while (a.hasNext()) { IAtom qa = (IAtom) a.next(); int j = 7; RingAtom ra = new RingAtom(j); boolean b = ra.matches(qa); // <== ********NPE is thrown here *********** System.out.println(b); }
------------------------------------------------------------------------------
_______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user