# How to modify Gaussian Z-matrix to adjust distances between monomers

I am trying to make a script to adapt and modify the distances between two monomers I do have. I have build a xyz structure and use Openbabel to construct the Z-matrix of the system. However, I am not sure if there is a simple way of modifying it to adapt the distances of the monomers. For example, for two water molecules, which zmatrix is given by:

0 1
O1
H2 1 r1
H3 1 r2 2 a1
O5 2 r3 4 a2 1 180.
H6 5 r4 2 a3 4 d1
H7 5 r4 2 a3 4 -d1
Variables
r1 = 1.0
r2 = 1.0
r3 = 1.8
r4 = 1.0
a1 = 104.52
a2 = 90.
a3 = 120.
d1 = 80.


How would you proceed if you want to keep varying the distances using a small "distance step" to compute properties of the system? For example, between atom 2 and 5.

• My recommendation is to use a script language (or Bash) and generate the Z matrix file from it. In the script you can do the calculations for the distances and angles you are interested in.
– Camps
Jun 15, 2022 at 17:15

## 1 Answer

The general problem with auto-generated z-matrices (e.g., this one) is that they may not define distances the way you want.

In this case, it seems as if you just need to change r3.

Gaussian, like many programs, has built-in support for energy scans.

r3 1.8 10 0.1

This would take 10 steps, each 0.1 in size. This has the advantage of starting each step with a good initial guess for SCF from the previous geometry.

More generally, even as an Open Babel developer, I agree with the comment by @Camps. Pick your favorite script language (e.g., Python) and you can move distances and angles as you wish.

Pseudo-code:

# write xyz coordinates of one monomer
for step in range(10):
for atom in monomer1:
new_xyz = atom.xyz + [ step * 0.1, 0.0, 0.0 ]
# write out atom at new_xyz