You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In org.openscience.cdk.geometry.AtomTool the method add3DCoordinates1(IAtomContainer atomContainer) is used to add coordinates for single bonded atoms without coordinates (like hydrogens). The method specify the atoms without coordinates that are attached to a single reference atom with nwanted variable. However, if the reference atom is heteroatom like O,N, S, etc. the method assign nwanted = 3 even if we need coordinates for just one hydrogen.
if (elementType.equals("N") || elementType.equals("O") || elementType.equals("S")) {
nwanted = 3;
}
I don't know the purpose of this line but the code get but the code reaches the method calculate3DCoordinates2(Point3d aPoint, Point3d bPoint, Point3d cPoint, int nwanted, double length, double angle) it gets broken as this method will calculate the position of the third attached hydrogen based on the coordinates of two attached atoms to the reference atom. The method expected nwanted to be 1 or 2 as it already knows that there is already two attached atoms with coordinates. This makes the total 3 or 4 attached atoms to the central reference atom (two known coordinates atoms and one or two attached hydrogens).
However, if the central atom is a heteroatom the nwanted=3. Therefore, calculate3DCoordinates2 return empty coordinates array Point3d[] newPoints = new Point3d[0]; as there is no case for nwanted = 3.
This behavior ends with ArrayIndexOutOfBoundsException as a result of the empty coordinates array.
In
org.openscience.cdk.geometry.AtomTool
the methodadd3DCoordinates1(IAtomContainer atomContainer)
is used to add coordinates for single bonded atoms without coordinates (like hydrogens). The method specify the atoms without coordinates that are attached to a single reference atom with nwanted variable. However, if the reference atom is heteroatom like O,N, S, etc. the method assign nwanted = 3 even if we need coordinates for just one hydrogen.cdk/misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java
Lines 94 to 96 in c8849c9
I don't know the purpose of this line but the code get but the code reaches the method
calculate3DCoordinates2(Point3d aPoint, Point3d bPoint, Point3d cPoint, int nwanted, double length, double angle)
it gets broken as this method will calculate the position of the third attached hydrogen based on the coordinates of two attached atoms to the reference atom. The method expected nwanted to be 1 or 2 as it already knows that there is already two attached atoms with coordinates. This makes the total 3 or 4 attached atoms to the central reference atom (two known coordinates atoms and one or two attached hydrogens).cdk/misc/extra/src/main/java/org/openscience/cdk/geometry/AtomTools.java
Lines 361 to 398 in c8849c9
However, if the central atom is a heteroatom the nwanted=3. Therefore,
calculate3DCoordinates2
return empty coordinates arrayPoint3d[] newPoints = new Point3d[0];
as there is no case for nwanted = 3.This behavior ends with ArrayIndexOutOfBoundsException as a result of the empty coordinates array.
The text was updated successfully, but these errors were encountered: