Greetings, I offer my respects to you:I’ve just started learning LAMMPS, and I’m encountering a problem where the code is running too slowly。(units metal timestep 0.001)The relaxation process takes 8 minutes per 100 steps。 What are some ways to improve the running speed?THANKS!!
Showly compared to what reference? What makes you think it should be faster?
Without providing any relevant details about your simulation, I doubt you will receive meaningful help here.
Simon
Thank you for your response .1.Based on my previous simulation of diamond grinding of pure Cu, which took only 5 hours, the diamond grinding of GaN this time is estimated to take a week.2.I suspect that there might be an issue with my model that is causing the slow running speed, so I want to improve its speed and let it finish running first.
New users are unable to upload attachments.So I can only copy my code in the chat box, I hope you understand.Thank you again for your reply.
#建立初始条件
dimension 3
boundary p p p
units metal
atom_style atomic
neighbor 0.3 bin
neigh_modify delay 5
timestep 0.001
#设置box区域
region box block -200 700 -100 700 -100 400
#生成box七种原子类型
create_box 7 box
#建立工件区域
region boundary1 block 0 15 0 400 0 140 units box
region boundary2 block 15 300 0 400 0 15
region boundary union 2 boundary1 boundary2
region temp_layer1 block 15 30 0 400 15 140 units box
region temp_layer2 block 30 300 0 400 15 30 units box
region temp_layer union 2 temp_layer1 temp_layer2
region newton1 block 30 300 0 400 30 140 units box
region newton2 block 50 60 0 400 140 150 units box
region newton3 block 80 90 0 400 140 150 units box
region newton4 block 110 120 0 400 140 150 units box
region newton5 block 140 150 0 400 140 150 units box
region newton6 block 170 180 0 400 140 150 units box
region newton7 block 200 210 0 400 140 150 units box
region newton8 block 230 240 0 400 140 150 units box
region newton9 block 260 270 0 400 140 150 units box
region newton10 block 290 300 0 400 140 150 units box
region newton union 10 newton1 newton2 newton3 newton4 newton5 newton6 newton7 newton8 newton9 newton10
region piece union 3 boundary temp_layer newton
#磨粒区域
region ball sphere 400 200 150 40 units box
#生成工件GaN
定义GaN的晶格常数和原子位置
lattice custom 6.411 a1 0.859 0.000 0.000 a2 0.000 1.000 0.000 a3 0.000 0.000 0.810 &
basis 0.000 0.249 0.625 &
basis 0.000 0.749 0.625 &
basis 0.500 0.000 0.625 &
basis 0.500 0.498 0.625 &
basis 0.165 0.000 0.125 &
basis 0.165 0.498 0.125 &
basis 0.667 0.249 0.125 &
basis 0.667 0.749 0.125 &
basis 0.000 0.249 0.000 &
basis 0.000 0.749 0.000 &
basis 0.500 0.000 0.000 &
basis 0.500 0.498 0.000 &
basis 0.165 0.000 0.500 &
basis 0.165 0.498 0.500 &
basis 0.667 0.249 0.500 &
basis 0.667 0.749 0.500
create_atoms 2 region boundary &
basis 1 1 &
basis 2 1 &
basis 3 1 &
basis 4 1 &
basis 5 1 &
basis 6 1 &
basis 7 1 &
basis 8 1 &
basis 9 2 &
basis 10 2 &
basis 11 2 &
basis 12 2 &
basis 13 2 &
basis 14 2 &
basis 15 2 &
basis 16 2
create_atoms 2 region temp_layer &
basis 1 3 &
basis 2 3 &
basis 3 3 &
basis 4 3 &
basis 5 3 &
basis 6 3 &
basis 7 3 &
basis 8 3 &
basis 9 4 &
basis 10 4 &
basis 11 4 &
basis 12 4 &
basis 13 4 &
basis 14 4 &
basis 15 4 &
basis 16 4
create_atoms 2 region newton &
basis 1 5 &
basis 2 5 &
basis 3 5 &
basis 4 5 &
basis 5 5 &
basis 6 5 &
basis 7 5 &
basis 8 5 &
basis 9 6 &
basis 10 6 &
basis 11 6 &
basis 12 6 &
basis 13 6 &
basis 14 6 &
basis 15 6 &
basis 16 6
#生成金刚石原子C
lattice diamond 3.57
create_atoms 7 region ball
#设置原子质量
mass 1 69.723
mass 2 14.007
mass 3 69.723
mass 4 14.007
mass 5 69.723
mass 6 14.007
mass 7 12.010
#原子分组
group boundary region boundary
group temp_layer region temp_layer
group newton region newton
group ball region ball
group mobile union temp_layer newton
#保存模型文件
write_data struc.lmp
#固定边界层
fix 01 boundary setforce 0.0 0.0 0.0
#势函数设置
pair_style hybrid tersoff tersoff lj/cut 7.5
pair_coeff * * tersoff 1 GaN.tersoff Ga N Ga N Ga N NULL
pair_coeff * * tersoff 2 SiC.tersoff NULL NULL NULL NULL NULL NULL C
pair_coeff 1 7 lj/cut 0.0084646 3.3919
pair_coeff 2 7 lj/cut 0.0037235 3.3677
pair_coeff 3 7 lj/cut 0.0084646 3.3919
pair_coeff 4 7 lj/cut 0.0037235 3.3677
pair_coeff 5 7 lj/cut 0.0084646 3.3919
pair_coeff 6 7 lj/cut 0.0037235 3.3677
#能量最小化
dump 1 all atom 100 1mini.xyz
thermo 500
min_style sd
minimize 1e-4 1e-6 1000 1000
undump 1
reset_timestep 0
write_restart restart0.equil
#初始化温度
velocity temp_layer create 300 8877423
velocity newton create 300 8877423
velocity ball create 300 8877423
#恒温层弛豫
fix 1 temp_layer nvt temp 300 300 0.1
thermo 100
compute temp1 temp_layer temp
compute temp2 newton temp
thermo_style custom step temp c_temp1 c_temp2 etotal ke pe press pxx pyy pzz
dump 1 all atom 3000 2nvt1.xyz
run 30000
undump 1
unfix 1
reset_timestep 0
#输出驰豫后文件
write_restart restart1.equil
#工件弛豫
fix 1 newton nvt temp 300 300 0.1
thermo_style custom step temp c_temp1 c_temp2 etotal ke pe press pxx pyy pzz
dump 1 all atom 3000 2nvt2.xyz
run 30000
undump 1
unfix 1
reset_timestep 0
#输出驰豫后文件
write_restart restart2.equil
#磨削
fix 1 ball move linear -1.0 0.0 0.0 units box
run 10000
unfix 1
compute new_temp temp_layer temp/com
thermo 100
thermo_style custom step temp etotal ke pe press pxx pyy pzz
#轨迹文件输出设置
dump 1 all custom 1000 3cut.xyz id type x y z vx vy vz fx fy fz
#设置工件为刚体
fix 10 ball nve/noforce
#牛顿层系综为nve
fix 20 newton nve
#对恒温层使用温度标定法进行控温
fix 30 temp_layer nve
fix 31 temp_layer temp/rescale 10 300.0 300.0 10.0 1.0
fix_modify 31 temp new_temp
#设置边界层为刚体
fix 40 boundary nve/noforce
run 200000
write_restart GaN.restart
Before you can do that, you have to first determine what is slowing you down.
There can be many reasons for that:
- choice of pair style
- details of the pair style parameters (e.g. cutoff, many-body interactions)
- details of the system geometry (e.g. number of atoms or density of atoms)
- details of neighbor list settings
- details of parallelization leading to load imbalances
- choice of computer hardware
- details of command line to run LAMMPS
- choice of platform
- choice of LAMMPS version
Some of these cannot be changed without changing the science of what you are investigating.