## cdk-commits

 [Cdk-commits] SF.net SVN: cdk: [8341] trunk/cdk/src/org/openscience/cdk/geometry/ ZMatrixTools.java From: - 2007-05-29 14:11:46 ```Revision: 8341 http://svn.sourceforge.net/cdk/?rev=8341&view=rev Author: speleo3 Date: 2007-05-29 07:11:16 -0700 (Tue, 29 May 2007) Log Message: ----------- bugfix for #1653028 Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java Modified: trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java 2007-05-29 13:34:37 UTC (rev 8340) +++ trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java 2007-05-29 14:11:16 UTC (rev 8341) @@ -68,6 +68,8 @@ cartesianCoords[index] = new Point3d(-Math.cos((angles[2]/180)*Math.PI)*distances[2]+distances[1], Math.sin((angles[2]/180)*Math.PI)*distances[2], 0d); + if (first_atoms[index] == 0) + cartesianCoords[index].x = (cartesianCoords[index].x - distances[1]) * -1; } else { Vector3d cd = new Vector3d(); cd.sub(cartesianCoords[third_atoms[index]], cartesianCoords[second_atoms[index]]); @@ -84,10 +86,8 @@ Vector3d ba = rotate(bc,n2,-angles[index]); ba.normalize(); + ba.scale(distances[index]); - Vector3d ban = new Vector3d(ba); - ban.scale(distances[index]); - Point3d result = new Point3d(); result.add(cartesianCoords[first_atoms[index]], ba); cartesianCoords[index] = result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ```
 [Cdk-commits] SF.net SVN: cdk: [8518] trunk/cdk/src/org/openscience/cdk/geometry/ ZMatrixTools.java From: - 2007-07-06 10:53:44 ```Revision: 8518 http://svn.sourceforge.net/cdk/?rev=8518&view=rev Author: speleo3 Date: 2007-07-06 03:53:30 -0700 (Fri, 06 Jul 2007) Log Message: ----------- pending fix for z-coordinate sign. Besides the normalization of axes is dispensable Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java Modified: trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java 2007-07-06 10:20:14 UTC (rev 8517) +++ trunk/cdk/src/org/openscience/cdk/geometry/ZMatrixTools.java 2007-07-06 10:53:30 UTC (rev 8518) @@ -44,7 +44,7 @@ * Takes the given Z Matrix coordinates and converts them to cartesian coordinates. * The first Atom end up in the origin, the second on on the x axis, and the third * one in the XY plane. The rest is added by applying the Zmatrix distances, angles - * and dihedrals. + * and dihedrals. Angles are in degrees. * * @param distances Array of distance variables of the Z matrix * @param angles Array of angle variables of the Z matrix @@ -79,10 +79,8 @@ Vector3d n1 = new Vector3d(); n1.cross(cd, bc); - n1.normalize(); - Vector3d n2 = rotate(n1,bc,dihedrals[index]); - n2.normalize(); + Vector3d n2 = rotate(n1,bc,-dihedrals[index]); Vector3d ba = rotate(bc,n2,-angles[index]); ba.normalize(); @@ -98,7 +96,7 @@ private static Vector3d rotate(Vector3d vector, Vector3d axis, double angle) { Matrix3d rotate = new Matrix3d(); - rotate.set(new AxisAngle4d(axis.x, axis.y, axis.z, (angle/180)*Math.PI)); + rotate.set(new AxisAngle4d(axis, Math.toRadians(angle))); Vector3d result = new Vector3d(); rotate.transform(vector, result); return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ```