3.1. ReaxFF (basic): H₂O bond scan

This example shows how to fit a ReaxFF force field to reproduce a DFT-calculated H–OH bond dissociation curve of a water molecule in the gas phase.


Fig. 3.1 Bond length scan of a water molecule using Water2017.ff (initial, green), DFT (reference, blue), and refitted ReaxFF force field in this tutorial (red). The (88) means that the best fit was obtained for evaluation 88.

The ReaxFF force field Water2017.ff (DOI: 10.1021/acs.jpcb/7b02548) is used as a starting point for the parametrization.


The Water2017.ff force field was originally optimized for liquid water, not gaseous water.

The tutorial files can be found in $AMSHOME/scripting/scm/params/examples/ReaxFF_water. The input files already exist if you want to skip generating them (then jump to Run the ReaxFF parametrization).

For each step, a few different ways are shown:

The differences are summarized at the end of the tutorial.

3.1.1. Calculate the reference data

The reference data will be a bond scan of one of the H–OH bonds in gaseous water. The easiest way to set up such a calculation is as follows:

1. Open AMSinput with the ADF panel active. (If you do not have an ADF license, you can use a different reference engine).
2. Draw a water molecule, or use the search box to search for water
3. Task → PES Scan, and click the arrow icon to the right.
4. Select the O atom and one of the H atoms
5. Click the + icon next to O(1) H(2) distance
6. Set the number of scan points for SC-1 to 11
7. Set the range minimum to 0.85 angstrom, and the maximum to 1.35 angstrom.
8. Save with the name H2O_pesscan and run

3.1.2. Import the reference data into ParAMS

Select the finished reference job in AMSjobs
Job → Add to ParAMS (Ctrl-T)
This brings up the ParAMS GUI and an import dialog
In the dialog, set Use ResultsImporter to Add Single Job (default)
Set Task (for new job) to PESScan (default)
Set Properties to pes (default)
Click Import

This adds

  • A job with the ID H2O_pesscan to the Job Collection. It has task PESScan, with settings taken from the reference pes scan job (which bond to scan, the number of points to sample, etc.).

  • A training set of type PES with the detail H2O_pesscan, relative_to=3. The relative_to_3 means that the energies along the bond scan are calculated with respect to the 4th point (the indexing starts with 0), because that point was the lowest in energy. Select the entry and switch to the Info panel at the bottom to see the reference values.

  • An engine adf;<empty Settings>;. This engine contains the settings that were used in the reference calculation.


If you would like to change the point along the bond scan that the other energies are relative to, it can be done as follows:

Go to the Training Set panel
Double-click in the Details column where it says H2O_pesscan, relative_to=3. This brings up a dialog with more details.
Note how the 4th value is 0.0 and all the other numbers are positive
On the PES line, change relative_to=3 to relative_to=0.
Click OK. Note: The reference values have not yet changed!
Select the entry on the Training Set panel.
Training Set → Get Data From Ref Jobs
This updates the reference values.
Double-click in the Details column where it says H2O_pesscan, relative_to=0. This brings up a dialog with more details.
Note how the 1st value is now 0.0, and some of the other numbers are negative
Change back: On the PES line, change relative_to=0 to relative_to=3.
Select the entry on the Training Set panel.
Training Set → Get Data From Ref Jobs
This updates the reference values.

3.1.3. Set the parameters to optimize

In this case, we will optimize all O-H bond parameters of the ReaxFF force field. The starting point (initial parameters) come from Water2017.ff (DOI: 10.1021/acs.jpcb/7b02548).

First, load Water2017.ff:

In the ParAMS GUI, select Parameters → Load ReaxFF Force Field → Water2017.ff

Next, only set the O-H bond parameters to be active:

Switch to the Parameters tab in the bottom half
In the Block drop-down, choose BND (bond parameters)
In the Category drop-down, choose Standard - these are the parameters that are most common to optimize.
Scroll down to the bottom, and tick the Active checkbox for all 12 parameters with Atoms equal to H O


In the bottom search box, type H.O: to search for parameters between H and O (both BND and OFD parameters). Remember to clear the search box to see all parameters again.


Normally you wouldn’t optimize all bond parameters, but only a few of them (you could try different combinations). Here, we optimize all bond parameters for illustration purposes only. For example, optimizing π-bond parameters for H₂O is not very useful!

See also

The equations that the parameters enter.

3.1.4. Run the ReaxFF parametrization

For ReaxFF, we recommend to use CMA-ES. It is a method which samples popsize parameters around a central point (mean). The first central point is the initial parameters. The sigma keyword affects how broad the sampled distribution is (how far away from the central point parameters are sampled).

After an iteration, which consists of popsize parameter evaluations, the central point and sigma are updated. The central point will approach the optimized parameters, and sigma will decrease as the optimization progresses. In this way, the sampled distribution is very broad in the beginning of the optimization, but becomes smaller with time.

When sigma reaches the minsigma value, the optimization stops.

See also


Decrease the initial sigma value for faster convergence (less global optimization).

Note: The settings panel in AMS2023 has changed compared to AMS2022.

Switch to the OptimizationPanel panel in the bottom table
Set Max loss function calls to 100
Click the MoreBtn next to Optimizers
For Optimization algorithm: #1 set Type to CMAES
Set σ₀ to 0.1
Set Popsize to 10
Set Min sigma to 0.0001
Switch to the Details → Output panel
Set Training set logger General to 5
Also set Parameters, History, and Flush to 5.
File → Save As
Save with the name reaxff_water.params
File → Run

3.1.5. Visualize the results

For more details about graphs and results, see the Getting Started: Lennard-Jones tutorial.

On the Graphs tab, select Best H2O_pesscan_relative_to_3.

This plots the file optimization/training_set_results/best/pes_predictions/H2O_pesscan_relative_to_3.txt.

To compare to the bond scan using Water2017.ff, choose Data From → Training(initial): ΔE_prediction.



You double-click on a plot axis to access plot configuration settings.

3.1.6. ffield.ff: The force field file

To run new ReaxFF simulations with your fitted force field, you need the force field file ffield.ff.

You can find it in the results directory in optimization/training_set_results/best/ffield.ff.


The first line of the file is a header. Fill it with some meaningful content describing

  • who made it,

  • when it was made, and

  • the types of training data (systems, reference methods)

You can also change the header in the ParAMS GUI: Select Parameters → Edit ReaxFF header before running your job.

3.1.7. Summary of the 3 different ways

Differences of the three different ways of running this tutorial (GUI, Python, Command-line) are given below:





Run reference job



Import results

Import dialog

Results Importer

Run ParAMS




Final plot

Graphs panel


$AMSBIN/params plot

3.1.8. Next steps with ReaxFF parametrization

Check out the ReaxFF (advanced): ZnS for a more realistic parametrization, which also shows how to build a new ReaxFF force field from scratch.