On Jan 27, 2010, at 5:58 AM, Vincent Le Guilloux wrote: > Quoting Rajarshi Guha <rajarshi.g...@gmail.com>: > > Yes indeed :). I had a quick look at the source code, and saw that > the problem arises in this loop: > > // look for symmetric & asymmetric atoms for the gamma descriptor > for (int i = 0; i < 3; i++) { > double ns = 0.0; > double na = 0.0; > for (int j = 0; j < ac.getAtomCount(); j++) { > boolean foundmatch = false; > for (int k = 0; k < ac.getAtomCount(); k++) { > if (k == j) continue; > if (scores[j][i] == -1 * scores[k][i]) { > ns++; > foundmatch = true; > break; > } > } > if (!foundmatch) na++; > } > double n = (double) ac.getAtomCount(); > gamma[i] = -1.0 * ((ns / n) * Math.log(ns / n) / Math.log(2.0) + > (na / n) * Math.log(1.0 / n) / Math.log(2.0)); > gamma[i] = 1.0 / (1.0 + gamma[i]); > } > > The problem is that the number of symmetric atom ns is always 0. As > a consequence, ns/n = 0 and Math.log(ns / n) = -Infinity, which > leads to the NaN value. > > I'm guessing that a default value is obviously needed when ns is 0, > which would fix this issue.
> However I think the algorithm is broken as ns should not always be 0 > as it is currently the case. I don't really know if the algorithm > used is theorically OK to detect symmetric atoms, That is true - but for pyrrole, the number of symmetric atoms should be > 0 and so ns should be > 0. So I think the bigger problem is that the actual determination of symmetric and asymmetric atoms is faulty > Also, just a last remark and I stop bothering you: why don't you > just send a warning or something like that, instead of an exception, > when 2D coordinates are detected? I think the policy, in general for any descriptor error, was to throw exceptions ---------------------------------------------------- Rajarshi Guha | NIH Chemical Genomics Center http://www.rguha.net | http://ncgc.nih.gov ---------------------------------------------------- I live in my own little world... but it's OK, they like me there ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user