【LAMMPS翻译系列】atom_modify命令

atom_modify命令用于修改LAMMPS中所选定的原子类型的性质。

使用语法

atom_modify keyword values ...
  • keyword = map or first or sort
    • map: value = arrayorhash
    • first: value = group-ID
    • sort: value = Nfreq binsize

使用举例

atom_modify map hash
atom_modify map array sort 10000 2.0
atom_modify first colloid

使用介绍

该命令用于修改LAMMPS中所选定的原子类型的性质。

关键字map决定对于分子问题,如何对原子ID进行查找。查找是有LAMMPS由键进程执行,用来找到与全局原子ID关联的局部原子索引。如果map的值设为array,那么每个处理器都会保存一个长度为N的查找表,其中N时候系统中总的原子数。对于绝大多数模拟来说,这是最快的方法,但对于非常大规模的模拟来说,处理器的内存可能会不够保存查找表。如果map的值设为hash,那么会按着hash表进行查找。这种方法相对于array会稍微慢一些,但其内存消耗也要少很多,在每个处理器上与N/P成正比,其中P是运行当前模拟的处理器核数。

关键字first可以指定一个组,组内的原子会成为每个处理器都

The first keyword allows a group to be specified whose atoms will be maintained as the first atoms in each processor's list of owned atoms. This in only useful when the specified group is a small fraction of all the atoms, and there are other operations LAMMPS is performing that will be sped-up significantly by being able to loop over the smaller set of atoms. Otherwise the reordering required by this option will be a net slow-down. The neigh_modify include and communicate group commands are two examples of commands that require this setting to work efficiently. Severalfixes, most notably time integration fixes like fix nve, also take advantage of this setting if the group they operate on is the group specified by this command. Note that specifying "all" as the group-ID effectively turns off the first option.

It is OK to use the first keyword with a group that has not yet been defined, e.g. to use the atom_modify first command at the beginning of your input script. LAMMPS does not use the group until a simullation is run.

关键字sort用于开启每个处理器内部原子的空间排序或重排,以Nfreq为周期进行。如果将Nfreq设为0,排序就被关闭了。排序可以提高缓存性能,从而加速lammps模拟过程。加速效果依赖于问题规模(原子数/处理器数)、体系原子变为无序的快慢,及其他的因素。一般来说,相比于固相体系而言,排序对加速液相模拟效果更为明显。根据我们测试的结果,加速范围可以从0到3-4倍。

重排会在动力学模拟或能量最小化模拟过程中以Nfreq为周期进行。更精确地说,重排会在第一次

The sort keyword turns on a spatial sorting or reordering of atoms within each processor's sub-domain every Nfreq timesteps. If Nfreq is set to 0, then sorting is turned off. Sorting can improve cache performance and thus speed-up a LAMMPS simulation, as discussed in a paper by (Meloni). Its efficacy depends on the problem size (atoms/processor), how quickly the system becomes disordered, and various other factors. As a general rule, sorting is typically more effective at speeding up simulations of liquids as opposed to solids. In tests we have done, the speed-up can range from zero to 3-4x.

Reordering is peformed every Nfreq timesteps during a dynamics run or iterations during a minimization. More precisely, reordering occurs at the first reneighboring that occurs after the target timestep. The reordering is performed locally by each processor, using bins of the specified binsize. If binsize is set to 0.0, then a binsize equal to half the neighbor cutoff distance (force cutoff plus skin distance) is used, which is a reasonable value. After the atoms have been binned, they are reordered so that atoms in the same bin are adjacent to each other in the processor's 1d list of atoms.

The goal of this procedure is for atoms to put atoms close to each other in the processor's one-dimensional list of atoms that are also near to each other spatially. This can improve cache performance when pairwise intereractions and neighbor lists are computed. Note that if bins are too small, there will be few atoms/bin. Likewise if bins are too large, there will be many atoms/bin. In both cases, the goal of cache locality will be undermined.

IMPORTANT NOTE: Running a simulation with sorting on versus off should not change the simulation results in a statistical sense. However, a different ordering will induce round-off differences, which will lead to diverging trajectories over time when comparing two simluations. Various commands, particularly those which use random numbers (e.g. velocity create, and fix langevin), may generate (statistically identical) results which depend on the order in which atoms are processed. The order of atoms in a dump file will also typically change if sorting is enabled.

使用限制

关键字map只能在模拟盒子被定义(使用命令read_data或create_box)之前使用。

关键字first和sort不能同时使用。因为排序默认是开启的,所以当使用first关键字,并且其group-ID不是all的时候,排序就会被关闭。

相关命令

默认设置

  • 原子问题默认不分配map。
  • 分子问题默认map = array。
  • first组没有被定义。
  • 排序是开启的,并且是以1000个时间步的频率,binsize为0.0(即领域截断作为bin的尺寸)进行。

标签: lammps, lammps翻译

相关文章推荐

添加新评论 (无需注册,可直接评论)