-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathin
173 lines (149 loc) · 6.49 KB
/
in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Written by Ke Xu, Beihang University.
# Preperation
shell mkdir dump log
print "DumpFolderName" file folder_name.csv
#-----------------------------------------------------
#-------------------------INTPUT----------------------
#-----------------------------------------------------
# -loop variables
#variable tem index 900 700 500 300
#variable random index 1 2 3 4 5 6 7 8 9 10
#variable vx index 0 0 1 1 # 100 110 111 135
#variable vy index 0 1 1 3
#variable vz index -1 -1 -1 -5
#variable angle index 1 2 3 4
#variable E_PKA index 100 # unit: keV
variable env_temp index 300 #enviroment temperature
label loop_env_temp
variable E_PKA index 150 # unit: keV
label loop_E_PKA
# --angle loop
variable d_x index 0 #direction
variable d_y index 0
variable d_z index -1
variable angle index 1
label loop_angle
variable random loop 1
label loop_random
# -stop critical
variable halt_dt equal -0.0000005*${env_temp}+0.00125
###This relationship should be determined by futher calculations.
# -box variable
variable box_r equal 65 # the number of atoms > 25 times the energy of the projectile in eV (eg: 500 000 atoms for 20 keV)
variable fix_th equal 2 # fix thickness
variable bath_th equal 3 # bath thickness
variable center equal 25
variable lattice_constant equal 3.14
#------------------------------------------------------------
#-------------------------END-OF-INTPUT----------------------
#------------------------------------------------------------
# variable computes
variable v_PKA equal 1*sqrt(${E_PKA})*324.021 # unit: Angstrom / ps
variable tem_cv equal ${env_temp}*2
variable box_l equal -1*${box_r}
variable nf_r equal ${box_r}-${fix_th}
variable nf_l equal -1*${nf_r}
variable f_r equal ${nf_r}-${bath_th}
variable f_l equal -1*${f_r}
variable c_r equal ${center}+0.1
variable c_l equal ${center}-0.1
# -velocity computes
variable diagonal equal sqrt(${d_x}*${d_x}+${d_y}*${d_y}+${d_z}*${d_z})
variable vx equal ${v_PKA}/${diagonal}*${d_x}
variable vy equal ${v_PKA}/${diagonal}*${d_y}
variable vz equal ${v_PKA}/${diagonal}*${d_z}
# inits
units metal
atom_style atomic
atom_modify map array
boundary p p p
lattice bcc ${lattice_constant}
# box and atoms
region box block ${box_l} ${box_r} ${box_l} ${box_r} ${box_l} ${box_r}
create_box 2 box
create_atoms 1 box
region NO_FIX block ${nf_l} ${nf_r} ${nf_l} ${nf_r} ${nf_l} ${nf_r}
group NO_FIX region NO_FIX
group FIX subtract all NO_FIX
region FREE block ${f_l} ${f_r} ${f_l} ${f_r} ${f_l} ${f_r}
group FREE region FREE
group BATH subtract NO_FIX FREE
region CENTER block -0.1 0.1 -0.1 0.1 ${c_l} ${c_r}
group CENTER region CENTER
# interactions
log log/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}.log.lammps
include pot
thermo 100
thermo_style custom step time dt temp
variable DT equal dt
variable TEM equal temp
variable TEMP_DT equal ${DT}*100
compute 1 all pe/atom
compute 2 all voronoi/atom occupation
compute 3 all ke/atom
shell mkdir dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}
write_dump all custom dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/ref.dump id type x y z
# run
fix FIXATOMS FIX setforce 0.0 0.0 0.0
# bath
velocity NO_FIX create ${tem_cv} ${random} dist gaussian mom yes rot yes
fix 1 all nvt temp ${env_temp} ${env_temp} 0.01 drag 0.2
timestep 0.0005
run 2000
unfix 1
# incident
reset_timestep 0
velocity CENTER set ${vx} ${vy} ${vz} sum yes units box # adjust here if change direction of PKA
fix 1 BATH nvt temp ${env_temp} ${env_temp} ${TEMP_DT} drag 0.2
fix 2 FREE nve
dump 1 all custom 100 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/lammps_iv.dump id type c_2[1]
dump_modify 1 thresh c_2[1] != 1
dump 2 all custom 100 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/lammps_2i.dump id type x y z
dump_modify 2 thresh c_2[2] > 1
dump 3 all custom 100 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/high_pe.dump id type x y z c_1
dump_modify 3 thresh c_1 > -8.6
#dump 4 all custom 1000 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/all.dump id type x y z c_1
fix 3 all dt/reset 10 NULL NULL 0.01 units box
fix 4 all halt 10 v_DT > ${halt_dt} error continue # adjust here for end criterion
run 100000000
unfix 4
unfix 3
timestep 0.001
run 40000
#undump 4
undump 3
undump 2
undump 1
unfix 2
unfix 1
# last snap
min_style cg
minimize 1e-14 1e-14 1000 1000
dump 1 all custom 1 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/lammps_iv_last.dump id type c_2[1]
dump_modify 1 thresh c_2[1] != 1
dump 2 all custom 1 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/lammps_2i_last.dump id type x y z
dump_modify 2 thresh c_2[2] > 1
dump 3 all custom 1 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/high_pe_last.dump id type x y z c_1
dump_modify 3 thresh c_1 > -8.6
dump 4 all custom 1 dump/${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}/all_last.dump id type x y z c_1 c_2[1] c_2[2]
run 0
undump 4
undump 3
undump 2
undump 1
print "${env_temp}K_${E_PKA}KeV_[${d_x}${d_y}${d_z}]_${random}" append folder_name.csv
# next
clear
next random
jump SELF loop_random # random number
next d_x
next d_y
next d_z
next angle
jump SELF loop_angle # angle loop
next E_PKA
jump SELF loop_E_PKA # energy loop
next env_temp
jump SELF loop_env_temp # temp loop
# end
print "Program End!"