Skip to content

Commit accdac3

Browse files
committed
Fix loop logic of RDFProtonDescriptors
1 parent 6efcedf commit accdac3

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_G3R.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,13 @@ && getIfBondIsNotRotatable(mol,
422422
IBond theInCycloexBond;
423423
limitInf = 0;
424424
limitSup = Math.PI;
425-
step = (limitSup - limitInf) / 13;
426425
position = 0;
427426
smooth = -2.86;
428427
angle = 0;
429428
int yaCounter = 0;
430429
List<IAtom> connAtoms;
431-
for (double g3r = 0; g3r < limitSup; g3r = g3r + step) {
430+
for (int c = 0; c < G3R_DESC_LENGTH; c++) {
431+
double g3r = limitSup * ((double)c / G3R_DESC_LENGTH);
432432
sum = 0;
433433
for (Integer aBondsInCycloex : bondsInCycloex) {
434434
yaCounter = 0;

descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GDR.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,14 @@ && getIfBondIsNotRotatable(mol,
404404
IAtom goodAtom1;
405405
limitInf = 0;
406406
limitSup = Math.PI / 2;
407-
step = (limitSup - limitInf) / 7;
408407
position = 0;
409408
partial = 0;
410409
IBond theDoubleBond;
411410
smooth = -1.15;
412411
int goodPosition = 0;
413412
IBond goodBond;
414-
for (double ghd = limitInf; ghd < limitSup; ghd = ghd + step) {
413+
for (int c = 0; c < gdr_desc_length; c++) {
414+
double ghd = limitInf + (limitSup - limitInf) * ((double)c / gdr_desc_length);
415415
sum = 0;
416416
for (int dou = 0; dou < doubles.size(); dou++) {
417417
partial = 0;

descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHR.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,12 @@ && getIfBondIsNotRotatable(mol,
392392
int position;
393393
double limitInf = 1.4;
394394
double limitSup = 4;
395-
double step = (limitSup - limitInf) / 15;
396395
IAtom atom2;
397396

398397
///////////////////////THE FIRST CALCULATED DESCRIPTOR IS g(H)r WITH PARTIAL CHARGES:
399398
if (atoms.size() > 0) {
400-
for (double ghr = limitInf; ghr < limitSup; ghr = ghr + step) {
399+
for (int c = 0; c < ghr_desc_length; c++) {
400+
double ghr = limitInf + (limitSup - limitInf) * ((double)c / ghr_desc_length);
401401
sum = 0;
402402
for (Object atom1 : atoms) {
403403
distance = 0;

descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GHR_topol.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,12 @@ && getIfBondIsNotRotatable(mol,
401401
Integer thisAtom;
402402
limitInf = 1.4;
403403
limitSup = 4;
404-
step = (limitSup - limitInf) / 15;
405404

406405
if (atoms.size() > 0) {
407406
//ArrayList gHr_topol_function = new ArrayList(15);
408407
ShortestPaths shortestPaths = new ShortestPaths(mol, startVertex);
409-
for (double ghrt = limitInf; ghrt < limitSup; ghrt = ghrt + step) {
408+
for (int c = 0; c < ghr_topol_desc_length; c++) {
409+
double ghrt = limitInf + (limitSup - limitInf) * ((double)c / ghr_topol_desc_length);
410410
sum = 0;
411411
for (int at = 0; at < atoms.size(); at++) {
412412
distance = 0;

descriptor/qsaratomic/src/main/java/org/openscience/cdk/qsar/descriptors/atomic/RDFProtonDescriptor_GSR.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ && getIfBondIsNotRotatable(mol,
404404
IBond theSingleBond = null;
405405
limitInf = 0;
406406
limitSup = Math.PI / 2;
407-
step = (limitSup - limitInf) / 7;
408407
smooth = -1.15;
409-
for (double ghs = 0; ghs < limitSup; ghs = ghs + step) {
408+
for (int c = 0; c < gsr_desc_length; c++) {
409+
double ghs = limitSup * ((double)c / gsr_desc_length);
410410
sum = 0;
411411
for (int sing = 0; sing < singles.size(); sing++) {
412412
angle = 0;

0 commit comments

Comments
 (0)