Page 1 of 1

Simulating 1D ribbon with MLFF

Posted: Wed Aug 23, 2023 4:27 pm
by bo_peng
Dear Developers,

I am using MLFF for 1D ribbon structures in a 3D box (with periodicity along x), but while training the MLFF, the 1D ribbon keeps rotating and moving in the 3D box wildly. The out-of-plane direction for the ribbon was along z, but after the training, I got out-of-direction along y or any directions between y and z directions. I wonder in that case, whether the trained ML_FFN can still be useful, given that the atomic positions keep changing. Thank you in advance!

Best wishes,
Bo

Re: Simulating 1D ribbon with MLFF

Posted: Thu Aug 24, 2023 8:01 am
by manuel_engel1
Hi,

I will forward this question to an expert on MLFF. In the meantime, could you please provide all relevant input and output files as per our forum posting guidelines? This additional information will help us better understand the situation.

Re: Simulating 1D ribbon with MLFF

Posted: Thu Aug 24, 2023 10:22 am
by bo_peng
Yes, please find the input below! I would like to mention that the same issue is observed for 2D materials as well, and the monolayer just move along the z direction wildly in the 3D box, despite that I have used the dipole correction...

INCAR

Code: Select all

SYSTEM = 2D.qTP
ISYM   = 0        ! no symmetry imposed

NCORE = 2
KPAR = 1
NBANDS = 304

! ab initio
PREC   = Accurate

ISMEAR = 0      ! Gaussian smearing

ENCUT  = 800
EDIFF  = 1e-6

ALGO = Conjugated

LCHARG = F

LREAL  = A

GGA = PS

! MD
IBRION = 0        ! MD (treat ionic degrees of freedom)
NSW    = 100000    ! no of ionic steps
POTIM  = 2.0      ! MD time step in fs
SMASS  = -1

MDALGO = 3                ! Langevin thermostat
LANGEVIN_GAMMA   = 1 1      ! friction
LANGEVIN_GAMMA_L = 10     ! lattice friction
PMASS  = 10               ! lattice mass
TEBEG  = 250              ! temperature
TEEND  = 500

ISIF   = 3        ! update positions, cell shape and volume
LATTICE_CONSTRAINTS = .TRUE. .FALSE. .FALSE.

! machine learning
ML_LMLFF  = T
ML_ISTART = 0
ML_CX = -0.2
POSCAR

Code: Select all

generated by phonopy                    
   1.00000000000000     
    22.2852991646648348    0.0000000000000000    0.0000000000000000
     0.0000000000000000   38.4656342773947628    0.0000000000000000
     0.0000000000000000    0.0000000000000000   22.0054996618738130
   C    H 
   108    30
Direct
  0.0553876693330893  0.5368018786963373  0.5025326996209248
  0.0550100556989993  0.5737131658479104  0.5026185052086746
  0.0550100556989993  0.4262868341520896  0.5026185052086746
  0.0553876693330893  0.4631981213036628  0.5025326996209248
  0.1110541590090572  0.5184258877501028  0.5021483365059730
  0.1110541590090572  0.4815741122498973  0.5021483365059730
  0.1663218694199344  0.4630883260518496  0.5016140929966839
  0.2213530481943471  0.4814939593715987  0.5011163305517213
  0.1663218694199344  0.5369116739481503  0.5016140929966839
  0.1663536015371725  0.5741610228600570  0.5015719647641377
  0.1663536015371725  0.4258389771399428  0.5015719647641377
  0.2217936388200226  0.5927770932316144  0.5008999176546429
  0.2217973329255117  0.6295838628451186  0.5006802392218520
  0.1662824665792954  0.6469465569009828  0.5015368801861264
  0.1129754207965508  0.6290518921974417  0.5023633577390254
  0.1112809144650732  0.5925193768104137  0.5022262268226106
  0.1112809144650732  0.4074806231895863  0.5022262268226106
  0.1129754207965508  0.3709481078025583  0.5023633577390254
  0.1662824665792954  0.3530534430990173  0.5015368801861264
  0.2217973329255117  0.3704161371548814  0.5006802392218520
  0.2217936388200226  0.4072229067683856  0.5008999176546429
  0.2778685755802225  0.6485926856399651  0.4997350184433151
  0.2778685755802225  0.3514073143600350  0.4997350184433151
  0.3330600555663611  0.6300122297217935  0.4995843296315740
  0.3883464219334684  0.6486013521854125  0.4988548151876803
  0.3869554900420372  0.6849291184076975  0.4981284486437110
  0.3329680210768693  0.7029774603829371  0.4981750188618222
  0.2791039891533936  0.6850632085228969  0.4989682593928589
  0.2791039891533936  0.3149367914771030  0.4989682593928589
  0.3329680210768693  0.2970225396170630  0.4981750188618222
  0.3869554900420372  0.3150708815922953  0.4981284486437110
  0.3883464219334684  0.3513986478145875  0.4988548151876803
  0.3330600555663611  0.3699877702782066  0.4995843296315740
  0.3321840510363901  0.5188890619762666  0.5004336313026561
  0.2769534448172535  0.5372146289292862  0.5006806539548609
  0.2774912514064802  0.5741647655341956  0.5005299605661505
  0.3327218499136540  0.5927160601116496  0.5000831059407853
  0.3877087261292015  0.5739736485852869  0.5000342407046823
  0.3855451616322291  0.5378371238317109  0.5002037393004672
  0.2213530481943471  0.5185060406284012  0.5011163305517213
  0.4447180904980705  0.5926366854887490  0.4997054870145453
  0.5000000000000000  0.5754841675610175  0.5001446740352703
  0.5552819095019297  0.5926366854887490  0.4997054870145453
  0.5551520451681510  0.6295468269511317  0.4989949048679201
  0.5000000000000000  0.6466725774220151  0.4986952174622910
  0.4448479548318491  0.6295468269511317  0.4989949048679201
  0.6678159489636099  0.5188890619762666  0.5004336313026561
  0.7230465551827465  0.5372146289292862  0.5006806539548609
  0.7225087485935199  0.5741647655341956  0.5005299605661505
  0.6672781500863461  0.5927160601116496  0.5000831059407853
  0.6122912738707983  0.5739736485852869  0.5000342407046823
  0.6144548383677709  0.5378371238317109  0.5002037393004672
  0.7786469518056529  0.5185060406284012  0.5011163305517213
  0.3321840510363901  0.4811109380237333  0.5004336313026561
  0.6678159489636099  0.4811109380237333  0.5004336313026561
  0.2769534448172535  0.4627853710707139  0.5006806539548609
  0.2774912514064802  0.4258352344658043  0.5005299605661505
  0.3327218499136540  0.4072839398883504  0.5000831059407853
  0.3877087261292015  0.4260263514147132  0.5000342407046823
  0.3855451616322291  0.4621628761682890  0.5002037393004672
  0.6144548383677709  0.4621628761682890  0.5002037393004672
  0.6122912738707983  0.4260263514147132  0.5000342407046823
  0.6672781500863461  0.4072839398883504  0.5000831059407853
  0.7225087485935199  0.4258352344658043  0.5005299605661505
  0.7230465551827465  0.4627853710707139  0.5006806539548609
  0.4447180904980705  0.4073633145112509  0.4997054870145453
  0.5552819095019297  0.4073633145112509  0.4997054870145453
  0.4448479548318491  0.3704531730488684  0.4989949048679201
  0.5000000000000000  0.3533274225779847  0.4986952174622910
  0.5551520451681510  0.3704531730488684  0.4989949048679201
  0.5000000000000000  0.4245158324389824  0.5001446740352703
  0.7786469518056529  0.4814939593715987  0.5011163305517213
  0.8336781305800656  0.4630883260518496  0.5016140929966839
  0.8889458409909429  0.4815741122498973  0.5021483365059730
  0.8889458409909429  0.5184258877501028  0.5021483365059730
  0.8336781305800656  0.5369116739481503  0.5016140929966839
  0.8336463984628274  0.5741610228600570  0.5015719647641377
  0.8336463984628274  0.4258389771399428  0.5015719647641377
  0.9446123306669107  0.5368018786963373  0.5025326996209248
  0.9446123306669107  0.4631981213036628  0.5025326996209248
 -0.0000000000000000  0.5185419517325796  0.5026240961078807
 -0.0000000000000000  0.5909420191424343  0.5027764319295634
  0.9449899443010007  0.5737131658479104  0.5026185052086746
  0.9449899443010007  0.4262868341520896  0.5026185052086746
 -0.0000000000000000  0.4090579808575658  0.5027764319295634
 -0.0000000000000000  0.4814580482674204  0.5026240961078807
  0.8887190855349267  0.5925193768104137  0.5022262268226106
  0.8870245792034492  0.6290518921974417  0.5023633577390254
  0.8337175334207045  0.6469465569009828  0.5015368801861264
  0.7782026670744885  0.6295838628451186  0.5006802392218520
  0.7782063611799773  0.5927770932316144  0.5008999176546429
  0.7782063611799773  0.4072229067683856  0.5008999176546429
  0.7782026670744885  0.3704161371548814  0.5006802392218520
  0.8337175334207045  0.3530534430990173  0.5015368801861264
  0.8870245792034492  0.3709481078025583  0.5023633577390254
  0.8887190855349267  0.4074806231895863  0.5022262268226106
  0.7221314244197775  0.6485926856399651  0.4997350184433151
  0.7221314244197775  0.3514073143600350  0.4997350184433151
  0.7208960108466063  0.6850632085228969  0.4989682593928589
  0.6670319789231307  0.7029774603829371  0.4981750188618222
  0.6130445099579627  0.6849291184076975  0.4981284486437110
  0.6116535780665316  0.6486013521854125  0.4988548151876803
  0.6669399444336389  0.6300122297217935  0.4995843296315740
  0.6669399444336389  0.3699877702782066  0.4995843296315740
  0.6116535780665316  0.3513986478145875  0.4988548151876803
  0.6130445099579627  0.3150708815922953  0.4981284486437110
  0.6670319789231307  0.2970225396170630  0.4981750188618222
  0.7208960108466063  0.3149367914771030  0.4989682593928589
 -0.0000000000000000  0.6192695759127388  0.5027571753527774
 -0.0000000000000000  0.3807304240872612  0.5027571753527774
  0.6669326592599256  0.7314092216139496  0.4976034875458504
  0.7627234501536936  0.6998376238369814  0.4989034956979885
  0.5712614009663961  0.6997566946662245  0.4974828175702425
  0.5000000000000000  0.6750095889887265  0.4983389886845797
  0.4287385990335898  0.6997566946662245  0.4974828175702425
  0.3330673407400744  0.7314092216139496  0.4976034875458504
  0.2372765498463062  0.6998376238369814  0.4989034956979885
  0.1648284580338321  0.6753148827980978  0.5016482691002409
  0.0712874463199085  0.6439615840156162  0.5031568105053595
  0.8351715419661678  0.6753148827980978  0.5016482691002409
  0.9287125536800915  0.6439615840156162  0.5031568105053595
  0.6669326592599256  0.2685907783860502  0.4976034875458504
  0.7627234501536936  0.3001623761630186  0.4989034956979885
  0.8351715419661678  0.3246851172019021  0.5016482691002409
  0.9287125536800915  0.3560384159843838  0.5031568105053595
  0.5000000000000000  0.3249904110112664  0.4983389886845797
  0.5712614009663961  0.3002433053337754  0.4974828175702425
  0.4287385990335898  0.3002433053337754  0.4974828175702425
  0.3330673407400744  0.2685907783860502  0.4976034875458504
  0.2372765498463062  0.3001623761630186  0.4989034956979885
  0.1648284580338321  0.3246851172019021  0.5016482691002409
  0.0712874463199085  0.3560384159843838  0.5031568105053595
  0.5000000000000000  0.5471270048742345  0.5010750572121647
  0.4278516679678193  0.5236145053273772  0.5000793214631470
  0.4278516679678193  0.4763854946726229  0.5000793214631470
  0.5000000000000000  0.4528729951257655  0.5010750572121647
  0.5721483320321807  0.4763854946726229  0.5000793214631470
  0.5721483320321807  0.5236145053273772  0.5000793214631470

Re: Simulating 1D ribbon with MLFF

Posted: Mon Aug 28, 2023 7:55 am
by ferenc_karsai
You have hydrogens in your system and POTIM=2.0, which is a way too large time step if the Hydrogen mass is unchanged. You didn't upload your POTCAR file, so I don't know if you changed POMASS of Hydrogen in that file. If not than this is most likely your problem.


Solutions:
Set POMASS in the INCAR file (wiki/index.php/POMASS). The mass of C has to be set to the value from the POTCAR file (one needs to set a value for all species using this tag) but the value of Hydrogen can be increased by up to a factor of 8-10.
Also maybe decrease the timestep to POTIM=1.0 or 1.5 to be on the safe side.

Re: Simulating 1D ribbon with MLFF

Posted: Wed Aug 30, 2023 10:25 am
by bo_peng
Dear Ferenc,

Thank you for the clarification!

Indeed I did not change anything in POTCAR. But after changing POTIM and POMASS, the ribbon is no longer rotating - this is brilliant! But unfortunately the calculations become much slower than before it seems. Do you know whether I could accelerate the calculations?

I also have similar problem for a 2D monolayer, with the monolayer moving up and down in the 3D box. The monolayer only has carbon atoms. The INCAR is the same with my previous attached one. Do you think it is possible to reduce POTIM and solve such issue as well?

Best wishes,
Bo

Re: Simulating 1D ribbon with MLFF

Posted: Tue Sep 05, 2023 9:46 am
by ferenc_karsai
1) I think the calculation times you saw were garbage, since the system was messed up. But I don't know what you mean by slow, but it is important that you use the fast version of the machine learning force fields. That means you refit with ML_MODE=REFIT and run with ML_MODE=RUN afterwards. Please see the best practice page: wiki/index.php/Construction:Best_practi ... rce_fields.

2) If it's H then you have the same problem, as soon as one has H the timestep needs to be decreased to small POTIM arou 0.25 or the mass needs to be increased. Otherwise you can still have too large time steps (reduce POTIM).