Chemistry - How to convert an XYZ file to Z-matrix?

Solution 1:

According to the manual of the newzmat utility of Gaussian 16, it accepts unadorned Cartesian coordinates (G16 online manual). The format you have posted is actually (simple) xmol. This means the first line denotes the number of atoms, the second line denotes a comment, and both need to be skipped.

Therefore your file should look like this:

C    0.539202   -0.539202    1.933833
C   -0.539202    0.539202    1.933833
H    1.536064   -0.098299    1.932264
H    0.459532   -1.174264    2.816008
H    0.456405   -1.179449    1.055941
H   -1.536064    0.098299    1.932264
H   -0.459532    1.174264    2.816008
H   -0.456405    1.179449    1.055941
C    0.539202    0.539202   -1.933833
C   -0.539202   -0.539202   -1.933833
H    1.179449    0.456405   -1.055941
H    1.174264    0.459532   -2.816008
H    0.098299    1.536064   -1.932264
H   -1.174264   -0.459532   -2.816008
H   -0.098299   -1.536064   -1.932264
H   -1.179449   -0.456405   -1.055941

In Gaussian terms, a block of cartesian coordinates is also a z-matrix. Therefore you also need to tell Gaussian to rebuild it (-rebuildzmat). This will likely fail on your input with an error:

Input z-matrix variables are not compatible with final structure.

If you allow rounding (-round) it will work. The complete command is:

newzmat -ixyz -ozmat -round -rebuildzmat <input.xyz> <output.com>

The following file is produced (it is a valid Gaussian input file):

# HF/6-31G* Test

-- No Title Specified --

 0,1
 C
 C,1,R2
 H,1,R3,2,A3
 H,1,R4,2,A4,3,D4,0
 H,1,R5,2,A5,3,D5,0
 H,2,R6,1,A6,3,D6,0
 H,2,R7,1,A7,6,D7,0
 H,2,R8,1,A8,6,D8,0
 C,3,R9,1,A9,2,D9,0
 C,9,R10,3,A10,1,D10,0
 H,9,R11,3,A11,10,D11,0
 H,9,R12,3,A12,10,D12,0
 H,9,R13,3,A13,10,D13,0
 H,10,R14,9,A14,3,D14,0
 H,10,R15,9,A15,14,D15,0
 H,10,R16,9,A16,14,D16,0
      Variables:
 R2=1.53
 R3=1.09
 R4=1.09
 R5=1.09
 R6=1.09
 R7=1.09
 R8=1.09
 R9=4.04
 R10=1.53
 R11=1.09
 R12=1.09
 R13=1.09
 R14=1.09
 R15=1.09
 R16=1.09
 A3=111.
 A4=111.
 A5=111.
 A6=111.
 A7=111.
 A8=111.
 A9=81.
 A10=94.
 A11=22.
 A12=128.
 A13=104.
 A14=111.
 A15=111.
 A16=111.
 D4=120.
 D5=-120.
 D6=180.
 D7=120.
 D8=-120.
 D9=-76.
 D10=-21.
 D11=-144.
 D12=-120.
 D13=113.
 D14=167.
 D15=120.
 D16=-120.

 1 2 1.000 3 1.000 4 1.000 5 1.000
 2 1 1.000 6 1.000 7 1.000 8 1.000
 3 1 1.000
 4 1 1.000
 5 1 1.000
 6 2 1.000
 7 2 1.000
 8 2 1.000
 9 10 1.000 11 1.000 12 1.000 13 1.000
 10 9 1.000 14 1.000 15 1.000 16 1.000
 11 9 1.000
 12 9 1.000
 13 9 1.000
 14 10 1.000
 15 10 1.000
 16 10 1.000
 

Whether or not this z-matrix does actually fits the purpose you are needing it for, is a different question. For the most tasks, where z-matrices are the superior input, I recommend building it by hand.

Solution 2:

Here is a ZMAT for your XYZ coordinates:

16
C   1
C   1 1.525
H   1 1.090  2 111.141
H   1 1.090  2 111.120  3 119.9
H   1 1.090  2 111.206  3 239.9
H   2 1.090  1 111.141  3 179.8
H   2 1.090  1 111.120  3 299.7
H   2 1.090  1 111.206  3  59.7
C   8 3.216  2 130.964  1  32.0
C   9 1.525  8  85.518  2  56.3
H   9 1.090  8  56.495  2 297.1
H   9 1.090  8 161.358  2 262.3
H   9 1.090  8  72.021  2 170.2
H  10 1.090  9 111.120  8 129.0
H  10 1.090  9 111.141  8 248.9
H  10 1.090  9 111.206  8   9.1

I copied and pasted your XYZ into this: https://www.webqc.org/molecularformatsconverter.php

Tags:

Software