Page 1 of 1

Problems with the Application of ML_FF to LAMMPS

Posted: Mon Nov 03, 2025 10:53 am
by qingyu_wang

Hello,
I am performing molecular dynamics calculations of Mean Squared Displacement (MSD) in LAMMPS using the machine learning force field (ML_FF) file trained by VASP. I run the simulations on my local machine with 128 CPU cores, The CPU of my machine is from AMD, with the model Epyc 7742. but I have found that the running speed is extremely slow—much slower than the calculations I perform using empirical potential functions. I would like to ask if there are any methods to solve this problem. My files are presented as follows.
https://1drv.ms/f/c/b8ec5e7d661b03f9/Ev ... g?e=6ZV0SU
Many thanks in advance,
Best wishes!


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Mon Nov 03, 2025 2:15 pm
by marie-therese.huebsch

Hi, we can have a look at that. Genrally, emperical potentials (with all their known caveats) are faster than applying MLFF.
Could you please provide more information on your LAMMPS calculation? For instance the log.lammps for a couple of steps and the submission script?


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Mon Nov 03, 2025 3:03 pm
by qingyu_wang

Hello,
Thank you very much for your reply. My log files and script files are provided below.
Best wishes!


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Tue Nov 04, 2025 9:56 am
by marie-therese.huebsch

Hi, thank you for the additional files.

That does not look too bad. Still you may be able to get significant improvement using the following strategies.
From

Code: Select all

Loop time of 143.309 on 32 procs for 49 steps with 99947 atoms

we can estimate 143.309/99947/49 = 2.926224368e-5 s/atom/step on 32 procs which is okayish for an MLFF.

1. Pin the MPI ranks

The communication is about 16% of the computational cost. You may be able to reduce that by pinning the MPI rank. Read understanding the hardware to get some more detailed description.

2. Tune hyperparameters: specifically the cutoff radius

You have used the default for the radial (ML_RCUT1) and angular (ML_RCUT2) cutoff radius. In the lammps output you see that this leads to

Code: Select all

Ave neighs/atom = 425.54574

That's a lot of neighbors. Probably the main physics is captured by <100 neigbors. A systematic way to select the radial cutoff radius is to analyze the pair-correlation function.

  • Plot the total pair-correlation function.

  • Identify the minima that seperate shells of neigboring atoms.

  • Refit the MLFF with ML_RCUT1 set such that you include 1, 2, or 3 shells. Usually 2 shells yield good forces. The first check is to look at the rmse_force by grepping for ERR in ML_LOGFILE.

  • Validate that the resulting MLFF suits your application. Sorry for the vague instruction, but this set depends on the process you want to describe.

3. Descriptor sparsification

Another strategy is too reduce the number of descriptors using sparsification. Read about it following the link for more details.

Please kindly let me know if you can achieve better performance following one or multiple of the suggetions.


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Tue Nov 04, 2025 12:09 pm
by qingyu_wang

Hello,
Many thanks for your reply. I will try the method you suggested, and if there is any improvement, I will get back to you promptly. I have one more question: does the GPU acceleration in LAMMPS support the use of the ML_FF files trained and generated by VASP?
Best wishes!


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Tue Nov 04, 2025 1:25 pm
by marie-therese.huebsch

I have one more question: does the GPU acceleration in LAMMPS support the use of the ML_FF files trained and generated by VASP?

Not yet (and not in the next release), but in the future it will be supported.

Looking forward to hearing what performance you can achieve:)


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Fri Nov 21, 2025 6:08 am
by qingyu_wang

Hello,
I apologize for providing my response so late. I have already tested the first two approaches you suggested and obtained the following conclusions.

1.For the first approach, the improvement in computational speed is not very significant. This may be because I am running the calculations on a supercomputing platform; the speed-up might be much more noticeable on a local machine.
I then adjusted the values of ML_RCUT1 and ML_RCUT2. When using ML_RCUT1 = 5.0 and ML_RCUT2 = 4.0, the corresponding log file is shown in lammps-1, and the simulation speed is roughly twice that of the initial setup.
Subsequently, following your method, I determined that the value corresponding to two shells is approximately 3.7 Å. Therefore, I set ML_RCUT1 = 3.7 and ML_RCUT2 = 4.4. The log file for this configuration is shown in lammps-2, and the speed is about four times faster than the original case.

2.However, the MSD results obtained from these two simulations differ substantially. How can I determine whether the force field I have trained is truly suitable for use in LAMMPS and capable of reliably producing the results required for my target study? In addition, when examining the training performance of my ML_AB file, I obtained the following output:
[a0s002271@ln24%bscc-a SiC-refit-revise]$ grep '^ERR' ML_LOGFILE | awk '{print $1,$2,$3,$4,$5}'
ERR 0 2.00516992E-02 2.53558790E-01 3.31577788E+00
According to the guidelines you provided:https://vasp.at/wiki/Best_practices_for ... rce_fields
the force error is quite large. When I perform ML_MODE = refit using different combinations of ML_RCUT1 and ML_RCUT2, the resulting errors do vary, but they remain relatively large in all cases. My sampling was conducted under an NPT ensemble with temperatures ranging from 2000 K to 3000 K. How can I improve this situation? For sampling, I performed separate ab initio molecular dynamics (AIMD) simulations from scratch. My structures (POSCAR files) include pure SiC, and SiC doped with 1%, 3%, 5%, 8%, and 10% Ag. I then merged the ML_AB files generated under these different configurations using the method described on your website:https://vasp.at/wiki/ML_AB.
After that, I executed ML_MODE=select and ML_MODE=refit to generate the final ML_FF file.
Below are the ML_AB files for each configuration, the merged ML_AB file, the final ML_FF file, as well as the corresponding LAMMPS input files.
https://1drv.ms/f/c/b8ec5e7d661b03f9/Ig ... A?e=I7uICZ
Best wishes!


Re: Problems with the Application of ML_FF to LAMMPS

Posted: Mon Dec 01, 2025 8:13 am
by marie-therese.huebsch

Hello,
sorry, I missed that you have replied. These are great observations. Of course verifying that the force fields properly captures the physics on interest is crucial. There are many ways that can be done and it depends a lot on the target simulation and property. Did you have a look at our tutorials regarding the topic? MLFF-analysis tutorial

Generally, testing and validation is independent of whether you use it in VASP or via LAMMPS. So, you can use all the advise written on the Wiki or in the tutorials.

Since this is a bit of a new topic compared to the optimization of the performance, I'd suggest you create a new thread for this question. You can link the current thread for background information. Please provide details what you have tested thus far and what are the target quantities. You may consider posting in the "from users for users" forum since this is not really question about usage, but more about scientific application.

Best regards
Marie-Therese