大家好,我是小马老师。
本文介绍lammps计算原子组之间相互作用的一个命令:compute group/group。
在lammps模拟中,经常需要计算原子组之间的相互作用,如摩擦球与基体之间、流体与壁面之间等等。
lammps提供compute group/group命令可完成此功能。
compute group/group命令既可以计算原子组之间的作用能,也可以计算两个组之间的作用力。
如:
compute 1 lower group/group upper
lower和upper为两个原子组的id(group-id)。
以上命令共有4个计算结果,其中标量c_1为量原子组之间的作用能,矢量c_1[1]、c_1[2]、c_1[3]分别为lower和upper组在x、y、z方向的作用力。
下面以Cu弛豫为例,简单演示compute group/group使用方法及结果输出。
模型共分上下两部分,计算结果由thermo命令输出。
完整代码如下:
#公众号:lammps加油站
units metal
boundary p p p
atom_style atomic
timestep 0.001
neighbor 2 bin
neigh_modify every 1 delay 0 check yes
#box
lattice fcc 3.61
region box block 0 10 0 5 0 10
create_box 2 box
create_atoms 1 box
#分组
region top block INF INF INF INF 5 INF
group top region top
group bot subtract all top
set group top type 2
#势函数设置
pair_style eam/fs
pair_coeff * * Cu1.eam.fs Cu Cu
#保存模型
write_data all.data
#温度初始化
velocity all create 300 98989
#计算top/bot组作用能和作用力
compute 1 top group/group bot
thermo 100
thermo_style custom step temp press c_1 c_1[1] c_1[2] c_1[3]
#弛豫
dump 1 all atom 100 dump.xyz
fix 1 all nvt temp 300 300 0.1
run 1000
模拟结果如下图所示,最后面四列即为计算结果。
公众号:lammps加油站