|
| 1 | +# Script originally made by Oscar Guerrero |
| 2 | +# Reference: https://orca.cardiff.ac.uk/id/eprint/101322/1/MRSPaper2.pdf |
| 3 | +units metal |
| 4 | +atom_style atomic |
| 5 | +boundary p p p |
| 6 | + |
| 7 | +atom_modify map array |
| 8 | + |
| 9 | +#define variables |
| 10 | + |
| 11 | +variable tempstart equal $tempstart |
| 12 | +variable tempstop equal $tempstop |
| 13 | +variable myseed equal 12345 |
| 14 | +variable atomrate equal 1000 |
| 15 | +variable time_step equal 0.002 |
| 16 | +variable time_eq equal 1000 |
| 17 | +#variable tdamp equal 1. |
| 18 | + |
| 19 | +variable tamp equal "v_time_step*1000" # DO NOT CHANGE |
| 20 | +variable pdamp equal "v_time_step*1000" # DO NOT CHANGE |
| 21 | +timestep ${time_step} # DO NOT CHANGE |
| 22 | + |
| 23 | + |
| 24 | +#Create structure |
| 25 | +read_data data.dump |
| 26 | + |
| 27 | + |
| 28 | +#Define Interatomic Potential |
| 29 | + |
| 30 | +pair_style m3gnet /global/home/users/huizheng/repos/lammps/potentials/M3GNET |
| 31 | +pair_coeff * * MP-2021.2.8-EFS $species |
| 32 | + |
| 33 | +# Equilibration |
| 34 | +reset_timestep 0 |
| 35 | +velocity all create ${tempstart} ${myseed} mom yes rot no dist gaussian |
| 36 | +fix equilibration all npt temp ${tempstart} ${tempstart} $(100.0*dt) iso 1 1 ${pdamp} drag 0.2 |
| 37 | + |
| 38 | + |
| 39 | +variable eq1 equal "step" |
| 40 | +variable eq2 equal "pxx" |
| 41 | +variable eq3 equal "pyy" |
| 42 | +variable eq4 equal "pzz" |
| 43 | +variable eq5 equal "lx" |
| 44 | +variable eq6 equal "ly" |
| 45 | +variable eq7 equal "lz" |
| 46 | +variable eq8 equal "vol" |
| 47 | +variable eq9 equal "temp" |
| 48 | +variable eq10 equal "etotal" |
| 49 | + |
| 50 | +fix data_equilibration all print 10 "${eq1} ${eq2} ${eq3} ${eq4} ${eq5} ${eq6} ${eq7} ${eq8} ${eq9} ${eq10}" file ${tempstart}K.data |
| 51 | +thermo 1000 |
| 52 | +thermo_style custom step pxx pyy pzz lx ly lz temp etotal |
| 53 | + |
| 54 | +# RUN |
| 55 | +run 1000 |
| 56 | + |
| 57 | +# store final volume Vo to calculate V/Vo (reduce units) |
| 58 | +variable tmp equal "vol" |
| 59 | +variable Vo equal ${tmp} |
| 60 | +print "Volume initial is , Vo: ${Vo}" |
| 61 | + |
| 62 | +#reset |
| 63 | +unfix equilibration |
| 64 | +unfix data_equilibration |
| 65 | + |
| 66 | +#----------------------------- Increase temperature------------------------------------ |
| 67 | +reset_timestep 0 |
| 68 | +fix melting all npt temp ${tempstart} ${tempstop} $(100.0*dt) iso 1 1 ${pdamp} drag 0.2 |
| 69 | +# fix melting all nvt temp ${tempstart} ${tempstop} ${tdamp} drag 0.2 |
| 70 | + |
| 71 | +variable eq1 equal "step" |
| 72 | +variable eq2 equal "pxx" |
| 73 | +variable eq3 equal "pyy" |
| 74 | +variable eq4 equal "pzz" |
| 75 | +variable eq5 equal "lx" |
| 76 | +variable eq6 equal "ly" |
| 77 | +variable eq7 equal "lz" |
| 78 | +variable eq8 equal "temp" |
| 79 | +variable eq9 equal "vol/v_Vo" |
| 80 | +variable eq10 equal "etotal" |
| 81 | +run 0 |
| 82 | +fix data_melting all print $print_every_n_step "${eq8} ${eq9}" file temp_vs_ref_vol.txt screen no |
| 83 | + |
| 84 | +dump 1 all cfg 100 HgF2.step*.cfg mass type xs ys zs id |
| 85 | +dump_modify 1 element $species |
| 86 | +dump 2 all custom 100 dump.* id type x y z |
| 87 | +# Compute msd command and dump every 10 steps |
| 88 | +compute msd all msd com yes |
| 89 | +fix msd all ave/time 1 1 10 c_msd[4] file msd.txt |
| 90 | + |
| 91 | + |
| 92 | +# use velocity auto-correlation function (VACF) to calculate diffusion coefficient |
| 93 | +compute 2 all vacf |
| 94 | +fix 5 all vector 1 c_2[4] |
| 95 | +variable diff equal dt*trap(f_5) |
| 96 | +fix vacf all print 1 "${eq1} ${eq8} ${eq9} ${diff}" |
| 97 | + |
| 98 | +run $total_steps |
| 99 | +thermo $print_every_n_step |
| 100 | +thermo_style custom step v_diff |
| 101 | + |
| 102 | + |
| 103 | +# print to screen out |
| 104 | + |
| 105 | +#run 10000 |
| 106 | +#reset |
| 107 | +unfix melting |
| 108 | +unfix data_melting |
| 109 | +undump 1 |
| 110 | +undump 2 |
| 111 | +write_restart restart.equil |
| 112 | +write_data data.* |
| 113 | +# SAVE THE DATA OF THE CALCULATION OR ELSE YOU NEED TO START OVER = ( OUCH ! |
| 114 | +# SIMULATION DONE |
| 115 | +clear |
| 116 | +print "You've done great job =)" |
| 117 | + |
| 118 | + |
0 commit comments