Page 1 of 1
how train a COF by MLFF in vasp from the primitive cell?
Posted: Sat Mar 08, 2025 12:17 pm
by suojiang_zhang1
Hi,everyone
I try to train a MLFF of COF 2D material by NPT or NVT.
the INCAR file looks like
SYSTEM = COF_origin
NCORE=8
### Electronic structure part
ENCUT=450
GGA = RP
IVDW = 11
ALGO = F
LASPH = .T.
ISMEAR = 0
SIGMA = 0.5
ISPIN = 1
ISYM = 0
LREAL = Auto
### MD part
IBRION = 0
MDALGO = 3
LANGEVIN_GAMMA = 10.0 10.0 10.0 10.0 10.0
LANGEVIN_GAMMA_L = 10.0
NSW = 10000
POTIM = 1
ISIF = 3
TEBEG = 200
TEEND = 400
PSTRESS = 0.001
PMASS=100
RANDOM_SEED = 486686595 0 0
### Output
LWAVE = .FALSE.
LCHARG = .FALSE.
### Output
LWAVE = .FALSE.
LCHARG = .FALSE.
#NBLOCK = 10
#KBLOCK = 10
##############################
### MACHINE-LEARNING ###
################################
ML_LMLFF = .T.
ML_MODE=train
ML_DESC_TYPE = 1
ML_ISTART = 0
I finished the train and got a ML_FF.
I moved the ML_FF to lammps by :
pair_style vasp
pair_coeff * * ML_FF O N C H S
replicate 4 4 1
I checked the trajectory for xyz format. But I found the structure of COF was collapsed.
I will appreciate everyone give me some clues to improve the stability of the MLFF, or shared your experiences in training such system
Re: how train a COF by MLFF in vasp from the primitive cell?
Posted: Mon Mar 10, 2025 10:23 am
by ferenc_karsai
I moved this post to from "users to users".
There can be numerous things that can go wrong. I first advice to read our best practices page on the wiki.
First of all I see that you use ML_MODE and ML_ISTART together. While here it does not do any harm, please refrain from using ML_ISTART since it is a deprecated tag. Please control all your calculations only via ML_MODE.
Another important thing:
Check your calculations during training, did you sie a collapse or strong deformation of the structure? If yes, than that force field will not be a good one.
From seeing only the INCAR file and the limited information you gave I have the following things to consider:
-) Please also run an MD for the pair correlation function of the obtained ML_FF in VASP with similar MD settings as in LAMMPS and see if the force field collapses here too.
-) Hydrogens can move very much, even with a timestep of 1 fs sometimes. This can cause catastrophic deformations of the structure. To avoid that you should make the hydrogens around 8 times heavier during sampling/training. If you are interested in free energies, you can keep the increased weight also during production runs. For diffusion coefficients you need to change the weight back to 1 and possibly decrease the timestep to 0.25-0.5 fs. You can supply the atomic weights via POMASS in the INCAR file.
-) You use IVDW=11 which is the DFT-D3 method. In some cases we saw that the coordination number can have sudden jumps when changing the volume which can lead to discontinuities in the energy vs. volume curves. I think there is only a small chance that you suffer from this problem, but it's maybe worth a try. In that case try IVDW=11 wich belongs to DFT-D2 method.
Re: how train a COF by MLFF in vasp from the primitive cell?
Posted: Tue Mar 11, 2025 5:11 am
by suojiang_zhang1
Thank you so much for your the suggestions.
I try the ML_MODE='train' without the ML_ISTART, and use the IVDW=10 for DFT-D2, but I have a question for the set, how I continue to train from the current files? how to deal with ML_ABN and ML_FFN?
For the hydrogen atom I try the POMASS=8 to decrease its jump, but I have a question, if I run the the lammps to MD from the ML_FF, does the hydrogen mass in lammps also to set to 8?
In addition, for the 2D material such as COF I trained, in process of training, will I use NPT or NVT?
if NVT, the ISIF=2?
Re: how train a COF by MLFF in vasp from the primitive cell?
Posted: Tue Mar 11, 2025 8:50 am
by ferenc_karsai
If you change your IVDW, you have to train from scratch. The same is true for all other parameters such as kmesh or ENCUT, because the changes of the parameters lead to different energies and the same system suddenly with different energies for the same phase is not a good idea to learn.
No in LAMMPS you can run with both weight 1 or 8, depends on what you need. Free energies does not depend on the mass, but diffusion coefficients yes.
NpT is good for training because you have fluctuations of the volume which can make your calculation more stable. Also training in NpT and then running in NVT is stable, but vice versa not.
NpT: ISIF=3.
NVT: ISIF=2.
Re: how train a COF by MLFF in vasp from the primitive cell?
Posted: Tue Mar 11, 2025 1:08 pm
by suojiang_zhang1
thank you
if use NPT, for the 2D COF material, the z length will be shortened, but this is not want to change.
Re: how train a COF by MLFF in vasp from the primitive cell?
Posted: Thu Mar 13, 2025 8:52 am
by ferenc_karsai
The Z-length depends strongly on the chosen exchange-correlation functional.
If you want to keep the z direction fixed you can also use the ICONST file for that.