## #463 zmatrixToCartesian()

cdk-1.0.x
closed
nobody
None
5
2015-01-01
2007-02-06
Glennie
No

When using the zmatrixToCartesian() method I do not get same result as I get when I manually enter the following values into the form on the "Z-matrix to Cartesian Coordinates Conversion Page"
(http://www.shodor.org/chemviz/zmatrices/babel.html)

c1
h2 1 1.20
o3 1 1.10 2 120.0
c4 1 1.50 2 120.0 3 180.0
h5 4 1.10 1 110.0 2 0.0
h6 4 1.10 1 110.0 2 120.0
h7 4 1.10 1 110.0 2 -120.0

gives the following result:

C 0.00000 0.00000 0.00000
H 1.20000 0.00000 0.00000
O -0.55000 0.95263 0.00000
C -0.75000 -1.29904 -0.00000
H -0.04293 -2.14169 -0.00000
H -1.38570 -1.36644 0.89518
H -1.38570 -1.36644 -0.89518

Using the zmatrixToCartesian() method,

int first_atoms[] = new int[7];
first_atoms[1] = 0;
first_atoms[2] = 0;
first_atoms[3] = 0;
first_atoms[4] = 3;
first_atoms[5] = 3;
first_atoms[6] = 3;
int second_atoms[] = new int[7];
second_atoms[2] = 1;
second_atoms[3] = 1;
second_atoms[4] = 0;
second_atoms[5] = 0;
second_atoms[6] = 0;
int third_atoms[] = new int[7];
third_atoms[3] = 2;
third_atoms[4] = 1;
third_atoms[5] = 1;
third_atoms[6] = 1;
double distance[] = new double[7];
distance[1] = 1.20;
distance[2] = 1.10;
distance[3] = 1.50;
distance[4] = 1.10;
distance[5] = 1.10;
distance[6] = 1.10;
double angles[] = new double[7];
angles[2] = 120.0;
angles[3] = 120.0;
angles[4] = 110.0;
angles[5] = 110.0;
angles[6] = 110.0;
double dihedrals[] = new double[7];
dihedrals[3] = 180.0;
dihedrals[4] = 0.0;
dihedrals[5] = 120.0;
dihedrals[6] = -120.0;

Point3d points[] = ZMatrixTools.zmatrixToCartesian(distance, first_atoms, angles, second_atoms, dihedrals, third_atoms);

I get the following result:

(0.0, 0.0, 0.0)
(1.2, 0.0, 0.0)
(1.7499999999999998, 0.9526279441628827, 0.0)
(-0.49999999999999983, -0.8660254037844388, 1.0605752387249068E-16)
(0.14278760968653975, -1.6320698469034167, 1.9987091139951795E-16)
(-1.0779089123375207, -0.9273003813139858, -0.8137976813493738)
(-1.0779089123375207, -0.9273003813139857, 0.8137976813493741)

which is clearly NOT the same. Am I doing something wrong? Or is this a bug?

Regards
Glennie

## Discussion

• Thomas Holder
2007-05-29

Logged In: YES
user_id=1306887
Originator: NO

fixed in svn

• status: open --> closed
• Group: --> cdk-1.0.x