# Release64:Qmmm optimization

### From NWChem

Potential Energy Surface Analysis:
**Optimization** **|**
Transition States **|**
Hessians and Frequency **|**
NEB **|**

QM/MM optimization is based on multi-region optimization methodology and is invoked by

task qmmm <qmtheory> optimize

The overall algorithm involves alternating optimizations of QM and MM regions until convergence is achieved. This type of approach offers substantial savings compared to direct optimization of the entire system as a whole. In the simplest case of two regions (QM and MM) the algorithm is comprised of the following steps:

- Optimization of the QM region keeping MM region fixed
- Calculation of reduced electrostatic representation for the QM region (e.g. ESP charges)
- Optimization of MM region keeping QM region fixed
- Repeat from Step 1 until converged

The optimization process is controlled by the following keywords:

**region**-**required**keyword which specifies which regions will optimized and in which order.**maxiter**- number of optimizations steps for each region within single optimization pass**ncycles**- number of optimization cycles**density**- electrostatic representation of the QM region during MM optimization**xyz**- output of xyz structure files**convergence**- convergence criteria

Here is an example QM/MM block that provides practical illustration of all these keywords for a generic optimization case where QM molecule(s) are embedded in the solvent

qmmm region qm solvent maxiter 10 3000 ncycles 5 density espfit xyz foo end

We have two regions in the system "qm" and "solvent" and we would like to optimize them both, thus the line

region qm solvent

Our QM region is presumably small and the maximum number of iterations (within a single optimization pass) is set to 10. The solvent region is typically much larger (thousands of atoms) and the maximum number of iterations is set to a much large number 3000:

maxiter 10 3000

We would like to perform a total of 5 optimization passes, giving us a total of 5*10=50 optimization steps for QM region and 5*3000=15000 optimization steps for solvent region:

ncycles 5

We are requesting QM region to be represented by point ESP charges during the solvent optimization:

density espfit

Finally we are requesting that the coordinates of the first region to be saved in the form of numbered xyz files:

xyz foo

### Example of QM/MM optimization

The example below illustrates QM/MM optimization at DFT/B3LYP level of theory for quantum water molecule embedded into 20 angstrom box of classical SPCE/E water molecules.

The restart (wtr_ref.rst) and topology (wtr.top) files are assumed to be generated elsewhere.

start wtr permanent_dir ./perm scratch_dir ./data md system wtr_ref end basis * library "6-31G" end dft xc b3lyp end qmmm region qm solvent maxiter 10 1000 ncycles 5 density espfit xyz foo end task qmmm dft optimize