On Dec 7, 2007, at 10:40 AM, Gianfranco wrote:

> Thanks for you reply.
>
> I sooved my problem but I got another:
>
>        IMolecularDescriptor descriptor = new  
> AromaticBondsCountDescriptor();
>        Object[] params = {true};
>        descriptor.setParameters(params);
>        SmilesParser sp = new SmilesParser 
> (DefaultChemObjectBuilder.getInstance());
>        IAtomContainer mol = sp.parseSmiles("c1ccccc1"); // ethanol
>              HydrogenAdder hd = new HydrogenAdder();
>        hd.addExplicitHydrogensToSatisfyValency(mol);
>              System.out.println(mol.getAtomCount());
>        assertEquals(6, ((IntegerResult) descriptor.calculate 
> (mol).getValue()).intValue());
> it prints 18  total atoms instead of 12 (6C + 6H).

It's a good idea to use the current code from SVN since hydrogen  
addition and aromaticity detection has been very much improved.

The following code (based on the nightly build) works correctly:

    IMolecularDescriptor descriptor = new AromaticBondsCountDescriptor 
();
    Object[] params = {true};
    descriptor.setParameters(params);

    SmilesParser sp = new SmilesParser 
(DefaultChemObjectBuilder.getInstance());
    IAtomContainer mol = sp.parseSmiles("c1ccccc1"); // ethanol

    CDKHueckelAromaticityDetector.detectAromaticity(mol);
    CDKHydrogenAdder hd = CDKHydrogenAdder.getInstance 
(DefaultChemObjectBuilder.getInstance());
    hd.addImplicitHydrogens(mol);
    AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);

    System.out.println(mol.getAtomCount());

-------------------------------------------------------------------
Rajarshi Guha  <[EMAIL PROTECTED]>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
All the passions make us commit faults; love makes us commit the most
ridiculous ones.
        -- La Rochefoucauld



-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to