# Geometry optimizations

## Geometry Optimizations

Qcore provides robust geometry optimization algorithms, which allow us to optimize a molecule to a local energy minimum or a transition-state geometry, with and without geometric constraints.

In this section, we demonstrate the use of Qcore to perform geometry optimization with and without constraints; transition-state optimization will be covered in another section.

The command for running a geometry optimization is optimize(). There are several coordinate systems that can be used for geometry optimization: tric, irc, hdlc, and xyz, with the tric coordinates being the default, since they are well suited for molecular clusters while maintaining efficiency for individual molecules.

## 1. Full geometry optimization

The minimal input for running a full geometry optimization looks like this:

optimize(
structure(molecule = methanol)
xyz_output = 'methanol_opt.xyz'
xtb()
)


In this example, we want to optimize a methanol molecule, starting from the built-in geometry, using the tric coordinate system (which is the default) and the GFN-xTB method for providing the energy and gradients. The finally optimized geometry is saved to an XYZ format file methanol_opt.xyz.

Below is another example of running full geometry optimization at DFT B3LYP/6-31G* level of theory, using the hdlc coordinate system. Note how easy it is to change between energy methods (DFT vs. GFN-xtb).

optimize(
structure( molecule = methanol )
coordinates = hdlc
xyz_output = 'methanol_opt.xyz'
dft( xc = B3LYP ao = '6-31G*' )
)


## 2. Constrained geometry optimization

Qcore allows for geometry optimization with various geometric constraints, including:

• Freezing the Cartesian coordinates of atoms in absolute space
• Freezing bonds, angles, and dihedrals at their initial values
• Setting bonds, angles, and dihedrals to target values
• Combination of the preceding options

Here is example input for running a constrained geometry optimization:

optimize(
structure( molecule = methanol )
bond(atoms=[1, 3] frozen = true)
angle(atoms=[2, 1, 3]
value = 108.5 degree)
dihedral(atoms=[2, 1, 3, 4]
frozen = true)
xyz_output = 'methanol_opt.xyz'
xtb()
)


In this example, we choose to optimize the geometry of methanol with multiple constraints:

• Freezing the C-O bond length at its initial value
• Setting the H-O-C angle to a fixed value of 108.5 degree
• Freezing the dihedral angle H-O-C-H at its initial value

Additional options/subcommands for performing geometry optimizations can be found in the user manual.