Menu

#1360 LengthOverBreadthDescriptor yields only NaNs

cdk-1.6.x
closed
nobody
None
1
2015-02-22
2015-02-19
No

Hi,

The LengthOverBreadthDescriptor returns only NaNs, even with 3D input data.

ISimpleChemObjectReader reader = new ReaderFactory().createReader(new FileReader(
                "/tmp/30_random_cpdbas_compounds.ob3d.sdf"));
        IChemFile content = (IChemFile) reader.read((IChemObject) new ChemFile());
        for (IAtomContainer mol : ChemFileManipulator.getAllAtomContainers(content))
        {
            IMolecularDescriptor desc = new LengthOverBreadthDescriptor();
            System.out.println(desc.calculate(mol).getValue());
        }
        reader.close();
1 Attachments

Discussion

  • John May

    John May - 2015-02-22
    • status: open --> closed
     
  • John May

    John May - 2015-02-22

    You need make sure the mass is set for the centre of mass calc.

    Isotopes.getInstance().configureAtoms(mol);
    

    The error was written to the exception:

    System.out.println(desc.calculate(mol).getException());
    

    You also need to tell the MDL reader to load as 3D. I don't know how it's done on the reader factory.

    IChemObjectBuilder bldr = SilentChemObjectBuilder.getInstance();
    MDLV2000Reader     rdr  = new MDLV2000Reader(new FileReader("../30_random_cpdbas_compounds.ob3d.sdf"));
    
    // config reader
    Properties prop = new Properties();
    prop.setProperty("ForceReadAs3DCoordinates", "true");
    PropertiesListener listener = new PropertiesListener(prop);
    rdr.addChemObjectIOListener(listener);
    rdr.customizeJob();
    
    IMolecularDescriptor desc = new LengthOverBreadthDescriptor(); // outside of loop
    
    // mem efficient iter
    IAtomContainer mol;
    while ((mol = rdr.read(bldr.newInstance(IAtomContainer.class,0,0,0,0))) != null)
    {
        Isotopes.getInstance().configureAtoms(mol);
        System.out.println(desc.calculate(mol).getValue());
    }
    reader.close();
    
     

    Last edit: John May 2015-02-22