# Geometry optimizations and semiempirical Hamiltonians¶

Objectives

• Learn how to run geometry optimization using the semiempirical xTB method.

Keypoints

• Run a geometry optimization calculation.

• Visualize the change of geometry during optimization.

• (Optional) Try geometry optimization using a different coordinate system

## Introduction¶

In this exercise we will use the semiempirical extended tight-binding (xTB) method [BCE+21], combined with the geomeTRIC optimization code [WS16], to optimize the geometry of the zinc tetraphenylporphyrin dimer.

Geometry optimization is the procedure to find local minimum on the potential energy surface. A coordinate system is therefore necessary for describing the geometry of the system of interest. The Cartesian coordinate system is the simplest; however, it is very inefficient due to the complexity of the potential energy surface. In practice, it is common to employ the so-called internal coordinates that describes the collective motion of atoms in a more efficient way. A displacement in the internal coordinate $$\Delta \mathbf{q}$$ is related to the displacement in Cartesian coordinates $$\Delta \mathbf{x}$$:

$\Delta \mathbf{x} = \mathbf{B}^T \mathbf{G}^{-1} \Delta \mathbf{q}$

Here $$\mathbf{B}$$ is the Wilson B-matrix, with elements:

$B_{ij} = \frac{\partial q_i}{\partial x_j}$

and $$\mathbf{G} = \mathbf{B} \mathbf{B}^T$$.

In the geomeTRIC optimization code, the translation-rotation internal coordinate (TRIC) system is employed. This coordinate system treats intra- and intermolecular coordinates separately by introducing translation and rotation coordinates for the individual molecules in the system.

Efficient geometry optimizations demand good prediction of the next step in the conformation space. This can be done based on a quadratic approximation for the local shape of the potential energy, where an apprximate evaluation of the Hessian can be provided by, for example, the Broyden-Fletcher-Goldfarb-Shanno (BFGS) method.

The gradient, or the first derivative of the energy with respect to nuclear displacements, is provided by the semiempirical xTB method, which is an efficient tight-binding model that covers almost the entire periodic table ($$Z \le 86$$).

## Input file¶

Below is the input file for the geometry optimization of the zinc tetraphenylporphyrin dimer. You can read more about the VeloxChem input keywords in this page.

@jobs
@end

@method settings
xtb: gfn2
@end

@optimize
coordsys: tric
@end

@molecule
charge: 0
multiplicity: 1
xyz:
C         61.02000       57.63000       26.81000
C         60.13000       58.56000       27.35000
H         59.66000       59.27000       26.67000
C         60.00000       58.63000       28.74000
H         59.41000       59.43000       29.18000
C         61.69000       56.68000       27.61000
H         62.19000       55.82000       27.18000
C         61.51000       56.81000       28.98000
H         62.08000       56.16000       29.64000
C         60.59000       57.69000       29.57000
C         60.37000       57.79000       31.03000
C         59.85000       56.56000       31.60000
N         59.49000       56.52000       32.87000
C         59.10000       55.22000       33.10000
C         59.19000       54.43000       31.92000
C         59.70000       55.29000       30.97000
H         59.80000       55.11000       29.91000
H         58.72000       53.46000       31.74000
C         60.82000       58.94000       31.61000
N         60.45000       59.24000       32.89000
C         61.63000       59.93000       30.98000
H         62.03000       60.07000       29.98000
C         61.65000       60.89000       31.97000
H         62.09000       61.87000       31.81000
C         60.90000       60.46000       33.11000
C         60.57000       61.25000       34.28000
C         61.20000       62.59000       34.20000
C         62.50000       62.80000       34.66000
C         63.08000       64.07000       34.69000
C         62.43000       65.19000       34.15000
C         61.08000       64.95000       33.88000
C         60.42000       63.73000       33.94000
H         59.35000       63.68000       33.83000
H         60.46000       65.84000       33.79000
H         64.12000       64.24000       34.93000
H         63.10000       61.94000       34.94000
C         60.13000       60.69000       35.45000
N         59.62000       59.44000       35.68000
C         60.02000       61.48000       36.63000
H         60.32000       62.52000       36.71000
C         59.45000       60.64000       37.54000
H         59.14000       60.85000       38.55000
C         59.07000       59.44000       36.87000
C         58.27000       58.37000       37.47000
C         57.95000       58.61000       38.88000
C         56.62000       58.49000       39.31000
H         55.76000       58.37000       38.65000
C         56.29000       58.46000       40.67000
H         55.24000       58.39000       40.91000
C         57.32000       58.67000       41.60000
C         58.65000       58.67000       41.17000
H         59.41000       58.80000       41.93000
C         58.98000       58.61000       39.82000
H         60.03000       58.43000       39.59000
C         58.14000       57.18000       36.80000
N         58.54000       56.82000       35.54000
C         57.52000       56.11000       37.50000
H         57.13000       56.21000       38.50000
C         57.64000       55.06000       36.64000
H         57.25000       54.07000       36.85000
C         58.31000       55.52000       35.46000
C         58.48000       54.77000       34.23000
C         57.72000       53.51000       34.33000
C         58.36000       52.27000       34.33000
H         59.43000       52.22000       34.14000
C         57.69000       51.08000       34.62000
H         58.24000       50.15000       34.70000
C         56.30000       51.10000       34.76000
C         55.62000       52.30000       34.59000
H         54.54000       52.23000       34.46000
C         56.32000       53.50000       34.49000
H         55.79000       54.43000       34.42000
Zn        59.32000       58.09000       34.16000
C         61.11500       57.37900       25.29400
H         62.11800       57.10600       25.04000
H         60.45000       56.58600       25.02100
H         60.84400       58.27000       24.76700
C         63.05900       66.57900       33.93200
H         62.86400       67.19700       34.78300
H         64.11600       66.47500       33.80100
H         62.63400       67.02900       33.05900
C         56.98100       58.53100       43.09600
H         55.98500       58.88200       43.27000
H         57.05200       57.50300       43.38300
H         57.67000       59.11100       43.67300
C         55.51800       49.77900       34.88200
H         55.35500       49.37000       33.90600
H         56.08000       49.08400       35.47000
H         54.57500       49.96500       35.35300
C         51.90685       54.01054       27.22931
C         51.08826       55.04635       26.75625
H         50.63137       54.97974       25.75855
C         50.85509       56.17646       27.52709
H         50.16044       56.95120       27.21364
C         52.43436       54.16073       28.50813
H         53.07729       53.35934       28.89585
C         52.24520       55.31614       29.27427
H         52.83384       55.39049       30.18606
C         51.41554       56.33346       28.78956
C         51.33770       57.58639       29.56986
C         50.29095       57.44320       30.56834
N         50.23192       58.24238       31.61367
C         49.14509       57.72138       32.28848
C         48.58769       56.53405       31.74108
C         49.29854       56.42902       30.57993
H         49.18752       55.65041       29.81806
H         47.80098       55.86766       32.10413
C         52.22597       58.63368       29.52727
N         52.15765       59.80755       30.22661
C         53.34680       58.65385       28.64531
H         53.60257       57.91295       27.90461
C         53.96035       59.87727       28.80717
H         54.82908       60.22741       28.27602
C         53.18605       60.51770       29.83074
C         53.53974       61.80807       30.40792
C         54.25378       62.66374       29.42664
C         55.60300       62.95809       29.54126
C         56.27367       63.68836       28.54271
C         55.59029       64.02614       27.36676
C         54.29840       63.54640       27.17441
C         53.59645       62.93900       28.22217
H         52.56662       62.63989       28.05223
H         53.78787       63.75629       26.22642
H         57.27868       64.08228       28.67150
H         56.12443       62.72773       30.45988
C         53.25154       62.17278       31.69125
N         52.19464       61.71645       32.44105
C         54.06370       63.13581       32.35307
H         54.99243       63.65131       32.10343
C         53.38562       63.20580       33.54735
H         53.76259       63.81070       34.37553
C         52.20650       62.41438       33.56272
C         51.16392       62.22037       34.56067
C         51.08203       63.30535       35.56874
C         49.90980       64.05988       35.71530
H         49.04323       63.93837       35.07375
C         49.77985       64.95739       36.77483
H         48.86230       65.46814       37.01529
C         50.81683       65.14126       37.68799
C         52.02339       64.45505       37.48616
H         52.74371       64.51766       38.29154
C         52.12549       63.46800       36.49229
H         53.02731       62.87378       36.39942
C         50.27029       61.20423       34.59321
N         50.09230       60.17540       33.70843
C         49.45803       60.96836       35.75671
H         49.36640       61.59538       36.63413
C         48.66956       59.90166       35.41752
H         47.86239       59.57121       36.05649
C         49.07159       59.46371       34.12524
C         48.63160       58.26794       33.41959
C         47.55852       57.63075       34.21443
C         47.74741       56.42903       34.89642
H         48.75643       55.99974       34.92928
C         46.71433       55.65391       35.45153
H         46.96803       54.70387       35.90402
C         45.40565       56.08167       35.28487
C         45.17826       57.26877       34.56816
H         44.20226       57.71751       34.43869
C         46.22569       58.06008       34.08539
H         46.05336       59.04010       33.66259
Zn        51.32929       59.90367       32.08904
C         52.27990       52.78969       26.36754
H         53.30327       52.86701       26.06458
H         52.14439       51.89471       26.93907
H         51.65292       52.75858       25.50165
C         56.35220       64.88676       26.34155
H         56.62834       65.81747       26.79255
H         57.23252       64.36862       26.02540
H         55.72443       65.07263       25.49586
C         50.67441       66.04556       38.92639
H         50.65214       65.44182       39.80888
H         51.50547       66.71789       38.97389
H         49.76618       66.60651       38.85488
C         44.20161       55.21778       35.70364
H         43.49410       55.82310       36.23077
H         43.73866       54.80444       34.83142
H         44.53612       54.42480       36.33918
@end


## Results¶

• Submit a job

Runs the above example on 1 node. On Beskow this will take around 10 minutes so please make sure that you specify a proper walltime limit in the job script.

• Visualize the result

The change of energy during optimization is printed at the end of the output file.

We can visualize the process of the optimization in a Jupyter notebook on MyBinder.

• (Optional) Rerun the optimization using another coordinate system

You can find the input keyword for other coordinate systems in this page.