I'm looking at one of the SmilesParserTest cases, specifically  
testSFBug956921().

The function looks like:

                String smiles = "[cH-]1cccc1";
                IMolecule mol = sp.parseSmiles(smiles);
                Assert.assertEquals(5, mol.getAtomCount());
                // each atom should have 1 implicit hydrogen, and two neighbors
        
However when I look at the result of the SMILES parsing I see that  
the first carbon has 1 implicit hydrogen (as returned by  
atom.getHydrogenCount()) but all others are null - indicating that  
they have not been set.

I'm using the code below:

import org.openscience.cdk.DefaultChemObjectBuilder;
import org.openscience.cdk.exception.InvalidSmilesException;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.smiles.SmilesParser;

public class junk {

     public static void main(String[] args) throws  
InvalidSmilesException {
         SmilesParser sp = new SmilesParser 
(DefaultChemObjectBuilder.getInstance());
         String smiles = "[cH-]1cccc1";
         IMolecule mol = sp.parseSmiles(smiles);
         System.out.println("mol.getAtomCount() = " + mol.getAtomCount 
());
         for (int i = 0; i < mol.getAtomCount(); i++) {
             Integer hc = mol.getAtom(i).getHydrogenCount();
             System.out.println("mol.getAtom(i).getHydrogenCount() =  
" +hc);
         }

     }
}

But, if in the above code I change the SMILES to c1ccccc1 and then  
rerun, all the atoms are reported to have 0 implicit hydrogens,  
whereas this should be  for each atom.

I have been looking at the SmilesParser code and see 2 places where  
implicit hydrogens are handled but can't really see what's going wrong.

If somebody could take a look or else point me in the right  
direction, it would be much appreciated since this seems to be a very  
fundamental error

-------------------------------------------------------------------
Rajarshi Guha  <[EMAIL PROTECTED]>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Chemistry professors never die, they just fail to react.



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to