Fine-Tuning Machine Learning Force Fields
Tutorial Created with Software Release: 2026-3
Topics: Catalysis & Reactivity , Consumer Packaged Goods , Energy Capture & Storage , Organic Electronics , Pharmaceutical Formulations , Polymeric Materials , Thin Film Processing
Methodology: Machine Learning
Products Used: MS FF Applications , MS Maestro
|
113 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
Abstract:
In this tutorial, we will learn to fine-tune a pre-trained machine learning force field (MLFF) model to study lattice parameters of 2D materials.
Tutorial Content
1. Introduction to Fine-Tuning Machine Learning Force Field Models
Pre-trained machine learning force field (MLFF) models are powerful tools that provide near-quantum accuracy at a fraction of the computational cost of density functional theory (DFT). However, the accuracy of these models depends heavily on how well the training data represents your specific chemical system.
Fine-tuning allows you to adapt a pre-trained Message Passing Network with Iterative Charge Equilibration (MPNICE) model to your target chemistry by training it on a smaller, curated set of reference data. This process significantly improves model accuracy for your specific application without the computational expense of training a model from scratch.
In this tutorial, we will use the MLFF Fine-tuning panel to create a fine-tuned model on a training dataset of 2D materials. Then the newly created model will be used to explore lattice parameters using the MLFF Calculations panel.
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.
-
Double-click the Materials Science icon
- (No icon? See Starting Maestro)
- Go to File > Change Working Directory
- Find your directory, and click Choose
- 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_fine_tuning.zip
- After downloading the zip file, unzip the contents in your Working Directorythe location where files are saved for ease of access throughout the tutorial
- Go to File > Save Project As
-
Change the File name to mlff_fine_tuning_tutorial, click Save
-
The project is now named
mlff_fine_tuning_tutorial.prj
-
The project is now named
- Go to File > Import Structures
-
Navigate to where you downloaded the tutorial files and choose
training_data.mae. Click Open- A new group has been added to the project with 25,586 entries. This will be our training data used to train a MLFF model.
3. Fine-Tuning MLFF Models
In this section, we will fine-tune and adapt a pre-trained MPNICE model to a specific chemical system by training on a smaller set of reference data, improving accuracy for the target chemistry without the cost of training a model from scratch using the MLFF Fine-tuning panel.
- In the entry list, 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 training_data (25586) group
-
Go to Tasks > Materials > Informatics > MLFF Fine-tuning
- The MLFF Fine-tuning panel opens
Training dataset are structures with certain required properties. The required properties are total energies if the dataset was prepared by Jaguar, or total energies, stress, and force tensors if it was prepared by Quantum ESPRESSO. This dataset was prepared by Quantum ESPRESSO.
Select the MPNICE model that best matches the chemistry of your system. The choice of model determines which element types and levels of theory the fine-tuned model supports. Only MPNICE models that are compatible with periodic boundary conditions are available for fine-tuning.
Set the training parameters in the Tuning tab. The Training cycle size defaults to the number of input structures but can be adjusted. You can set a fixed random number seed to ensure reproducible results across runs. Learn more about the panel in the help documentation.
-
Set the Select ML Model to Hybrid_MPNICE
- For more information on MLFFs, see the help documentation
-
Set the Training cycle size to 23028
- The training cycle size is about 90% of the training data
- Set the Batch size to 32
- Set the Number of training cycles to 200
- Keep the Job name
-
Adjust the job settings (
) as needed
- This job can be run on a GPU or CPU host. The training time varies widely, depending on training data size and number of training cycles. This particular dataset size (23,000 structures) can take two days. A smaller dataset of ~100s of structures as opposed to 1000s of structures can be completed in a few hours.To reduce training time, use a GPU host.
- If you would like to run the job yourself, click Run. Otherwise, use the pre-generated file from the provided tutorial files in the following steps.
- Go to the Training and Validation Metrics tab
- Click Load Job Directory
-
Navigate to the
Section_03 > mc2dmodel4cpu_build40and click Choose- The job directory contains a sub-directory [job name]_model, which contains 4 files: torchscript.pt, SCHRODINGER_MLFF_DATA.txt, metadata.pbtxt, latest_ema.pt. These files are needed for later development of the fine-tuned model.
The following metrics are displayed as a function of the validation cycle: total loss, energy mean absolute error (MAE), gradient MAE, stress MAE, and learning rate. To review these results, scroll through the graphs.
- Close the MLFF Fine-tuning panel once finished
4. Testing the Fine-Tuned MLFF Model
In this section, we will use the MLFF Calculations panel to test the MLFF fine-tuned model. The MLFF Calculations panel is intended for predicting single point energies and optimizing geometries of atomistic periodic and non-periodic systems using MLFFs. When you select the pre-trained ML model to use for the prediction, you should make sure that you use the one that best matches the chemistry of your input system(s).
- Go to File > Import Structures
-
Navigate to where you downloaded the tutorial files (presumably your working directory) and choose
Section_04 > MoS2_QE_unoptimized.mae. Click Open- A new entry is added to the entry list. This is an unoptimized 2D structure of MoS2.
- In the entry list, 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 MoS2_QE_unoptimized entry
-
Go to Tasks > Materials > Informatics > MLFF Calculation
- The MLFF Calculations panel opens
- Set the Select ML Model to Custom
-
Click Browse and navigate to the
Section_03 > mc2dmodel4cpu_build40 > mc2dmodel4cpu_build40_modeland click Choose -
Select Geometry optimization
- This will uncheck Single point energy
- Check Lattice optimization
- Set the Job name to mlff_prediction_MoS2
-
Adjust the job settings (
) as needed
- This job can be run on a CPU host in just a minute.
- Close the MLFF Calculations panel
When the job finishes it will import automatically into the project. Let’s compare the MLFF geometry optimized system to the starting system and the fully DFT optimized system.
- To import the DFT optimized system, go to File > Import Structures
-
Navigate to where you downloaded the tutorial files and choose
Section_04 > MoS2_QE_fully_optimized.mae. Click Open- A new entry is added to the entry list. This is the fully optimized structure of MoS2.
We will now evaluate the initial system alongside the geometry-optimized versions from both the MLFF fine-tuning and DFT calculation.
A comparison of the lattice parameters for the three structures reveals that the unoptimized system has a value of 6.5 Å. In this simple use case, following optimization with the fine-tuned MLFF model, this parameter increases to 6.7 Å, while the DFT-optimized system demonstrates a lattice value of 7.1 Å. The fine-tuned model produced a closer match with this lattice parameter (6.7 Å) compared to the Hybrid MPNICE model.
5. Conclusion and References
In this tutorial, we learned how to fine-tune a pre-trained MPNICE model and use it to study lattice parameters.
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 100+ 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:
For further reading:
- See the help documentation
- Efficient Long-Range Machine Learning Force Fields for Liquid and Materials Properties. DOI: 10.48550/arXiv.2505.06462
- Materials Cloud Two-Dimensional Structure Database (MC2D)
- Expansion of the Materials Cloud 2D Database. DOI: 10.1021/acsnano.2c11510
6. 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













