Dear developer
if use the trained MLFF to preform the MD simluation in lammps, how to converse the CONTCAR or POSCAR to lammps data?or create a proper data file to run the lammps?
How to converse the vasp CONTCAR or POSCAR to the lammps data?
Moderators: Global Moderator, Moderator
-
- Jr. Member
- Posts: 64
- Joined: Tue Nov 19, 2019 4:15 am
How to converse the vasp CONTCAR or POSCAR to the lammps data?
-
- Global Moderator
- Posts: 594
- Joined: Fri Nov 08, 2019 7:18 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
That is a feature we recently added to py4vasp. If you are willing to work with the development version you can clone py4vasp from its Github repository. Then
Code: Select all
import py4vasp
py4vasp.calculation.structure.to_lammps()
should convert the final structure to a lammps string.
It also provides a command line interface
Code: Select all
py4vasp convert structure lammps
which does the same thing.
Martin Schlipf
VASP developer
-
- Jr. Member
- Posts: 64
- Joined: Tue Nov 19, 2019 4:15 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
thank you for the prompt reply.
I presumed I got the proper MLFF and the data of lammps by the py4vasp as mentioned above.
could you give me an exmple input, lammps.inp? if I want to calculate the extended system using the MLFF, how I set the lammps.inp? or using "replicate" to extend the cell?
Yours.
-
- Global Moderator
- Posts: 594
- Joined: Fri Nov 08, 2019 7:18 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
Do you need an example input to actually run LAMMPS? This will depend strongly on the simulation you want to run. We can not provide general advice here, please consider the LAMMPS manual.
If you wonder only about the structure part about the input file, here is the result of the py4vasp script above on a benzene molecule in a box
Code: Select all
Configuration 1: system "C6H6"
12 atoms
2 atom types
0.0 8.0000000000000000E+00 xlo xhi
0.0 8.0000000000000000E+00 ylo yhi
0.0 8.0000000000000000E+00 zlo zhi
0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 xy xz yz
Atoms # atomic
1 1 4.0000000000000000E+00 4.0000000000000000E+00 5.3975059620000252E+00
2 1 4.0000000000000000E+00 5.2102925959999880E+00 4.6987187099999801E+00
3 1 4.0000000000000000E+00 5.2102925959999880E+00 3.3012812900000199E+00
4 1 4.0000000000000000E+00 4.0000000000000000E+00 2.6024940379999748E+00
5 1 4.0000000000000000E+00 2.7897074040000120E+00 3.3012812900000199E+00
6 1 4.0000000000000000E+00 2.7897074040000120E+00 4.6987187099999801E+00
7 2 4.0000000000000000E+00 4.0000000000000000E+00 6.4896791740000026E+00
8 2 4.0000000000000000E+00 6.1560307519999924E+00 5.2447775840000190E+00
9 2 4.0000000000000000E+00 6.1560307519999924E+00 2.7552224159999810E+00
10 2 4.0000000000000000E+00 4.0000000000000000E+00 1.5103208259999974E+00
11 2 4.0000000000000000E+00 1.8439692480000076E+00 2.7552224159999810E+00
12 2 4.0000000000000000E+00 1.8439692480000076E+00 5.2447775840000190E+00
For comparison, here is the corresponding POSCAR file
Code: Select all
C6H6
1.0000000000000000
8.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 8.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 8.0000000000000000
C H
6 6
Direct
0.5000000000000000 0.5000000000000000 0.6746882452500031
0.5000000000000000 0.6512865744999985 0.5873398387499975
0.5000000000000000 0.6512865744999985 0.4126601612500025
0.5000000000000000 0.5000000000000000 0.3253117547499969
0.5000000000000000 0.3487134255000015 0.4126601612500025
0.5000000000000000 0.3487134255000015 0.5873398387499975
0.5000000000000000 0.5000000000000000 0.8112098967500003
0.5000000000000000 0.7695038439999990 0.6555971980000024
0.5000000000000000 0.7695038439999990 0.3444028019999976
0.5000000000000000 0.5000000000000000 0.1887901032499997
0.5000000000000000 0.2304961560000010 0.3444028019999976
0.5000000000000000 0.2304961560000010 0.6555971980000024
Martin Schlipf
VASP developer
-
- Jr. Member
- Posts: 64
- Joined: Tue Nov 19, 2019 4:15 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
thank you
I can converse the POSCAR into the lammps data by a inhouse python script as shown above.
I used "read_data lammps_data" to read the structure to run the MD simulation. My lammps.inp looks like:
variable NSTEPS equal 1000000
variable THERMO_FREQ equal 100
variable DUMP_FREQ equal 1000
variable TEMP equal 300.000000
variable PRES equal 1.000000
variable TAU_T equal 0.100000
variable TAU_P equal 1.000000
variable my_restart equal 0
units metal
boundary p p p
atom_style atomic
neighbor 1.0 bin
box tilt large
read_data data.lammps
#read_restart re.0001
change_box all triclinic
replicate 2 2 2
mass 1 12.000000
mass 2 8.000000
mass 3 14.000000
mass 4 32.000000
mass 5 16.000000
mass 6 19.00000
pair_style vasp
pair_coeff * * ML_FF C H N S O F
thermo_style custom step temp pe ke etotal press density vol lx ly lz
thermo ${THERMO_FREQ}
dump 1 all xyz ${DUMP_FREQ} traj_2.xyz
dump_modify 1 sort id element C H N S O F
if "${my_restart} == 0" then "velocity all create ${TEMP} 91162"
fix 1 all npt temp ${TEMP} ${TEMP} ${TAU_T} iso ${PRES} ${PRES} ${TAU_P}
timestep 0.0005000
run ${NSTEPS}
write_restart re.0002
write_data data.002
After I checked the trajectory with xyz format, I found some bonds broken and the system is unstable. I also checked the CONTCAR in training process, the structure is good, not bonds broken.
My system is 6ionic liquid+2CO2, the INCAR looks like:
SYSTEM = IL_liquid
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 10.0
LANGEVIN_GAMMA_L = 10.0
NSW = 10000
POTIM = 1
ISIF = 3
TEBEG = 300
TEEND = 500
PSTRESS = 0.001
PMASS=100
POMASS= 12 8 14 32 16 19
RANDOM_SEED = 486686595 0 0
### Output
LWAVE = .FALSE.
LCHARG = .FALSE.
#NBLOCK = 10
#KBLOCK = 10
##############################
### MACHINE-LEARNING ###
################################
ML_LMLFF = .T.
ML_MODE=train
ML_DESC_TYPE = 1
#ML_ISTART = 1
#ML_OUTBLOCK=1000
#ML_OUTPUT_MODE=0
-
- Global Moderator
- Posts: 594
- Joined: Fri Nov 08, 2019 7:18 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
You could investigate whether the issue is with the force field or the LAMMPS setup by running a VASP run with ML_MODE = run. If VASP runs fine in that mode without any bond breaking, the issue should be on the LAMMPS side.
Martin Schlipf
VASP developer
-
- Jr. Member
- Posts: 64
- Joined: Tue Nov 19, 2019 4:15 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
thank you
I checked the structure via ML_MODE=run, and found the structure is good and any bond has not been broken.
but I really donot know what is problem in my lammps.inp
My POSCAR :
COF-SO3H
1.00000000000000
22.5559997559000003 0.0000000000000000 0.0000000000000000
-11.2779998778999992 19.5340687963000015 0.0000000000000000
0.0000000000000000 0.0000000000000000 10.0000000000000000
O N C H S
15 6 36 24 3
Direct
0.3075334895733922 0.5327006038878351 0.6221906763012598
0.4697968013444933 0.7592961568436649 0.4939034789608253
0.2424103481237379 0.6986252458771727 0.6184546518784099
0.7397925351702168 0.4694439658667221 0.4670639491483874
0.5297497313974359 0.2593426497936132 0.5460616494074891
0.7436001801043319 0.2633113222673197 0.5083544278802004
0.4444215362862436 0.3923782507836667 0.7735366073407755
0.5544100983422188 0.3872802011930578 0.7416567211031598
0.4487001725416816 0.3138293120704331 0.6211002083396048
0.6720583223958199 0.0287789153628117 0.4990861588173974
0.6794038437432286 0.1116769730761418 0.6710869097456788
0.6774625956627955 0.1379543522067414 0.4416813049971720
0.9474200914799867 0.5768858050790669 0.7449381237720208
0.8508836868383123 0.4578305407581880 0.7279304815041929
0.8742876742994137 0.5561220641206407 0.5636579458077124
0.4330739195983520 0.5593969966566793 0.5018354828848193
0.4373807069530339 0.8561806769014788 0.5544972137049136
0.1441867153003703 0.5620946270103397 0.6005992472191228
0.6146568395719045 0.4607024841628381 0.4762848105970955
0.5411468257208008 0.1387352189015097 0.5844584535460550
0.8607347754862945 0.3817712204086114 0.4855097758712943
0.3225313762075245 0.5901257482695496 0.5767937507707049
0.4110453843836199 0.7151340978032956 0.5293462539375849
0.2862324301867694 0.6793270973417924 0.5762006332278671
0.7086722692212579 0.4056166327029115 0.4869452881481059
0.5954361932199009 0.2883512256852869 0.5281227637797336
0.7095183610596136 0.2941776002754760 0.5106119391224445
0.3910700033123874 0.6397987162921981 0.5355480833792167
0.3567105354800459 0.7320654875997383 0.5489356550460759
0.2649100399025484 0.6085364539625742 0.5768695060157633
0.6320576237321530 0.3622241841672555 0.5073070212343314
0.6359293986744292 0.2532312788473330 0.5440713863175902
0.7440410181545237 0.3668819309186935 0.4912161307177392
0.4410248706630659 0.6233736989690337 0.4967167730353525
0.3742780285664427 0.8005303594746795 0.5556031328139175
0.2005584747780035 0.5546612258308320 0.5960446969547355
0.5943558992534111 0.3936231354682196 0.4966781424587623
0.6057868294755452 0.1843274279038552 0.5873137142498737
0.8153387901181567 0.4055036458916503 0.4742786471379616
0.4817219564045412 0.5396849690284065 0.4879934328929875
0.4572599977918619 0.9237548134278325 0.5575471434173616
0.0731832091450572 0.5170386604150485 0.5716823373702347
0.5725562341825748 0.4894517691741350 0.4843764099773325
0.5168380089269605 0.0664287519847207 0.5800750672608685
0.9342451165281740 0.4324451622828811 0.5018122783997627
0.4686062266688498 0.4822942996591481 0.5646771072827879
0.5271186376134213 0.9673639438776800 0.5473820392925779
0.0279069219698573 0.5390542284678587 0.6020617943342029
0.5872341983025623 0.5488240938730043 0.4153573399076758
0.4469310964963057 0.0228379106145564 0.5884638278297283
0.9813718301552424 0.4098795302750438 0.4683390622703120
0.5415340432648341 0.5750288527894891 0.4037509732719040
0.4114253196502178 0.9495357258159000 0.5678301815758090
0.0512373530257759 0.4540551553813170 0.5048840700933025
0.5143592566225920 0.4568184124371290 0.5708995658918693
0.5616070692751954 0.0379447928292954 0.5488176996839281
0.9581403765685005 0.4948989188970277 0.5735099049379900
0.4310257305223695 0.4618117644967019 0.6444954494250900
0.5582786385323159 0.9447017798336204 0.5432235599689748
0.0397973668390630 0.5877171532282964 0.6428537049927194
0.6306684767793974 0.5673592622073382 0.3554092470754684
0.4127170095854256 0.0460174467932061 0.5786115979719559
0.9704686142292167 0.3613981388170360 0.4303426414549956
0.4933518524475346 0.6645620510441103 0.4698614576602659
0.3296515859465327 0.8036377227275945 0.5916529184115462
0.1883937274491654 0.5002177574394643 0.5956870101663069
0.5372984138720720 0.3625411758838048 0.4961370146158027
0.6409486153663164 0.1661998307603408 0.6148915145381282
0.8394598975167838 0.4607950252229971 0.4349606602805077
0.5596685750614788 0.6169298402436812 0.3319136259489098
0.3558741762247493 0.9193889821708249 0.5870996640915175
0.0889924014929144 0.4356094732040542 0.4838312506496488
0.3880462650948776 0.5286926574465820 0.5510095613454682
0.4762823924217083 0.8482496700347866 0.5206163372877062
0.1599710513196097 0.6157409974589200 0.5898681715922484
0.6600315615392462 0.4912979496616460 0.4394641218649529
0.5096360855120106 0.1594055205565676 0.5689363331962051
0.8418405871492877 0.3315357432478853 0.5024971318114367
0.4788888817292472 0.2956209864199841 0.5898661808854332
0.7190941654674250 0.2105241420919623 0.4761915409010229
0.8278120291288621 0.5259755901148743 0.5433841959422356
0.4927111622789352 0.3886244685284126 0.6932647981835812
0.6562913595332308 0.0806401176663472 0.5393486484956489
0.9040212071639346 0.5216833757468382 0.6612640557046051
my data of lammps:
# LAMMPS data file converted from POSCAR
84 atoms
5 atom types
0.0 22.5559997559 xlo xhi
0.0 19.5340687963 ylo yhi
0.0 10.0 zlo zhi
-11.2779998779 0.0 0.0 xy xz yz
Atoms
1 1 0.619580 11.527557 5.767938
2 1 1.206257 13.969479 5.293463
3 1 -1.205192 13.270022 5.762006
4 1 11.410267 7.923343 4.869453
5 1 10.178634 5.632673 5.281228
6 1 12.686161 5.746485 5.106119
7 1 1.605325 12.497872 5.355481
8 1 -0.210272 14.300218 5.489357
9 1 -0.887763 11.887193 5.768695
10 1 10.171527 7.075712 5.073070
11 1 11.488081 4.946637 5.440714
12 1 12.644895 7.166697 4.912161
13 1 2.917348 12.177025 4.967168
14 1 -0.586166 15.637615 5.556031
15 1 -1.731672 10.834791 5.960447
16 1 8.967010 7.689061 4.966781
17 1 11.585283 3.600665 5.873137
18 1 13.817511 7.921136 4.742786
19 1 4.779153 10.542243 4.879934
20 1 -0.104150 18.044690 5.575471
21 1 -4.180442 10.099869 5.716823
22 1 7.394541 9.560985 4.843764
23 1 10.908615 1.297624 5.800751
24 1 16.195716 8.447414 5.018123
25 1 5.130567 9.421170 5.646771
26 1 0.979757 18.896554 5.473820
27 1 -5.449985 10.529922 6.020618
28 1 7.056016 10.720768 4.153573
29 1 9.823412 0.446117 5.884638
30 1 17.513201 8.006615 4.683391
31 1 5.729666 11.232653 4.037510
32 1 -1.428754 18.548296 5.678302
33 1 -3.965124 8.869545 5.048841
34 1 6.449889 8.923522 5.708996
35 1 12.239668 0.741216 5.488177
36 1 16.030344 9.667390 5.735099
37 2 4.513903 9.021063 6.444954
38 2 1.938186 18.453870 5.432236
39 2 -5.730605 11.480507 6.428537
40 2 7.826680 11.082835 3.554092
41 2 8.790260 0.898908 5.786116
42 2 17.814042 7.059576 4.303426
43 2 3.633114 12.981601 4.698615
44 2 -1.627805 15.698315 5.916529
45 2 -1.392047 9.771288 5.956870
46 2 8.030564 7.081904 4.961370
47 2 12.582835 3.246559 6.148915
48 2 13.738011 9.001202 4.349607
49 2 5.666150 12.051150 3.319136
50 2 -2.341771 17.959408 5.870997
51 2 -2.905491 8.509225 4.838313
52 2 2.790176 10.327519 5.510096
53 2 1.176466 16.569767 5.206163
54 2 -3.336020 12.027927 5.898682
55 2 9.346814 9.597048 4.394641
56 2 9.697576 3.113838 5.689363
57 2 15.249496 6.476242 5.024971
58 2 7.467804 5.774681 5.898662
59 2 13.845597 4.112393 4.761915
60 2 12.740175 10.274443 5.433842
61 3 3.459536 10.927299 5.018355
62 3 0.209554 16.724692 5.544972
63 3 -3.087028 10.979995 6.005992
64 3 8.668397 8.999394 4.762848
65 3 10.641452 2.710063 5.844585
66 3 15.109118 7.457545 4.855098
67 4 6.730686 7.591417 6.932648
68 4 13.893849 1.575230 5.393486
69 4 14.507557 10.190599 6.612641
70 5 0.928928 10.405810 6.221907
71 5 2.033395 14.832143 4.939035
72 5 -2.411288 13.646994 6.184547
73 5 11.392371 9.170151 4.670639
74 5 9.024168 5.066017 5.460616
75 5 13.803020 5.143541 5.083544
76 5 5.599130 7.664744 7.735366
77 5 8.137528 7.565158 7.416567
78 5 6.581514 6.130363 6.211002
79 5 14.834379 0.562169 4.990862
80 5 14.065140 2.181506 6.710869
81 5 13.724997 2.694810 4.416813
82 5 14.863889 11.268927 7.449381
83 5 14.029119 8.943293 7.279305
84 5 13.448488 10.863327 5.636579
-
- Global Moderator
- Posts: 594
- Joined: Fri Nov 08, 2019 7:18 am
Re: How to converse the vasp CONTCAR or POSCAR to the lammps data?
Sorry, I cannot really help with the LAMMPS input. Perhaps visualizing the structure can help to see if there are any obvious flaws. Otherwise you can ask the LAMMPS developers, they should know their software better than we.
Martin Schlipf
VASP developer