Machine Learning Force Field

Tutorial Created with Software Release: 2026-1
Topics: Catalysis & Reactivity, Consumer Packaged Goods, Energy Capture & Storage, Organic Electronics, Pharmaceutical Formulations, Polymeric Materials, Thin Film Processing
Methodology: All-Atom Molecular Dynamics, Machine Learning, Molecular Quantum Mechanics, Periodic Quantum Mechanics
Products Used: Desmond, Jaguar, MS Maestro, Quantum Espresso

Tutorial files

108 MB

This tutorial is written for use with a 3-button mouse with a scroll wheel.
Words found in the Glossary of Terms are shown like this: Workspacethe 3D display area in the center of the main window, where molecular structures are displayed

 

Tip: You can hover over a glossary term to display its definition. You can click on an image to expand it in the page.
Abstract:

 

In this tutorial, we will learn to use the machine learning force field (MLFF) method for structural optimization, reaction energy evaluation or molecular dynamics of a variety of chemical systems.

 

Tutorial Content
  1. Introduction to Machine Learning Force Fields (MLFF)

  1. Creating Projects and Importing Structures 

  1. Molecular Simulations with MLFF

  1. Periodic Simulations with MLFF

  1. MD Simulations with MLFF

  1. Conclusion and References

  1. Glossary of Terms

1. Introduction to Machine Learning Force Fields (MLFF)

Machine learning force fields (MLFFs) offer a sophisticated and cost-efficient approach to atomistic simulations, achieving accuracy comparable to density functional theory (DFT). These models can cover the entire periodic table. We introduce Message Passing Network with Iterative Charge Equilibration (MPNICE), an invariant message passing MLFF architecture, see References. MPNICE iteratively predicts atomic partial charges, naturally incorporating long-range interactions. This capability allows for the prediction of charge-dependent properties, with inference speeds 5-20 times faster than models of similar accuracy. Schrödinger’s MLFF/MPNICE models are trained for a diverse range of systems, including organic molecules, liquids and solids, as well as inorganic crystals and hybrid systems.

In this tutorial, we will use MLFF methods to optimize two large organic light emitting diode (OLED) isomers (Section 3), model adsorption on a copper surface (Section 4), and prepare and perform molecular dynamics (MD) simulations on a battery system (Section 5). All input and output files are provided. If you wish to run the calculations yourself, you will require a CPU host for Sections 3 and 4 and a GPU host for Section 5.

2. Creating Projects and Importing Structures

At the start of the session, change the file path to your chosen Working Directorythe location where files are saved in MS Maestro to make file navigation easier. Each session in MS Maestro begins with a default Scratch Projecta temporary project in which work is not saved, closing a scratch project removes all current work and begins a new scratch project, which is not saved. A MS Maestro project stores all your data and has a .prj extension. A project may contain numerous entries corresponding to imported structures, as well as the output of modeling-related tasks. Once a project is saved, the project is automatically saved each time a change is made.

Structures can be built in MS Maestro or can be imported using File > Import Structures (or drag-and-dropped), and are added to the Entry Lista simplified view of the Project Table that allows you to perform basic operations such as selection and inclusion and Project Tabledisplays the contents of a project and is also an interface for performing operations on selected entries, viewing properties, and organizing structures and data. The Entry Lista simplified view of the Project Table that allows you to perform basic operations such as selection and inclusion is located to the left of the Workspacethe 3D display area in the center of the main window, where molecular structures are displayed. The Project Tabledisplays the contents of a project and is also an interface for performing operations on selected entries, viewing properties, and organizing structures and data can be accessed by Ctrl+T (Cmd+T) or Window > Project Table if you would like to see an expanded view of your project data.

  1. Double-click the Materials Science icon

Figure 3-1. Change Working Directory option.

  1. Go to File > Change Working Directory
  2. Find your directory, and click Choose
  3. Pre-generated files are included for running jobs or examining output. Download the zip file here: schrodinger.com/sites/default/files/s3/release/current/Tutorials/zip/mlff.zip
  4. After downloading the zip file, unzip the contents in your Working Directorythe location where files are saved for ease of access throughout the tutorial

Figure 3-2. Save Project panel.

  1. Go to File > Save Project As
  2. Change the File name to mlff_tutorial, click Save
    • The project is now named mlff_tutorial.prj

Figure 3-3. The entries in the entry list to be used as the components in the subsequent sections.

We will proceed to import the systems that we will use in the subsequent sections: two OLED isomers, five copper surfaces with varying number of adsorbates, and battery electrolyte components. If you would prefer to draw or build these components yourself using the 2D Sketcher, Build Slabs and Interfaces panel, and the Polymer Builder panel, feel free to do so following similar steps outlined in the Introduction to Materials Science Maestro tutorial. Otherwise:

  1. Go to File > Import Structures
  2. Navigate to where you have downloaded the provided files (presumably in your working directorythe location where files are saved), and choose the components.maegz file
  3. Click Open
    • Three new entry groups are added to the entry lista simplified view of the Project Table that allows you to perform basic operations such as selection and inclusion

3. Molecular Simulations with MLFF

In this section, we will perform molecular simulations on two large isomers of an OLED molecule using the following three step workflow: geometry optimization with MLFF, DFT single point calculation, and DFT geometry optimization.  We will compare the performance of the MLFF with that of DFT in terms of structure, isomerization energy and computational time.

The OLED molecules of interest:

Figure 3-1. Opening the QM Multistage Workflow panel.

  1. Select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries the mQM_inputs group from the entry lista simplified view of the Project Table that allows you to perform basic operations such as selection and inclusion, containing the two isomers as entries
  2. Go to Tasks > Materials > Quantum Mechanics > Molecular Quantum Mechanics > QM Multistage Workflow

Figure 3-2. Setting up the first QM stage.

In this example, we will first run an optimization using MLFFs, followed by a DFT single point calculation, and lastly followed by a relatively cheap DFT optimization.

  1. For the first Stage type, choose Optimization
  2. Name the stage mlff_opt
    • Changing the stage name can help keep track of steps in large workflows
  3. Scroll to the bottom of the stage, and in the Additional keywords section, input mlff=organic_mpnice
    • mlff=organic_mpnice is a Jaguar keyword that will enable the MLFF that has been trained on DFT data for organic molecules
  4. Click Append Stage

Figure 3-3. Setting up the second stage.

  1. For the second Stage type, keep Single point
  2. Name the stage dft_sp
  3. Uncheck Wavefunction and Hession
  4. Maintain the default B3LYP-D3 level of Theory
  5. Change the Basis set to MIDIXL
    • This is a relatively small basis set with only 192 functions for the molecules in this set that is still known to produce good molecular geometries
  6. Click Append Stage

Figure 3-4. Setting up the third QM stage and running the calculation.

  1. For the third Stage type, choose Optimization
  2. Name the stage dft_opt
  3. Uncheck Wavefunction
  4. Maintain the default B3LYP-D3 level of Theory
  5. Change the Basis set to MIDIXL
  6. Change the Job name to jaguar_workflow_mlff_oled
  7. Adjust the job settings () as needed
    • This job requires a CPU host. The job can be completed in about 19 hours on 4 CPUs
  8. If you would like to run the job yourself, click Run. Otherwise, import the pregenerated Section_03 > jaguar_workflow_mlff_oled > jaguar_workflow_mlff_oled-out.maegz file from the provided tutorial files via File > Import Structures
  9. Close the QM Multistage Workflow panel

Figure 3-5. Viewing the results.

Six entries have been added to the entry list. Compare the MLFF optimized output to the DFT optimized output for each isomer, noting that these structures are in structural agreement. Feel free to stylize as desired.

Let’s compare the energy differences and simulation time between the two isomers for the three stages. The energy difference between the two isomers observed at each stage are as follows: 2.6 kcal/mol, 3.0 kcal/mol, and 3.9 kcal/mol for stages 1, 2, and 3, respectively.

 

The total CPU time required for both molecules at each stage, utilizing 4 processors per molecule, was: 0.3 hours for stage 1 (MLFF optimization), 1.7 hours for stage 2 (DFT single point), and 53.4 hours for stage 3 (DFT optimization).

The MLFF method demonstrated significantly greater computational efficiency while maintaining accuracy comparable to the DFT method. It should be noted that the DFT method employed in this particular example is relatively inexpensive. The MLFF MPNICE model was trained using a more sophisticated and computationally demanding DFT method.

4. Periodic Simulations with MLFF

In this section we will explore how MLFF facilitates the simulation of larger and more complex periodic systems than DFT, while at the same time describing metals and charged systems more accurately than traditional forcefields. We will use MLFF to model the adsorption at various coverages of an inorganic ligand onto a copper surface.

We consider five systems, each comprising a Cu surface slab with one to four adsorbed dimethylaminopropoxide (dmap) molecular anions. The larger cells are four times the area of the smaller cell, and so allow more coverages and orientations of the adsorbate to be modelled.

 

For details on surface slab creation and adsorption modeling, refer to the Modeling Surfaces tutorial. In this section we make use of the Adsorption Energy panel as a convenient way to optimize a series of adsorbate structures with N [dmap]- anions binding to an N+ charged copper surface - the system is neutral overall.  The panel also outputs adsorption energies, albeit for the chemically-unlikely situation of a neutral spin-free gaseous dmap radical adsorbing onto a neutral substrate; we expect those adsorption energies to be correspondingly high.

 

Figure 4-1. Opening the Adsorption Energy Calculations panel.

  1. Select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries the pQM_inputs group from the entry list containing five entries
    • These entries were previously generated using the Adsorption Enumeration panel, considering the adsorption of the Nth dmap molecule onto a substrate with N-1 dmap molecules already adsorbed, where N=1 for the small cell and N=1.4 for the larger cell.
  2. Go to Tasks > Materials > Quantum Mechanics > Workflows > Adsorption Energy

Figure 4-2. Setting the optimization method

  1. Ensure that Use adsorbate structures from selects Project Table (5 selected entries)
  2. Select Machine learning force field for the type of adsorption energy method of optimization
    • MLFF methods are employed as an alternative to periodic DFT
  3. Open the MLFF Options panel

 

 

Figure 4-3. Setting the MLFF.

  1. Set Machine leaning force field to Hybrid_MPNICE
    • Due to the organic and inorganic species in the system, learn more about MLFF in the help documentation
  2. Set Maximum steps to 200
  3. Add the Additional keyword  intopt=0
    • This keyword will cause the optimization to be carried out in Cartesian coordinates, which can robustly manage cases where symmetries arise
  4. Click OK to close the panel

Figure 4-4. Running the calculation.

  1. Change the Job name to adsorption_energy_dmap
  2. Adjust the job settings () as needed
    • This job requires a CPU host. The job can be completed in about 15 minutes on 12 CPUs
  3. If you would like to run the job yourself, click Run. Otherwise, import the pregenerated Section_04 > adsorption_energy_dmap > adsorption_energy_dmap-out.maegz file from the provided tutorial files via File > Import Structures
  4. Close the Adsorption Energy Calculations panel

Figure 4-5. Viewing the structure results

  1. When the job is finished or after importing, select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries and includethe entry is represented in the Workspace, the circle in the In column is blue the new adsorption_energy_dmap entry group from the entry list

 

This group contains 11 entries, categorized as follows:

  • 5 Adsorbates: These entries (numbered 1-5) represent dmap adsorbed onto Cu surfaces.
    • Structure 1: Smaller Cu surface with one dmap molecule.
    • Structure 2: Larger Cu surface with one dmap molecule.
    • Structure 3: Larger Cu surface with two dmap molecules.
    • Structure 4: Larger Cu surface with three dmap molecules.
    • Structure 5: Larger Cu surface with four dmap molecules.
  • 1 Gas: This entry is the dmap molecule itself.
  • 5 Substrates: These entries are the surfaces used to create the 5 Adsorbate entries.

The image displays five entries, each depicted in a ball-and-stick rendering; style the system as you prefer.

 

Figure 4-6. Recalculating the connectivity.

  1. Click on the periodic structure tools in the bottom right corner of the GUI,
  2. Open the Build Cell panel
  3. Click Recalculate Connectivity
  4. Click Apply

The periodic structure tools show how dmap bonds to the metal surface in the MLFF-optimized structures when the connectivity is recalculated. O bonds to three Cu atoms and N bonds to one Cu atom, causing slight distortion of the Cu surface.

Figure 4-7. Viewing the project table.

  1. Open the Project Table
    • Note that “MLFF” is recorded as the ‘QM Method’ and that the MLFF energies of the optimized structures are listed under the ‘Gas Phase Energy’ property, even though the slabs are periodic, not gas phase, systems. 
    • Any values remaining in the ‘Etot (Ry)’ property from a previous periodic DFT calculation should be ignored.
    • The MLFF Adsorption Energy values have been obtained by combining ‘Gas Phase Energy’ values for adsorbate, substrate and gas molecule.
  2. Close the Project Table
  • At all four coverages in the larger cell, the binding mode and orientation of the dmap adsorbates is nearly identical with that of one molecule in the small cell.  Steric hindrance between adsorbates is evidently very slight at this coverage. 
  • In future, the adsorption of additional dmap molecules onto the large cell could be investigated, with a view to finding the maximum or saturating coverage.  It would also be interesting to investigate whether randomized orientations of the dmap adsorbates can be stabilized on the symmetrical Cu substrate.
  • The rapid turn-around time for MLFF optimizations (about 15 minutes in this case) facilitates such studies of complex periodic systems.
  • Having noted at the start that the adsorption energies would likely be unusually high, this is borne out by the computed values of -140 to -157 kcal/mol.  Nevertheless, the values are internally consistent.  For instance, averaging the four energies for sequential adsorption of dmap onto the larger cell gives a value that is just 0.4 kcal/mol less than that for the small cell. This quantifies the level of relaxation in the larger cell, and supports the above finding of negligible steric interaction between the adsorbates at this coverage.

MPNICE/MLFF optimization of periodic systems allows for efficient modeling of numerous molecules in various orientations on large surfaces, whether organic or inorganic, charged or neutral.

5. MD Simulations with MLFF

This section details a multistage MD simulation of a battery system. The simulation will begin with using the OPLS force field for preparation and an initial MD run, followed by the application of MLFF methods to prepare and perform an MD simulation.

Our simulation box is going to contain the three components that are shown below: TFSI anion, lithium cation, and polyethylene glycol (PEG).

Figure 5-1. The entries selected and the Disordered System Builder panel open.

  1. Select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries the MD_inputs entry group from the entry list

 

Note: For systems containing charged particles, it is generally a best practice to separate the anion and cation components into separate entries, as we have done here. These molecules have scaled the ion charges to +/- 0.7. These quantities are based on a quantum mechanical calculation on a Li / TFSI cluster with a short PEG polymer chain. There are many strategies for determining these charges, and exploring the effect of different charges on the subsequent simulations may be necessary in a study. See the Computing Atomic Charges tutorial for more details on how to obtain these charge values.

 

Note: An MD simulation is recommended to be performed on a neutral system. So, it is important to be sure that your overall system will be neutral once fully constructed.

  1. Go to Tasks > Materials > Structure Builders > Disordered System

Figure 5-2. Setting the components and running the job.

  1. For Initial state, choose Tangled chain
  2. Change Number of molecules to 55
  3. In the Components table, change the Molecules for TFSI to 25, Li to 25 and PEG to 5
  4. Change the Job name to disordered_system_MD
  5. Adjust the job settings () as needed
    • This job requires a CPU host and will be completed in less than 5 minutes
  6. If you would like to run the job yourself, click Run. Otherwise, import the pre-generated Section_05 > disordered_system_MD > disordered_system_MD-out.cms file from the provided tutorial files via File > Import Structures
  7. Close the Disordered System Builder

Figure 5-3. Output of the Disordered System Builder in the workspace.

When the job is complete, a new entry group will be incorporated titled MD: disordered_system_MD_system (1) containing one entry titled disordered_system_MD_all_components_amorphous

  1. Includethe entry is represented in the Workspace, the circle in the In column is blue the new entry
    • The box is visible in the workspace
    • The components are colored by default, but feel free to stylize as you wish
  2. Use the WAM button () to open the MD Multistage Workflow panel
    • Alternatively, access the panel via Tasks > Materials > Classical Mechanics > MD Simulations > MD Multistage Workflow

Figure 5-4. Setting up the MD Multistage Workflow.

  1. Check Relaxation protocol and choose Compressive
  2. Change the next stage (Stage 8) to Molecular Dynamics
  3. Set the Simulation time (ns) to 10
  4. Click Append Stage
    • A 9th stage appears in the workflow
  5. Change the new stage (Stage 9) to Analysis
  6. Change the Job name to multistage_simulation_OPLS4
  7. Adjust the job settings () as needed
    • This job requires a GPU host. The job can be completed in about an hour on a GPU host
  8. If you would like to run the job yourself, click Run. Otherwise, import the pre-generated Section_05 > multistage_simulation_OPLS4 > multistage_simulation_OPLS4-out.cms file from the provided tutorial files via File > Import Structures
  9. Close the MD Multistage Workflow panel

Figure 5-5. Output of the MD simulation.

  1. When the job is finished or after importing, select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries and includethe entry is represented in the Workspace, the circle in the In column is blue the new disordered_system_MD_all_components_amorphous entry from the entry list
  2. Go to Tasks > Materials > Classical Mechanics > MD Simulations > Prepare for Molecular Dynamics
    • The Prepare for MD panel opens
    • The system will be prepared with MLFF

Figure 5-6. The Prepare for MD panel.

  1. Open the Force Field panel
  2. Set the Force field to MLFF
  3. Set the Select ML Model as Organic_MPNICE
    • The Organic_MPNICE MLFF is adequate even though Li cations are present in the system, as they are single atom ions
  4. Click OK to close the Force Field panel

Figure 5-7. Running the Prepare for MD panel.

  1. Change the Job name to md_prep_MLFF
  2. Adjust the job settings () as needed
    • This job requires a CPU host and will be completed in less than 5 minutes
  3. If you would like to run the job yourself, click Run. Otherwise, import the pre-generated Section_05 > md_prep_MLFF > disordered_system_MD_all_components_amorphous_system-out.cms  file from the provided tutorial files via File > Import Structures
  4. Close the Prepare for MD panel

Figure 5-8. Opening the MD Multistage Workflow panel.

When the job is complete, a new entry group will be incorporated titled MD: disordered_system_MD_system (1) containing one entry titled disordered_system_MD_all_components_amorphous

  1. Includethe entry is represented in the Workspace, the circle in the In column is blue the new entry
  2. Use the WAM button () to open the MD Multistage Workflow panel
    • Alternatively, access the panel via Tasks > Materials > Classical Mechanics > MD Simulations > MD Multistage Workflow

Figure 5-9. Running an MD simulation.

  1. Change the first stage (Stage 1) to MLFF Molecular Dynamics
  2. Set the Simulation time (ns) to 1
  3. Set the Recording interval (ps) to 5
  4. Click Append Stage
    • A 2nd stage appears in the workflow
  5. Change the new stage (Stage 2) to Analysis
  6. Uncheck all analysis types except for Volume and Density
  7. Change the Job name to multistage_simulation_MLFF
  8. Adjust the job settings () as needed
    • This job requires a GPU host. The job can be completed in about 40 hours on a GPU host
  9. If you would like to run the job yourself, click Run. Otherwise, import the pre-generated Section_05 > multistage_simulation_MLFF > multistage_simulation_MLFF-out.cms file from the provided tutorial files via File > Import Structures
  10. Close the MD Multistage Workflow panel

Figure 5-10. MD simulation output.

  1. When the job is finished or after importing, select(1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries and includethe entry is represented in the Workspace, the circle in the In column is blue the new disordered_system_MD_all_components_amorphous entry from the entry list

Figure 5-11. Opening the MS MD Trajectory Analysis panel.

  1. Use the WAM (workflow action menu) button () to open the MS MD Trajectory Analysis panel
    • Alternatively, access the panel via Tasks > Materials > Classical Mechanics > Trajectory Analysis > MS MD Trajectory Analysis
    • The MS MD Trajectory Analysis panel opens
  2. Click Load from Workspace
    • The Simulation Detail tab fills with information about the MD job and system

Figure 5-12. Viewing the equilibrated density.

  1. Go to the Bulk Properties tab
  2. Use the dropdown to view the various properties as a function of time from the MD stage
    • As an example, Density is shown in the Figure
  3. When you are finished, close the MS MD Trajectory Analysis panel

We observe excellent agreement between the converged density results from the OPLS MD simulation and the MLFF MD simulation. It is important to consider the computational time when designing procedures: the MLFF 1 ns MD simulation required approximately 40 hours, whereas the OPLS 10 ns MD simulation completed in under an hour. Notably, the MLFF MD simulation yielded a stable simulation without the need for forcefield refitting. Here, the property of interest converges after 1 ns; however, convergence may not always be achieved within this timeframe.

 

MLFF has the potential to provide accurate predictions for other properties. For details on MLFF MD system property calculations, refer to the Diffusion and Molecular Deposition tutorials.

6. Conclusion and References

This tutorial demonstrated how to use the MPNICE family of MLFF models for the optimization of molecular and periodic systems and for molecular dynamics simulations, achieving a good trade-off between accuracy and computation time.

For further learning:

For introductory content, focused on navigating the Schrödinger Materials Science interface, an Introduction to Materials Science Maestro tutorial is available. Please visit the materials science training website for access to 90+ tutorials. For scientific inquiries or technical troubleshooting, submit a ticket to our Technical Support Scientists at help@schrodinger.com.

For self-paced, asynchronous, online courses in Materials Science modeling, including access to Schrödinger software, please visit the Schrödinger Online Learning portal on our website.

For some related practice, proceed to explore other relevant tutorials:

 

Molecular Quantum Mechanics

 

Periodic Quantum Mechanics

 

Molecular Dynamics

For further reading:

7. Glossary of Terms

Entry List - a simplified view of the Project Table that allows you to perform basic operations such as selection and inclusion

Included - the entry is represented in the Workspace, the circle in the In column is blue

Project Table - displays the contents of a project and is also an interface for performing operations on selected entries, viewing properties, and organizing structures and data

Recent actions - This is a list of your recent actions, which you can use to reopen a panel, displayed below the Browse row. (Right-click to delete.)

Scratch Project - a temporary project in which work is not saved, closing a scratch project removes all current work and begins a new scratch project

Selected - (1) the atoms are chosen in the Workspace. These atoms are referred to as "the selection" or "the atom selection". Workspace operations are performed on the selected atoms. (2) The entry is chosen in the Entry List (and Project Table) and the row for the entry is highlighted. Project operations are performed on all selected entries

Working Directory - the location where files are saved

Workspace - the 3D display area in the center of the main window, where molecular structures are displayed