Of the top of my head, I think you need to perform ring perception  
explicitly. In general, RingAtom is used by the SMARTS parser, which  
performs ring perception during initialization

On Mar 27, 2009, at 10:38 AM, P D wrote:

> 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

-------------------------------------------------------------------
Rajarshi Guha  <rg...@indiana.edu>
GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
-------------------------------------------------------------------
Q:  What's polite and works for the phone company?
A:  A deferential operator.



------------------------------------------------------------------------------
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to