Page 1 of 2
Machine Learning Potential
Posted: Tue Sep 16, 2025 11:42 am
by qingyu_wang
Hello everyone, I encountered an issue while training a VASP machine learning potential (MLP). I trained a ternary Ag-Si-C machine learning potential, but found that the error is significant. I would like to ask how to reduce this error. Additionally, if I continue to dope new elements based on this trained potential, will the error of the resulting new potential be even larger?
Re: Machine Learning Potential
Posted: Tue Sep 16, 2025 11:55 am
by max_liebetreu
Hello,
Thank you for reaching out to us on the VASP Forum!
There's a number of things that might affect the accuracy of ML potentials. In order to narrow down the likely culprit, could you please provide us with a minimal reproducible example for your training setup?
Additionally, a clarifying question: Do you see this unusually large error for the training data, the test data, or both? The better we understand your approach and setup, the better we'll be able to help.
Best regards,
Re: Machine Learning Potential
Posted: Thu Sep 18, 2025 5:53 am
by qingyu_wang
Dear Professor,
Thank you very much for your response to my question!
Due to constraints such as limited server memory, I first constructed a pure β-SiC structure and performed ab initio AIMD simulations to obtain the corresponding ML_AB file. On this basis, I then doped 1%, 5%, and 10% Ag respectively, where Ag occupied Si sites, and conducted ab initio AIMD simulations for each case to obtain their respective ML_AB files. Subsequently, on the basis of the pure β-SiC structure, I doped 1%, 5%, and 10% Ag respectively, with Ag occupying C sites this time, and performed ab initio AIMD simulations for each scenario to obtain their corresponding ML_AB files.
I then merged these ML_AB files following the method provided on the VASP official website. After that, I randomly selected one of the previous structures to continue the VASP AIMD calculation, which only involved a single-step computation. The resulting ML_ABN file served as my Ag-Si-C potential function. However, when I analyzed the final ML_REG file by comparing DFT and MLP results, I found that the linear relationship was not satisfactory. I would like to know how I can improve this.
And my INCAR:
Code: Select all
#NPT
LANGEVIN_GAMMA = 10.0 10.0 10.0
LANGEVIN_GAMMA_L = 10
LATTICE_CONSTRAINTS = T T F
MDALGO = 3
#SCF setting
EDIFF = 1E-6
ENCUT = 400
ISMEAR = 0
LREAL = Auto
NELMIN = 5
ISYM = 0
#Simulation condition
IBRION = 0
NSW = 200
POTIM = 1.0
TEBEG = 2000
TEEND = 3000
ISIF = 3
#Others
ISTART = 0
LWAVE = .F.
LCHARG = .F.
#KPOINTS
KGAMMA = .TRUE.
KSPACING = 0.25
#Machine learning
ML_LMLFF = .T.
ML_ISTART = 1
Best wishes.
Re: Machine Learning Potential
Posted: Thu Sep 18, 2025 10:06 am
by max_liebetreu
Hello,
Your use case is, in principle, great for ML FF. We just need to figure out what went wrong.
To that end, we suggest to take this one step at a time, starting with your very first training run for your original β-SiC structure. Did you check the error you are describing for that first system as well? Did you see a difference?
What we need from you now is a minimal reproducible example for your first training.
The easiest would be if you delete only those files from the resulting folder that are particularly big, like CHGCAR, WAVECAR or ML_FFN. However, we would definitely like to see:
Best regards,
Re: Machine Learning Potential
Posted: Thu Sep 18, 2025 11:47 am
by qingyu_wang
Hello,Professor
I am not sure how to send files on this platform. Could you please provide me with an email address? This will allow me to describe the issue more effectively, and I will summarize the issue here later.
Best wishes!
Re: Machine Learning Potential
Posted: Thu Sep 18, 2025 2:58 pm
by max_liebetreu
Hello,
Attaching files is rather simple: When you type your reply, simply drag & drop a zipped version of your folder into the editor window. Alternatively, underneath the "save draft", "preview", and "submit" buttons, you also find tabs "Options" and "Attachments" - you can also upload files under "Attachments".
Generally, it is far easier for us to respond to posts on the Forum, so we encourage to resolve any issues there, if possible.
Best regards,
Re: Machine Learning Potential
Posted: Fri Sep 19, 2025 5:38 am
by qingyu_wang
Dear Professor,
Thank you very much for your explanations regarding my questions. I have attached some of my files below. As the maximum file size that can be uploaded here is 8MiB, my output files such as OUTCAR, ML_REG, and XDATCAR are too large—even after compression, their sizes remain far larger than 8MiB, so I am unable to upload these files. Furthermore, since I have set parameters including #KPOINTS, KGAMMA = .TRUE., and KSPACING = 0.25 in the INCAR file, I did not create a KPOINTS file.
Best wishes.
Re: Machine Learning Potential
Posted: Fri Sep 19, 2025 5:57 am
by qingyu_wang
Dear Professor,
To supplement this, each configuration was trained for 10,000 steps. Subsequently, the ML_AB files obtained after training each configuration were merged using the merging method provided on the VASP official website. Then, one configuration was randomly selected from the previous ones for the ML_MODE=refit and NSW=1 training.
Best wishes.
Re: Machine Learning Potential
Posted: Fri Sep 19, 2025 7:58 am
by max_liebetreu
Hello,
Do you see the error you described also after this very first run on the pure β-SiC structure?
Best regards,
Re: Machine Learning Potential
Posted: Fri Sep 19, 2025 8:17 am
by qingyu_wang
Hello,Professor,
I have attached the linear relationship plots between the results of DFT and MLP, which were plotted based on the information extracted from the ML_REG files after training in each configuration.
Best wishes.
Re: Machine Learning Potential
Posted: Fri Sep 19, 2025 2:01 pm
by max_liebetreu
Hello,
Thank you for the plots and explanation! That answers my question about what error you are seeing.
However, we will still require the files I mentioned earlier. Do you have access to a sharepoint or similar solution that would allow you to upload files and share the link here?
Best regards,
Re: Machine Learning Potential
Posted: Sat Sep 20, 2025 3:56 am
by qingyu_wang
Hello,Professor
Thank you very much for your reply. I can share the files via OneDrive, and the link is provided below. I would like to consult you about a question regarding Ab Initio Molecular Dynamics (AIMD) with machine learning (ML) enabled: I have observed that as the doping concentration of Ag increases, the proportion of "accurate" predictions I obtain decreases, which indicates that my ML training is not sufficient. I am wondering what the next steps should be to reduce the prediction error for a specific Ag doping concentration.
For instance, when the Ag doping concentration is 10%, the proportion of "accurate" predictions is only 40%—a result derived from executing the command grep 'accurate 1 F' ML_LOGFILE. Therefore, should the next step involve performing retraining with ML_ISTART=1 enabled? And is it necessary to repeat the retraining process until the proportion of "accurate" predictions reaches a sufficiently high level?
https://1drv.ms/u/c/b8ec5e7d661b03f9/ES ... w?e=6xauPr
Re: Machine Learning Potential
Posted: Mon Sep 22, 2025 10:47 am
by max_liebetreu
Hello,
After looking at your calculations, we have noticed a number of problems with your setup.
- You are randomly replacing atoms in your crystal structure, resulting in extremely high forces especially for 5% and 10% doping. This leads to a partial destruction of the crystal, which might not be what you are interested in. This also leads to questionable deformation of the lattice. The effect is barely noticeable for 1%:
image (1).png
But becomes very noticeable for 10%:
image.png
- Considering the very high forces in your system, your ENCUT might not be able to capture this.
- The initial lattice for each doping configuration is not relaxed. In order to avoid extreme initial forces, you have to start from an already relaxed lattice structure near its equilibrium. The task of finding such an initial structure can be arbitrarily complicated, and VASP may or may not be the right starting point for such computations, depending on your requirements.
- The structure you are investigating is, because of the random initialization, likely to be unphysical.
- Doping with 1-10% is already far beyond the typical fractions for doping. Whether or not that is intentional, we cannot say, but we are doubtful that the resulting crystal would exhibit the same lattice structure.
- We are unsure if you have performed ML_MODE=select computations after combining your ML_AB files to choose your basis sets. Note that this computation could be very expensive for your case (see recommendations below).
Beyond some concerns regarding physicality of these randomly initialized structures, our general recommendation is this:
- Increase ENCUT to something like 600 or higher to better deal with the extreme forces.
- After each doping, first perform a structural relaxation at IBRION=1. We are doubtful regarding using LATTICE_CONSTRAINTS for this relaxation. In any case, depending on what lattice structure you expect, after the initial relaxation and for the rest of your calculations, please refer to the documentation for LATTICE_CONSTRAINTS.
- During training, we recommend you:
- Perform structural relaxation after replacing atoms; possibly after each replaced atom, depending on how that relaxation goes. Disable LATTICE_CONSTRAINTS at least for this relaxation.
- Look at the structure you obtain, and make sure you have a crystal as you expect.
- Start training with the previous ML_AB file. This should save you a lot of overhead.
- Look at the trajectory and make sure the behavior you are seeing is what you are interested in studying.
We want to stress again that your trajectory looks like your crystal structure is obliterated by strong initial forces; essentially, your system is no longer a solid. Obviously, we cannot say whether that is intentional or not. In either case - the large error you are seeing is likely from the very strong initial forces not being properly represented in your training set, only occurring in the very beginning for each new structure (directly after doping) and then never again.
Re: Machine Learning Potential
Posted: Mon Sep 22, 2025 12:13 pm
by qingyu_wang
Hello,professor
Thank you very much for your reply! I believe it is necessary for me to supplement the background of my calculation below. Actually, my research focus is on simulating the diffusion behavior of Ag in SiC. In practice, the doping concentration of Ag in SiC may be around 3%, so my goal is to obtain a potential function applicable to LAMMPS via VASP-based machine learning. Against this background, I would like to confirm whether it is necessary to perform structural relaxation after atom substitution.
The reason for constructing SiC systems with Ag doping concentrations of 1%, 5%, and 10% is to enable the system to undergo a gradual transition with increasing Ag doping, thereby allowing the system to adapt to the presence of Ag. Additionally, during the ab initio molecular dynamics (AIMD) simulations, I employed the NPT ensemble and set the temperature range to 2000 K–3000 K. However, I observed extremely drastic temperature fluctuations during the simulations: the temperature ranged from a minimum of approximately 600 K to a maximum of around 6000 K. Obviously, the system is definitely not in a solid state at such extremely high temperatures.
Based on your suggestions, I have reorganized my approach as follows: The ML_AB files I merged were obtained after training with the parameter setting of ML_MODE=select. Next, I intend to use this merged ML_AB file as the input, and conduct multiple rounds of training on the SiC system with approximately 3% Ag doping—until a potential function with small errors is obtained. I would like to consult you on whether this approach is feasible.
Best wishes!
Re: Machine Learning Potential
Posted: Tue Sep 23, 2025 8:29 am
by max_liebetreu
Hello,
The extreme temperature (and pressure) you are seeing is likely the result of the random choice of which atoms you are substituting for another type. If you are unlucky (and the chance for that gets much higher at higher doping %), that means atoms will initially sit at distances highly unlikely to occur at the intended temperatures. Basically, atoms are forced to be in too close proximity to each other. The result is violent - too much kinetic energy stored in the system leads to your temperature rising to the extremes you are observing.
This spike is an initial reaction, but because you are already training at that stage, your ab initio is doing its best to keep up - and the ML is capturing test configurations during that initial spike: test configurations that are highly unlikely to occur again later during training. The high errors you are seeing might therefore be primarily caused by these outliers.
In any event, our recommendation stands: Increase ENCUT, and definitely relax your system before starting your ML training. Check whether your structure & trajectory look reasonable to you before starting ML, and check energies and forces to be sure.
Best regards,