中国科学技术大学 物理化学硕士在读
neighbor skin style
skin : 超出阶段半径的额外壳层
style = bin or nsq or multi
在做高分子体系中添加大直径填料的时候遇到了一个问题:相同的体系,加入填料后的模拟速度是不加入的五分之一。查看output的时候发现,neigh一项占去了总时间的一半以上。这就很诡异,因为正常情况应该是Pair占到七成左右比较合理。

想要解决问题,就需要从lammps计算原子对之间的势的算法说起。
首先,我要计算一个原子受到那些原子的作用,首先得去寻找周围的原子。这样,为了避免每个timestep都要去搜索,lammps先拉一个叫neighbor list 的表,这个表里储存了所有周遭原子的信息。这个表的范围是多大呢,(cutoff + skin distance)。
随着模拟的进行,原子在不断地移动,很有可能很多原子跑出这个表。因此skin distance作为一个缓冲区,允许部分原子最远跑到这个区域里来,超出的就称为Dangerous builds。在neigh_modify的选项里,存有参数,这个参数就是控制每多长时间这个表更新一次。不言自明,这个更新就是重新去搜索周围的原子再形成这么一张表。
然后要开始计算pair_coeff了。那么lammps就拿着这张表,逐个去计算作用势。小于pair_coeff里cutoff参数的部分保留,大于的部分舍弃。
很明显,在这个逻辑链上,neighbor list的大小直接决定了计算量,优先级要高于cutoff。因此,在我这个体系中,我neighbor command 的style 是bin选项,就会以最大的原子cutoff去生成这个表,所以增加了巨大的无效计算。
这个命令设置了影响neighbor list 构建的参数。在这张表容纳了所有在cutoff+skin范围内的原子对。通常来说,这个skin distance越大,重新构建表的次数越少,要计算的也越多(废话)。
neighbor skin style (style: bin nsq multi multi/old) reaxff 不支持nsq multi
lammps的neighbor list是verlet,cell两组方式组合。
skin决定verletlist: extra distance beyond force cutoff 就是图中的rl-rc
style 如 bin/multi决定默认的celllist元胞长度(也就是neigh_modify 中的binsize),也就是图中的rc
bin默认以最大的atom的rcut为bin size
multi是每种atom根据其rcut不同进行划分。
此长度可通过neigh_modify binsize进行修改
neigh_modify binsize
neighbor 6 bin
neigh_modify every 1 delay 10 check yes binsize 2.0
Neighbor list info …
update every 1 steps, delay 10 steps, check yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 16
ghost atom cutoff = 16
binsize = 2, bins = 90 90 90
模拟盒子划分为若干bins,构建邻域列表
box长宽高180X180X180
binsize=2
bins=90 90 90
binsize默认是master list distance cutoff 的1/2
master list distance cutoff =10+skinsize
If you make it too big, there is little overhead due to looping over bins, but more atoms are checked. If you make it too small, the optimal number of atoms is checked,but bin overhead goes up. If you set the binsize to 0.0, LAMMPS will use the default binsize of 1/2 the cutoff.
neigh_modify every 1 delay 1 check yes binsize 2.0
Binsize 参数过大,会check更多没必要的原子。
binsize过小,虽然不会check没用的原子,但bin过程会消耗不少计算资源。
影响的是neighbor list construction效率,不影响每次neighbor build的结果
对于neighbor style bin, neigh_modify 中的binsize 默认是最大pair cutoff的1/2
对于neighbor style multi, neigh_modify 中的binsize默认是最小pair cutoff的1/2