Inconsistent structures from vasp and lammps trajectory using MLFF

Queries about input and output files, running specific calculations, etc.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
suojiang_zhang1
Jr. Member
Jr. Member
Posts: 73
Joined: Tue Nov 19, 2019 4:15 am

Inconsistent structures from vasp and lammps trajectory using MLFF

#1 Post by suojiang_zhang1 » Mon Apr 14, 2025 10:21 am

Dear,
I trained a liquid MLFF by vasp ML_MODE=train with < 0.05 mev/A force/
I used the MLFF to run MD simulation in 100ps from the CONTCAR obtained in train, and I also used the MLFF to run MD simulation by lammps in 100ps to compare their structures of the trajectory, I find the structures are very different.
The structures from vasp run is reasonable, and the bonds of cross-cycle boundaries can give reasonable connections, but the stuctures from lammps is not reasonable, find C-H-C connection, and some bonds were broken.


michael_wolloch
Global Moderator
Global Moderator
Posts: 163
Joined: Tue Oct 17, 2023 10:17 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#2 Post by michael_wolloch » Mon Apr 14, 2025 10:37 am

Dear Suojiang Zhang,

Please provide all your input files and the necessary output files of a minimal reproducible example as a .zip file, according to our posting guidelines. This will also have to include the LAMMPS inputs and outputs.

I am no LAMMPS expert, but I will try to help you understand the differences between the two runs. Unless you are very confident in your LAMMPS inputs, I would also advise asking on the LAMMPS forum if your inputs are reasonable, since your VASP-only results seem correct to you, and your LAMMPS data not so much.

Cheers, Michael


suojiang_zhang1
Jr. Member
Jr. Member
Posts: 73
Joined: Tue Nov 19, 2019 4:15 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#3 Post by suojiang_zhang1 » Thu Apr 17, 2025 5:27 am

thank you
Now I send the files as zip to the poster.
I used the same ML_FF for the vasp run and lammps MD that from the provious train, but ML_FF is large, I cannot upload it.
In lammps.zip I show a picture noted a nonnormal connectivity such as C-H-C in short running time.
I hope you can find their differency.

yours.

You do not have the required permissions to view the files attached to this post.

michael_wolloch
Global Moderator
Global Moderator
Posts: 163
Joined: Tue Oct 17, 2023 10:17 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#4 Post by michael_wolloch » Thu Apr 17, 2025 12:52 pm

Dear Suojiang Zhang,

Thanks for providing the files.

I had a look, and it seems that the simulation setups are quite different. For VASP, you are running an NPT ensemble with a Langevin thermostat and a 1 fs time step for 100.000 steps

For LAMMPS (if I understood correctly), you are switching from NVE to an NPT ensemble after 100.000 0.1 fs timesteps, and then increasing the timestep to 0.5 fs for another 100.000 steps. For both parts, a Nose-Hover thermostat is used.

I would suggest replicating the VASP setup as closely as possible with LAMMPS, and then comparing the results.

I will show your files to a colleague with more experience in MD and LAMMPS next week, when he returns from his vacation, and report back with further insights if he has any.

Cheers, Michael


suojiang_zhang1
Jr. Member
Jr. Member
Posts: 73
Joined: Tue Nov 19, 2019 4:15 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#5 Post by suojiang_zhang1 » Fri Apr 18, 2025 2:11 am

thank you so much.
I will rerun the lammps that close to the vasp setup and compare the result again.
I also look forward to the reply from your colleagues.

best


andreas.singraber
Global Moderator
Global Moderator
Posts: 281
Joined: Mon Apr 26, 2021 7:40 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#6 Post by andreas.singraber » Wed Apr 23, 2025 8:04 am

Hello!

I agree with Michael's observation that the different MD algorithms and recipes may have led to the different resulting structures. If you still find inconsistent behavior comparing VASP and LAMMPS after your next trials, it would be great if you could share the ML_FF file via some cloud service, or alternatively, attach the ML_AB file instead, so I can create the ML_FF file myself. Then I can check whether the experimental LAMMPS interface is working correctly or not. Btw, next time please also attach the LAMMPS output file (lammps.out), thank you!

All the best,
Andreas Singraber


suojiang_zhang1
Jr. Member
Jr. Member
Posts: 73
Joined: Tue Nov 19, 2019 4:15 am

several questions using vasp ML_FF in lammps MD

#7 Post by suojiang_zhang1 » Thu Apr 24, 2025 8:07 am

Dear,
though I try to use the MLFF from vasp train in lammps MD, I met several questions that confuse me.
I train a liquid system including 210 atoms(C H O S F elements) and the time is 10ps with 10000 steps and 1.0 fs timestep, I check the BEE force around 0.1. the local refer configurations for each element is 1500 and MLFFN is around 500MB size.
In order to increase the accuracy of ML_ff, I do a continuing train about 5ps by copying the ML_ABN to ML_AB in same directory. I find the local refer configurations were increased to 3000 for each element, and the size of MLFFN also was increased to 2.0GB.
After that I refit the ML_AB to produce a new ML_FFN with size 900MB.
I run "head -n 1 MLFF" :
ML_FF 0.2.4 binary { "date" : "2025-04-22T22:35:46.844", "ML_LFAST" : true, "ML_DESC_TYPE" : 0, "types" : [ "C", "H", "N", "S", "O", "F" ], "training_structures" : 937, "local_reference_cfgs" : [ 3000, 3000, 3000, 3000, 3000, 3000 ], "descriptors" : [ 3384, 3384, 3384, 3384, 3384, 3384 ], "ML_IALGO_LINREG" : 4, "ML_RCUT1" : 8.0000E+00, "ML_RCUT2" : 4.0000E+00, "ML_W1" : 1.0000E-01, "ML_SION1" : 5.0000E-01, "ML_SION2" : 5.0000E-01, "ML_LMAX2" : 2, "ML_MRB1" : 12, "ML_MRB2" : 8, "ML_IWEIGHT" : 3, "ML_WTOTEN" : 1.0000E+00, "ML_WTIFOR" : 1.0000E+00, "ML_WTSIF" : 1.0000E+00 }

I try to use the MLFF to run by fast mode ML_MODE=run,
a question is that a C-O bond of a CO2 molecule is elongated and O atom to connect another molecule, which is completely accepted.
I guess the MLFF is not good enough.

I try use the MLFF to run MD in lammps.
I transfer CONTCAR to lammps data. the input of lammps:
units metal
boundary p p p
atom_style atomic
neighbor 1.0 bin

#box tilt large
read_data lammps.data
#read_restart re.0001
#change_box all triclinic

pair_style vasp
pair_coeff * * ML_FF C H N S O F

#minimize 1.0e-8 1.0e-3 100 1000
thermo_style custom step temp pe ke etotal press density vol lx ly lz
thermo ${THERMO_FREQ}
dump 1 all custom ${DUMP_FREQ} traj_1.lammpstrj id element x y z
dump_modify 1 sort id element C H N S O F

# 修改这里,使用新的变量名 "my_restart"
if "${my_restart} == 0" then "velocity all create ${TEMP} 91162"
#fix shakeH all shake 0.0001 20 0 m 1.0
fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P}
#fix integ all nve
timestep 0.0005
run 100000

The partial output looks like:
pair_coeff vasp:
VASP ML force field file = ML_FF
Setting up force field ..... done.
VASP ML force field cutoff = 8.00 Angstrom
Please review the following mapping between LAMMPS and VASP types:

LAMMPS pair_coeff VASP | VASP force field
types names subtypes | types names subtypes
----------------------------------------- | -------------------------------------
1 <---> C <---> 0 | 0 <---> C <---> 0
2 <---> H <---> 1 | 1 <---> H <---> 1
3 <---> N <---> 2 | 2 <---> N <---> 2
4 <---> S <---> 3 | 3 <---> S <---> 3
5 <---> O <---> 4 | 4 <---> O <---> 4
6 <---> F <---> 5 | 5 <---> F <---> 5
15700 505.22182 -1224.4487 13.648755 -1210.7999 1674.0163 1.4761487 3111.3804 14.598818 14.598818 14.598818
15800 546.22062 -1225.557 14.756352 -1210.8006 -1028.1944 1.4761483 3111.3813 14.59882 14.59882 14.59882
15900 533.42156 -1225.2112 14.410581 -1210.8006 5479.2844 1.4761479 3111.3822 14.598821 14.598821 14.598821
16000 508.96702 -1224.55 13.749932 -1210.8001 4619.1342 1.4761474 3111.3832 14.598823 14.598823 14.598823
16100 494.2666 -1224.1516 13.352795 -1210.7988 7819.0835 1.476147 3111.3841 14.598824 14.598824 14.598824
16200 550.16959 -1225.6639 14.863035 -1210.8009 10320.977 1.4761465 3111.3851 14.598826 14.598826 14.598826
16300 618.126 -1227.5001 16.698903 -1210.8012 7140.2058 1.476146 3111.3862 14.598827 14.598827 14.598827
16400 599.40899 -1226.994 16.193256 -1210.8008 3606.5566 1.4761455 3111.3873 14.598829 14.598829 14.598829
16500 636.37172 -1227.9949 17.191818 -1210.8031 11478.587 1.4761449 3111.3884 14.598831 14.598831 14.598831
16600 654.13524 -1228.4758 17.671706 -1210.8041 6251.1666 1.4761444 3111.3897 14.598833 14.598833 14.598833
16700 642.05616 -1228.1485 17.345385 -1210.8031 7369.2303 1.4761437 3111.391 14.598835 14.598835 14.598835
16800 675.87658 -1229.0628 18.259056 -1210.8038 9191.8332 1.4761431 3111.3923 14.598837 14.598837 14.598837
16900 638.93611 -1228.0654 17.261096 -1210.8043 15190.561 1.4761424 3111.3938 14.598839 14.598839 14.598839
17000 693.18466 -1229.5321 18.72664 -1210.8054 6501.5941 1.4761417 3111.3953 14.598842 14.598842 14.598842
17100 665.01746 -1228.7716 17.965693 -1210.8059 5504.4758 1.4761409 3111.3969 14.598844 14.598844 14.598844
17200 721.40911 -1230.297 19.489134 -1210.8079 8959.58 1.4761401 3111.3986 14.598847 14.598847 14.598847
17300 732.77257 -1230.6067 19.796122 -1210.8106 3163.0704 1.4761393 3111.4004 14.59885 14.59885 14.59885
17400 799.1223 -1232.3994 21.588585 -1210.8108 9209.9105 1.4761384 3111.4022 14.598852 14.598852 14.598852
17500 725.92087 -1230.4185 19.611021 -1210.8075 8315.4944 1.4761375 3111.4041 14.598855 14.598855 14.598855
17600 750.55251 -1231.0881 20.276454 -1210.8116 12305.828 1.4761366 3111.406 14.598858 14.598858 14.598858
17700 784.66041 -1232.0129 21.197892 -1210.815 12238.272 1.4761356 3111.408 14.598862 14.598862 14.598862
17800 801.67132 -1232.4723 21.657448 -1210.8148 17981.297 1.4761347 3111.4101 14.598865 14.598865 14.598865
17900 856.8346 -1233.9604 23.147704 -1210.8127 20756.042 1.4761336 3111.4123 14.598868 14.598868 14.598868
18000 841.45634 -1233.5462 22.732255 -1210.8139 9916.2832 1.4761325 3111.4146 14.598872 14.598872 14.598872
18100 827.21255 -1233.1609 22.347453 -1210.8134 12458.282 1.4761313 3111.4171 14.598876 14.598876 14.598876
18200 754.05654 -1231.186 20.371117 -1210.8149 18191.639 1.4761301 3111.4196 14.59888 14.59888 14.59888
18300 784.37084 -1232.0069 21.190069 -1210.8168 8311.4562 1.4761289 3111.4223 14.598884 14.598884 14.598884
18400 872.83865 -1234.3955 23.580059 -1210.8155 10550.698 1.4761276 3111.4251 14.598888 14.598888 14.598888
18500 863.59042 -1234.146 23.330215 -1210.8158 6980.5667 1.4761262 3111.4279 14.598893 14.598893 14.598893
18600 937.9205 -1236.1575 25.33827 -1210.8192 10134.476 1.4761248 3111.4309 14.598897 14.598897 14.598897
18700 923.92954 -1235.7826 24.960299 -1210.8223 6652.9793 1.4761234 3111.4339 14.598902 14.598902 14.598902
18800 876.25692 -1234.4938 23.672405 -1210.8214 8949.3853 1.4761219 3111.4369 14.598907 14.598907 14.598907
18900 937.62486 -1236.1512 25.330283 -1210.821 8591.0753 1.4761204 3111.4401 14.598912 14.598912 14.598912
19000 905.45065 -1235.2838 24.461085 -1210.8227 7808.2088 1.4761189 3111.4434 14.598917 14.598917 14.598917
19100 1028.257 -1238.6033 27.778743 -1210.8246 16214.56 1.4761173 3111.4467 14.598922 14.598922 14.598922
19200 1106.3142 -1240.715 29.887487 -1210.8275 11827.452 1.4761157 3111.4502 14.598927 14.598927 14.598927
the temperatures are increased inordinately, the bonds are broken, which is not completely accepted.

may is thermostate problem, thus I change to langevin thermostat, fix thermostat all langevin ${TEMP} ${TEMP} ${TAU_T} 12345
fix barostat all nph iso ${PRES} ${PRES} ${TAU_P}
fix integ all nve
timestep 0.0005
run 100000

but the similar results were obtained.
Moreover, the run speed is very slow.

I strongly doubt the compatibility of these two codes, I wonder if you guys are testing, e.g. water system?

You do not have the required permissions to view the files attached to this post.

andreas.singraber
Global Moderator
Global Moderator
Posts: 281
Joined: Mon Apr 26, 2021 7:40 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#8 Post by andreas.singraber » Thu Apr 24, 2025 9:45 am

Hello!

I moved the contents of your new topic here because I think this is still the same issue, right?

To be very clear: we cannot help you if you are not willing to share the relevant files!

If we should have a detailed look into your runs we need ALL output files containing relevant information from the MD runs, in particular, the LAMMPS output file log.lammps and the VASP OUTCAR file.

If you want us to check the difference between your VASP and LAMMPS setup ourselves we will need ALL files necessary to start the MD runs for both! I know that you cannot upload the ML_FF here in the forum. But as I already suggested, you could temporarily use a cloud service and provide us with a link to the file. Or, try to attach the zipped ML_AB file instead (even a subset of the ML_AB file can get us started).

Also, please show us some results from your training runs, the ML_LOGFILE should contain the relevant information.

Regarding this comment:

I strongly doubt the compatibility of these two codes, I wonder if you guys are testing, e.g. water system?

Yes, the codes have been tested for their compatibility on a few systems, including water. However, it is clearly stated that the LAMMPS interface is experimental at this stage because it was not yet tested on many systems. Maybe there are still bugs present which did not yet surface in our tests. Hence, it would be even more important that you attach the files you created. Did you check whether energies and forces are consistent between LAMMPS and VASP? This would be proof of your strong doubt, otherwise I would be more careful with such a statement because there could be many other issues leading to the discrepancies.

Also you commented:

Moreover, the run speed is very slow.

So far you have not provided any timings that would show this. From your previous posts I could see that you used 128 cores for VASP and (maybe) 24 for LAMMPS. At least 128 cores is way too much for a 210-atom system. Please always perform proper scaling tests before starting actual production runs.

I found another issue when looking through your files: In VASP it seems you have used a hydrogen mass of 8 au for the MD run. Did you also perform training with this setup? Then in LAMMPS you used 1 au and decreased the time step from 1 fs to 0.1/0.5 fs. How do you justify this difference, in particular, if you want to test whether both codes give the same result?

Andreas Singraber


suojiang_zhang1
Jr. Member
Jr. Member
Posts: 73
Joined: Tue Nov 19, 2019 4:15 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#9 Post by suojiang_zhang1 » Thu Apr 24, 2025 10:43 am

Dear,thank you for your explanation.
In the poster, I am not going to talk the different structures from vasp run and lammps run, my concern is that I can not get a stable structures in a little long running time that is beyond the training time using MLFF? that is how to increase the robust of MLFF as the classic FF?

Moreover, the MLFF is larger size near GB, that lead to the slow run/
yours


andreas.singraber
Global Moderator
Global Moderator
Posts: 281
Joined: Mon Apr 26, 2021 7:40 am

Re: Inconsistent structures from vasp and lammps trajectory using MLFF

#10 Post by andreas.singraber » Thu Apr 24, 2025 12:31 pm

Hello!

If I understand you correctly, then you are now saying that even the VASP MD run does not give you satisfactory results after running for a long time? Then, as you suggested, the force field is probably not as robust as intended. As before, also this issue we cannot discuss further without the detailed information from your output files!!! I already asked in my last post and I am now asking once again: please provide the output files (at least OUTCAR, ML_LOGFILE) for all training steps!

Andreas Singraber


Post Reply