MolSearch

User b22f714996

08-04-2005 07:56:48

Hello...





I have a question regarding the following code snippet





Code:
   


    MolSearch ms = new MolSearch();


    MolHandler mh = new MolHandler("CC(C)NN");


    mh.aromatize();


    ms.setTarget(mh.getMolecule());


    mh.setQueryMode(true);


    mh.setMolecule("N-N");


    ms.setQuery(mh.getMolecule());


    int[][] hits1 = ms.findAll();


    if (hits1 != null) {


      System.out.println("Number of hits1: " + hits1.length);


    }


    else {


      System.out.println("Number of hits1: 0");


    }





    mh.setMolecule("CN(C)N=C");


    mh.aromatize();


    ms.setQuery(mh.getMolecule());


    int[][] hits2 = ms.findAll();


    if (hits2 != null) {


      System.out.println("Number of hits2: " + hits2.length);


    }


    else {


      System.out.println("Number of hits2: 0");


    }





    mh.setMolecule("CN(C)[N;H2]");


    mh.aromatize();


    ms.setQuery(mh.getMolecule());


    int[][] hits3 = ms.findAll();


    if (hits3 != null) {


      System.out.println("Number of hits3: " + hits3.length);


    }


    else {


      System.out.println("Number of hits3: 0");


    }








I get the following output:





Number of hits1: 1


Number of hits2: 1


Number of hits3: 0






I am pretty sure, that it is a very simple and silly mistake I'm making here and I'm sorry to bother you with that... but I am very thankful for help,





Thanks a lot,





tobias

ChemAxon a3d59b832c

08-04-2005 12:45:04

Dear Tobias,





I have to admit this is a bug in the initialization of MolSearch.findAll().


I am working on it and it will be fixed in the next release.





In the meantime I suggest to create a new MolSearch object for each


search.





Thank you for drawing our attention to this issue and sorry for the inconvenience.





All the best,


Szabolcs

User b22f714996

08-04-2005 12:57:25

Dear Szabolcs,





Thanks a lot for the very fast reply. Now I know at least that I can not avoid using a new MolSearch object for each query.





Thanks a lot,





tobias

ChemAxon a3d59b832c

26-04-2005 08:41:29

Hi Tobias,





JChem 3.0.11 is out and contains the fix. Now you can use the same MolSearch object.





You can download JChem 3.0.11 from:





http://www.jchem.com/licensefrset.html





All the best,


Szabolcs