Link Search Menu Expand Document

Geometry Optimizations

One of the primary applications of xtb is geometry optimization. It is useful for screening applications as well as optimizing structures that are too large for DFT methods.
A geometry optimization can be performed using:

xtb struc.xyz --opt

The result will be an xtbopt.xyz file containing the optimized structure, along with an xtbopt.log file that records the optimization trajectory.

Exercise

As a simple example, optimize the antibiotic Erythromycin using GFN2-xTB both in the gas phase and in water. Then, compare the structures using, for example, chimera opt1.xyz opt2.xyz.

118

O            4.26440000000000       -1.56990000000000       -0.34490000000000
O            7.92700000000000       -0.12250000000000       -0.44840000000000
O            3.41730000000000        1.16910000000000       -0.99000000000000
O            2.39730000000000       -1.82520000000000        1.26840000000000
O           10.17090000000000       -0.48350000000000       -0.85500000000000
O            8.91880000000000        2.80460000000000        1.82790000000000
O            9.13500000000000       -3.71470000000000       -2.16640000000000
O            3.93160000000000       -4.59830000000000        0.03320000000000
O           11.85340000000000       -3.23740000000000       -2.24930000000000
O            7.98990000000000        6.36350000000000        1.26170000000000
O            5.96920000000000        4.46580000000000        0.49810000000000
O            4.97420000000000        5.36910000000000       -2.26340000000000
O           10.44260000000000        1.05070000000000        1.28770000000000
N            3.49140000000000       -5.27430000000000        2.89890000000000
C            5.09750000000000       -0.46240000000000       -0.59680000000000
C            5.86600000000000       -0.26170000000000        0.76850000000000
C            4.46530000000000        0.51430000000000       -1.56810000000000
C            7.28390000000000        0.30700000000000        0.74170000000000
C            5.42450000000000        1.66830000000000       -2.01690000000000
C            8.14030000000000        0.50530000000000        1.89920000000000
C            4.99270000000000        2.94860000000000       -2.70450000000000
C            3.32880000000000       -2.35700000000000        0.36040000000000
C            8.88690000000000       -0.33030000000000       -1.42210000000000
C            9.51740000000000       -2.50330000000000       -2.82370000000000
C            5.00600000000000        0.52240000000000        1.60190000000000
C            4.00010000000000       -3.59160000000000        0.93400000000000
C            8.55390000000000       -1.39220000000000       -2.44040000000000
C            3.47280000000000       -3.97810000000000        2.32720000000000
C            3.91240000000000       -0.07140000000000       -2.88880000000000
C           10.92160000000000       -2.24480000000000       -2.26560000000000
C            7.07640000000000        4.22890000000000       -1.61590000000000
C            8.31280000000000        5.00740000000000        0.81620000000000
C            2.04330000000000       -3.65290000000000        2.57210000000000
C           10.97560000000000       -1.54880000000000       -0.84590000000000
C            7.22350000000000        4.33390000000000       -0.08390000000000
C            5.71850000000000        4.25940000000000       -2.25400000000000
C            1.71150000000000       -2.19430000000000        2.29080000000000
C            8.62190000000000        4.13140000000000        1.99350000000000
C            9.20250000000000        1.47260000000000        1.61700000000000
C            8.61380000000000       -0.68340000000000        2.73730000000000
C            5.02960000000000        2.98340000000000       -4.22910000000000
C            9.67040000000000       -2.77650000000000       -4.28210000000000
C            8.18040000000000        3.61140000000000       -2.50390000000000
C            9.58400000000000        5.07560000000000       -0.02520000000000
C            9.41340000000000        4.75420000000000        3.18580000000000
C           12.26780000000000       -1.58200000000000       -0.03160000000000
C            0.18670000000000       -2.18280000000000        2.17010000000000
C            4.18330000000000       -5.57900000000000        4.13130000000000
C            2.93520000000000       -6.46980000000000        2.34360000000000
C            9.59160000000000        3.87000000000000        4.33510000000000
C            8.22720000000000       -4.68860000000000       -1.87620000000000
H            5.62510000000000       -1.05660000000000       -1.27140000000000
H            6.04430000000000       -1.12280000000000        1.31560000000000
H            7.09060000000000        1.23750000000000        0.29470000000000
H            6.23120000000000        1.11490000000000       -2.35190000000000
H            5.82290000000000        2.08150000000000       -1.23890000000000
H            7.54080000000000        0.89430000000000        2.58580000000000
H            4.09030000000000        2.98760000000000       -2.21720000000000
H            2.76750000000000       -2.57540000000000       -0.42310000000000
H            8.78140000000000        0.60370000000000       -1.77080000000000
H            4.81680000000000        1.42120000000000        1.04220000000000
H            4.09700000000000        0.20070000000000        1.81750000000000
H            5.32780000000000        1.23080000000000        2.29120000000000
H            5.01200000000000       -3.35430000000000        0.96310000000000
H            7.84880000000000       -1.98360000000000       -2.07750000000000
H            8.10860000000000       -1.37500000000000       -3.33950000000000
H            3.91850000000000       -3.29930000000000        3.04610000000000
H            3.90330000000000        0.67570000000000       -3.57990000000000
H            3.01720000000000       -0.54900000000000       -2.65790000000000
H            4.56270000000000       -0.64150000000000       -3.41820000000000
H           11.15010000000000       -1.46810000000000       -2.91730000000000
H            7.16300000000000        5.25590000000000       -1.63850000000000
H            1.37820000000000       -4.18890000000000        1.92740000000000
H            1.35430000000000       -4.05540000000000        3.29260000000000
H           10.18120000000000       -2.18400000000000       -0.34760000000000
H            7.33370000000000        3.34510000000000        0.27220000000000
H            2.23840000000000       -1.72750000000000        3.09190000000000
H            7.65610000000000        4.07040000000000        2.31210000000000
H            2.75670000000000        1.75560000000000       -0.64690000000000
H            7.84400000000000       -1.36950000000000        2.67580000000000
H            9.22390000000000       -1.34130000000000        2.24520000000000
H            9.07520000000000       -0.62810000000000        3.64400000000000
H            4.12830000000000        3.39440000000000       -4.60270000000000
H            5.27760000000000        2.06330000000000       -4.63060000000000
H            5.71460000000000        3.50080000000000       -4.66160000000000
H           10.29770000000000       -3.40840000000000       -4.67800000000000
H           10.18490000000000       -2.08580000000000       -4.84560000000000
H            8.72450000000000       -3.04850000000000       -4.67470000000000
H            8.57950000000000        2.86320000000000       -1.97260000000000
H            7.79590000000000        3.01370000000000       -3.19440000000000
H            8.92750000000000        4.03670000000000       -3.06310000000000
H            9.78460000000000        5.05950000000000       -1.02710000000000
H           10.25710000000000        4.40690000000000        0.36900000000000
H           10.03920000000000        5.94400000000000        0.14460000000000
H            9.14510000000000        5.79610000000000        3.26180000000000
H           10.39790000000000        4.93210000000000        2.89220000000000
H           12.70910000000000       -2.49690000000000       -0.14570000000000
H           12.89030000000000       -0.95050000000000       -0.50050000000000
H           11.94330000000000       -1.38770000000000        0.95820000000000
H           -0.00370000000000       -2.14690000000000        3.19890000000000
H           -0.50070000000000       -2.91210000000000        2.25380000000000
H           -0.40130000000000       -1.53430000000000        1.67630000000000
H            3.74780000000000       -4.91470000000000       -0.74960000000000
H           12.53420000000000       -3.90340000000000       -2.18630000000000
H            8.26250000000000        7.16780000000000        1.47740000000000
H            5.53410000000000        5.07010000000000        0.99360000000000
H            4.61640000000000       -6.40430000000000        3.87950000000000
H            4.93160000000000       -4.83560000000000        4.10480000000000
H            3.47250000000000       -5.47980000000000        4.81950000000000
H            3.06230000000000       -7.30540000000000        3.01900000000000
H            3.76630000000000       -6.71150000000000        1.79720000000000
H            2.00780000000000       -6.63700000000000        1.90060000000000
H            9.74690000000000        4.03200000000000        5.37530000000000
H           10.20560000000000        3.07690000000000        4.43220000000000
H            8.72920000000000        3.32620000000000        4.51870000000000
H            7.59360000000000       -4.52570000000000       -1.18470000000000
H            8.71730000000000       -5.41920000000000       -1.50920000000000
H            7.61690000000000       -4.89310000000000       -2.60050000000000

You can monitor the structural changes during the geometry optimization by visualizing the xtbopt.log file, which can be opened directly with, for example, molden xtbopt.log.
The maximum number of geometry optimization cycles is determined automatically at runtime. If the number of cycles is still not enough, it can manually be adjusted using the --cycles <INTEGER> flag.

Further Settings

The threshold for converging the geometry optimization can be set by providing a level after the optimization flag (--opt <level>). The default level is sufficient for many screening applications, but if the xtb structures should be used for property computations, it might be a good idea to increase the thresholds to, e.g., tight. For more information on the available optimization levels and their default values, refer to the documentation.


Back to top

Copyright © 2025 grimme-lab.

The programs are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.