3.2. ReaxFF (advanced): ZnS

This tutorial illustrates ReaxFF parametrization for ZnS and H₂S on ZnS(110).

../../_images/ZnS_tutorial_toc.png

The tutorial teaches how to

Note

The input files have already been prepared. If you simply want to run the parametrization without preparing the input, copy the contents of $AMSHOME/scripting/scm/params/examples/ZnS_ReaxFF to a new empty directory. ($AMSHOME is the AMS installation directory).

To open the example in the graphical user interface (GUI): SCM → ParAMS, File → Open the job_collection.yaml file in the new directory.

You can then run the parametrization.

3.2.1. Mix force fields from the AMS ReaxFF library

The ReaxFF force fields included with AMS cover a large part of the periodic table, however, far from all interactions are included.

In this tutorial, the goal is to model H₂S adsorption on a ZnS surface. No ZnS ReaxFF force field is included with AMS, but the following force fields might help:

Force field

Chemistry

Reference

LiS.ff

Sulfur

Islam et al.

Mue2016.ff

Organic S-containing compounds

Müller and Hartke

ZnOH.ff

Zn and ZnO surfaces

Raymand et al.

A ReaxFF force field contains parameters in the following categories: general (GEN), atomic (ATM), bond (BND), angle (ANG), off-diagonal (OFD), torsional (TOR), hydrogen bond (HBD).

Here, we’ll use the following initial parameters from the above force fields:

  • LiS.ff: ATM:S, BND:S.S, ANG:S.S.S

  • Mue2016.ff: ATM:H, BND:S.H, ANG:H.S.H

  • ZnOH.ff: GEN, ATM:Zn, BND:H.H, BND:Zn.H, BND:Zn.Zn, BND:Zn.O*, ANG:Zn.Zn.O*, ANG:Zn.O*.Zn, ANG:Zn.O*.O*, ANG:O*.Zn.O*, HBD:O*.H.O*

For ZnOH.ff, the asterisks in e.g. BND:Zn.O* indicate that we will instead copy those parameters to initialize the BND:Zn.S block. That is, the Zn-O interaction in ZnOH.ff will be used as first guess for the Zn-S interaction in the new force field.

Here, we will demonstrate how to construct an initial ReaxFF force field from scratch. Open ParAMS in ReaxFF mode:

SCM → ParAMS
File → New
Parameters → ReaxFF

In the Parameters tab, you will see the ReaxFF parameters in the GEN block. Those parameters always exist for any ReaxFF force field.

../../_images/RxFF_ZnS_empty_gen_block.png

We want to copy the GEN parameters from ZnOH.ff:

Select one of the GEN parameters in the bottom table
../../_images/RxFF_ZnS_empty_gen_block_select.png
Parameters → Initialize ReaxFF block
../../_images/RxFF_ZnS_empty_gen_block_initialize.png
GEN: from GEN: click OK.
Note: this searches the ReaxFF force field library in AMS and can take a while
In the resulting list, select ZnOH.ff and click OK
This updates the parameter values in the table
../../_images/RxFF_ZnS_gen_block_initialized.png

Now, add the ATM:S, BND:S.S, and ANG:S.S.S parameters from LiS.ff:

Parameters → Add ReaxFF block
Type BND:S.S ANG:S.S.S and click OK. This adds the BND:S.S and ANG:S.S.S blocks to the table, and also the ATM:S block because it didn’t exist.
The new parameters are automatically selected. Do not deselect them
../../_images/RxFF_ZnS_SSS_blocks_initialize.png
Parameters → Initialize ReaxFF block
ANG:S.S.S from ANG:S.S.S, ATM:S from ATM:S, BND:S.S from BND:S.S. Click OK
Note: this searches many ReaxFF force fields and can take a while
In the list, select LiS.ff and click OK
This updates the parameters values in the table
../../_images/RxFF_ZnS_SSS_blocks_initialized.png

Regularly save your work:

File → Save
Save with the name reaxff-zns.params

Next, add the ATM:H, BND:S.H and ANG:H.S.H from Mue2016.ff:

Parameters → Add ReaxFF block
Type BND:S.H ANG:H.S.H and click OK. This adds the BND:H.S and ANG:H.S.H blocks to the table, and also the ATM:H block because it didn’t exist. The bond block is called BND:H.S (sorted alphabetically).
The new parameters are automatically selected. Do not deselect them
../../_images/RxFF_ZnS_HSH_block_add.png
Parameters → Initialize ReaxFF block
ANG:H.S.H from ANG:H.S.H, ATM:H from ATM:H, BND:H.S from BND:H.S. Click OK
Note: this searches many ReaxFF force fields and can take a while
In the list, select Mue2016.ff and click OK
File → Save

Note

For the BND block the order of atoms do not matter (BND:H.S is the same as BND:S.H). For the ANG block the order does matter - the central atom is given in the middle, but for example ANG:H.S.Zn is equivalent to ANG:Zn.S.H

Now add the remaining blocks ATM:Zn, BND:H.H, BND:Zn.H, BND:Zn.Zn, BND:Zn.S, ANG:Zn.Zn.S, ANG:Zn.S.Zn, ANG:Zn.S.S, ANG:S.Zn.S

Parameters → Add ReaxFF block
Type BND:H.H BND:Zn.H BND:Zn.Zn BND:Zn.S ANG:Zn.Zn.S ANG:Zn.S.Zn ANG:Zn.S.S ANG:S.Zn.S HBD:S.H.S and click OK.
The new parameters are automatically selected. Do not deselect them
../../_images/RxFF_ZnS_Zn_block_add.png
Parameters → Initialize ReaxFF block
Replace all S with O in the “from” fields. Click OK.
../../_images/RxFF_ZnS_ZnO_block_initialize.png
Select ZnOH.ff in the list. Click OK.
File → Save

This copies the values from the BND:Zn.O block in ZnOH.ff to the BND:Zn.S block in your new force field, copies the values from the ANG:Zn.Zn.O block in ZnOH.ff to the ANG:Zn.Zn.S block in your new force field, etc.

3.2.2. Choose the parameters to optimize

We will not optimize (deactivate)

  • Any GEN (general) parameters

  • Any ATM (atomic) parameters

  • Any parameters with category DoNotOptimize (these should never be optimized)

  • Any BND (bond) parameters for H-Zn or H-H (there is no training data for those interactions)

  • Any BND (bond) parameters for π-bonds (there is no training data)

  • Any ANG (angle) parameters for S-S-S (there is no training data)

  • Any parameters with value 0 (usually means “off”)

We will optimize (activate):

Block

Atoms

Parameters

BND

S-S, H-S, Zn-Zn, S-Zn

D_e^sigma p_be1 p_ovun1 p_be2 p_bo1 p_bo2

ANG

H-S-H, S-Zn-Zn, Zn-S-Zn, S-S-Zn, S-Zn-S

Theta_0,0 p_val1 p_val2 p_val7 p_val4

HBD

S-H-S

r_hb^0 p_hb1 -p_hb2 -p_hb3

There are various ways to select the above list of parameters for optimization.

For example, the BND parameters can be selected as follows:

Switch to the Parameters tab
In the search box at the bottom, type S.S:
In the Block dropdown, select BND
In the Category dropdown, select Standard
Tick the Active checkbox for D_e^sigma p_be1 p_ovun1 p_be2 p_bo1 p_bo2
../../_images/RxFF_ZnS_activate_SS_BND.png
Repeat the above when searching for H.S:, Zn.Zn:, and S.Zn:
Save your work before continuing

The ANG parameters can be selected as follows:

In the Block dropdown, select ANG
In the Category dropdown, select All
In the search box at the bottom, type theta
Tick the Active checkbox for H.S.H, S.S.Zn, S.Zn.S, S.Zn.Zn, Zn.S.Zn (but not for S.S.S)
../../_images/RxFF_ZnS_activate_ANG.png
Repeat the above steps searching for p_val1, p_val2,``p_val7``, p_val4
Save your work before continuing

The HBD parameters can be selected as follows:

In the Block dropdown, select HBD
In the Category dropdown, select All
Tick the Active checkbox for all S.H.S HBD parameters.
Save your work before continuing
../../_images/RxFF_ZnS_activate_HBD.png

Verify that you’ve activated the desired parameters:

In the Block dropdown, select All
In the Category dropdown, select All
In the Active dropdown, unselect Show Non-Active
../../_images/RxFF_ZnS_activate_show_active.png

You should now see only the active parameters.

By default, the Min and the Max values are set to ±20% of the value. Let’s increase the range for all the now active parameters by another 8.3%:

Select the first active parameter (S.S:D_e^sigma)
Scroll down to the bottom
Hold SHIFT and click on the last active parameter (S.H.S:-p_hb3)
../../_images/RxFF_ZnS_select_active.png
In the Parameters menu, select Adjust Min and Max
../../_images/RxFF_ZnS_adjust_min_max.png
In the left drop-down, select Range
In the middle drop-down, select Scale
Set the value to 1.083
Click OK
../../_images/RxFF_ZnS_adjust_range.png

This increases the range (decreases Min and increases Max) for all selected parameters by 8.3%. In the Adjust Min and Max dialog, you can Scale/Shift/Set the Range/Min/Max, for many selected parameters at the same time.

Save your work before continuing:

File → Save

3.2.3. ZnS training and validation set

The training data contains

Polymorphs

  • Energy-volume scans of the zinc blende and rock salt polymorphs of ZnS (wurtzite energy-volume scan in the validation set). See the GFN1-xTB tutorial for how to set up an energy-volume scan reference calculation in AMS and import it into ParAMS.

  • Enthalpy of formation of the zinc blende, wurtzite, and rocksalt polymorphs of ZnS

Gaseous H₂S

  • Optimized S-H bond length in H₂S, and H-S-H angle. See the GFN1-xTB tutorial or Import training data (GUI) tutorial for how to import the bond length from a geometry optimization job.

  • Bond scan for the S-H bond and angle scan for the H-S-H angle in gaseous H₂S. See the ReaxFF (basic): H₂O bond scan tutorial for how to set up a bond scan reference calculation in AMS.

Clean ZnS(110) surface

H₂S adsorbed on ZnS(110)

  • Optimized Zn-S and H…S bond lengths for H₂S/ZnS(110)

  • Adsorption energy of H₂S/ZnS(110). See also: Adsorption

Other

  • Atomic charges for a variety of systems

(*): The distorted ZnS(110) surfaces were obtained by geometry-optimizing the clean ZnS(110) surface using a previous iteration of the force field.

Note

This tutorial does not cover how to set up all the reference calculations. In the GUI, if you switch to the Jobs panel and double-click in the Detail column, you can use the button Edit in AMSinput to see how the reference calculation was set up (approximately, some details like the maximum number of iterations for the geometry optimization may differ).

If you have run a reference calculation, in the ParAMS GUI you can choose Jobs → Add Job, and browse to the ams.rkf file from the job. That will let you import many properties (energy, forces, stress tensor, charges, …).

The needed .yaml files can be found in $AMSHOME/scripting/scm/params/examples/ZnS_ReaxFF, where $AMSHOME is the AMS installation directory.

Note

Using File → Merge you can add jobs, training set entries, and engines into the current project. If you select File → Open, you will start a new project (thus losing the parameters that you set up in the previous section!).

File → Merge → Add to Jobs. Select the job_collection.yaml file.
File → Merge → Add to training set. Select the training_set.yaml file.
File → Merge → Add to training set. Select the validation_set.yaml file.
File → Merge → Add to Engines. Select the job_collection_engines.yaml file.
../../_images/RxFF_ZnS_added_trainset.png

3.2.4. Run the ZnS ReaxFF parametrization

File → Save As with a new name
File → Run (or, select the job in AMSjobs, set a remote queue, and submit to a compute cluster)

3.2.5. ZnS parametrization results

Note

These results only give an example of a possible result. If you rerun the parametrization, your results will likely differ and could either be better or worse.

../../_images/ZnS_tutorial_running_loss.png

3.2.5.1. ZnS energies

Reference (eV)

Prediction (eV)

ZnS enthalpy of formation (zincblende)

-2.737

-2.737

ZnS enthalpy of formation (rock salt)

-2.329

-2.360

H₂S adsorption energy on ZnS(110) (a)

-0.742

-0.559

ZnS(110) slab energy relative to bulk (b)

+0.124

+0.257

(a): This adsorption energy was not calculated using the in-cell approach

(b): This energy can be converted into a surface energy

3.2.5.2. ZnS volume scans

../../_images/ZnS_tutorial_volumescan_zincblende.png ../../_images/ZnS_tutorial_volumescan_rocksalt.png

3.2.5.3. H₂S bond and angle scans

../../_images/ZnS_tutorial_bondscan.png ../../_images/ZnS_tutorial_anglescan.png

3.2.5.4. ZnS optimized distances

../../_images/ZnS_tutorial_distances.png

3.2.5.5. ZnS forces on distorted structures

../../_images/ZnS_tutorial_forces.png

Fig. 3.2 Reference and predicted forces on the two depicted structures. The structures were obtained by geometry-optimizing a slab using a previous iteration of the force field.