CustomDescriptor.getTanimoto() fails

User e469f67125

03-10-2008 21:10:43

JChem version: 5_1_0

JDK 1.6.0_07 (Linux)


import java.util.*;

import chemaxon.descriptors.CDParameters;

import chemaxon.descriptors.CustomDescriptor;

public class z


  public static void main(String[] args) throws IOException


    int length=64;

    CustomDescriptor fpKQ = new CustomDescriptor(CDParameters.BINARY_DESCRIPTOR,length);

    CustomDescriptor fpK = new CustomDescriptor(CDParameters.BINARY_DESCRIPTOR,length);



    float   sim_tan = fpKQ.getTanimoto(fpK);

    System.err.println("\tTanimoto: "+String.format("%.2f",sim_tan));



    $ java z

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1

    at java.util.ArrayList.get(

    at chemaxon.descriptors.MDParameters.isAsymmetric(

    at chemaxon.descriptors.CustomDescriptor.getTanimoto(

    at z.main(

The purpose is simple binary fingerprints for implementing structural key based fingerprints.

ChemAxon 9c0afc9aaf

04-10-2008 02:09:29

I have moved this topic to the appropriate forum.


ChemAxon efa1591b5a

06-10-2008 07:03:46

Does you CDParameters constructor call the constructor of the superclass? It is supposed to do so.



User e469f67125

06-10-2008 14:41:38

Hi Miklos,

Observe from the complete source code provided that I am not using any CDParameters object, only the static field CDParameters.BINARY_DESCRIPTOR, as indicated by the documentation for constructor CustomDescriptor(int type, int length).


ChemAxon efa1591b5a

08-10-2008 12:57:00

Hi Jeremy,

I see now. Normally, our CustomDescriptor class should not be directly instantiated - though I admit that it is not stated in the documentation, we will correct that.

Instead, it serves as a super class for your descriptor by providing several convenience methods and a means of integration in Screen and JChemBase.

The exception you found is clear a bug, even if someone instantiates CustomDescriptor this exception should not be thrown. We will fix that.

You may wish to go through the related sample code:, that might be useful.