Lammps基础命令(不定期更新,注意查看)

声明

命令以及分析仅限于我在学习过程中涉及到的以及各位为我补充的,具体细节还是得根据:美帝的manual来。

总之不定期更新ing,可能一开始的内容会比较少。。。但会根据问题的出现慢慢加。。。也欢迎大家给我安利各种命令,私信,qq,邮箱都可以,如果有命令解释错误,请指出!!!
本人也会尽量将命令和具体论文结合但是准确度可能无法完全保证,但是会努力优化!!!!这就需要大家的努力了!!!

  • 小建议:在PDF中添加自己的常用命令标签,方便反复查阅。
    在这里插入图片描述

常用命令

fix addforce

你填入的value需要为每个原子的所受到的力,一方面要考虑力学单位换算,又要考虑进行平均!注意使用前要确定受力对象要在系综中。

Add fx,fy,fz to the corresponding component of force for each atom in the group. This command can be used to give an additional push to atoms in a simulation, such as for a simulation of Poiseuille flow in a channel.

real的force单位

Kcal/mole/Angstrom,可自行换算1Kcal/mole/Angstrom=6.950166e-11N
在这里插入图片描述
以下为我在模仿论文:Identifying the Mechanisms of Polymer Friction through Molecular Dynamics Simulation用到的addforce命令,再进行1GPa施压时我所用的单位换算,仅供参考:

variable		target_pressure equal 1e9	#目标压力设定(pa)
variable 		total_force_E_F equal ${target_pressure}*lx*ly*1e-20				#EF层所受的总力(N)lx,ly为盒子边长
variable		atom_force_E_F equal ${total_force_E_F}/(${C_number_02}+${H_number_02})		#EF层每一个原子受到的力(N)
variable		f_coefficient equal 6.950166e-11
variable		f_to_addforce equal ${atom_force_E_F}/${f_coefficient} #EF层每个原子所受的力(Kcal/mole/Angstrom)

write_restart ,read_restart

可以保留之前的模拟的group,运算后的原子坐标,速度,温度等信息,但是fix和variable需要在下次模拟中仍然需要重新声明

Although the purpose of restart files is to enable restarting a simulation from where it left off, not all information about a simulation is stored in the file. For example, the list of fixes that were specified during the initial run is not stored, which means the new input script must specify any fixes you want to use. Even when restart information is stored in the file, as it is for some fixes, commands may need to be re-specified in the new input script, in order to re-use that information.

move linear

同样要注意单位换算; 另外注意有了move之后,如果不需要控温,则NULL就代表位置和速度更新等同于nve了!!!如果nve+move null,相当于两个系综的混合使用了,可见下面的错误示范!!

If any of the velocity components is specified as NULL, then the position and velocity of that component is time integrated the same as the fix nve command would perform, using the corresponding force component on the atom

real的velocity单位

Angstroms/femtosecond; 换算成SI:1A/fs=1e5m/s
1m/s我所用的单位换算,仅供参考:

variable 		target_velocity equal 1								#m/s
variable 		velocity_coefficient equal 1e5
variable		input_velocity equal ${target_velocity}/${velocity_coefficient} 		#埃/fs

错误示范(可运行,但是会报错,运行结果也有问题)

fix			1 E_F nve											#第一次nve
fix			2 E_F move linear NULL ${input_velocity} NULL		#第二次nve

错误警告:
在这里插入图片描述
可以正常运行的示范(至于结果合不合理,得综合考虑!!!)

#-----------------------恒速
fix			4 E_F move linear NULL ${input_velocity} NULL
fix			5 E_F addforce 0.0 0.0 -${f_to_addforce_F}					
fix			6 F temp/rescale 10 300.0 300.0 10.0 1.0

How to chunk(未完善,正确性也要推敲)

compute temp/chunk

Define a computation that calculates the temperature of a group of atoms that are also in chunks, after optionally subtracting out the center-of-mass velocity of each chunk. By specifying optional values, it can also calculate the per-chunk temperature or energies of the multiple chunks of atoms.

The temp value calculates the temperature for each chunk by the formula KE = DOF/2 k T, where KE = total kinetic energy of the chunk of atoms (sum of 1/2 m v^2), DOF = the total number of degrees of freedom for all atoms in the chunk, k = Boltzmann constant, and T = temperature.
The DOF in this case is calculated as N*adof + cdof, where N = number of atoms in the chunk, adof = degrees of freedom per atom, and cdof = degrees of freedom per chunk. By default adof = 2 or 3 = dimensionality of system, as set via the dimension command, and cdof = 0.0. This gives the usual formula for temperature.
The kecom value calculates the kinetic energy of each chunk as if all its atoms were moving with the velocity of the center-of-mass of the chunk.
The internal value calculates the internal kinetic energy of each chunk. The interal KE is summed over the atoms in the chunk using an internal “thermal” velocity for each atom, which is its velocity minus the center-of-mass velocity of the chunk.

在论文中的体现:
在这里插入图片描述
Tong R-t, Han B, Quan Z-f, Liu G. Molecular dynamics simulation of friction and heat properties of Nano-texture GOLD film in space environment. Surface and Coatings Technology 2019;358:775–84. https://doi.org/10.1016/j.surfcoat.2018.11.084

compute chunk/atom

将不同的原子分成不同的块
在这里插入图片描述

compute temp/chunk com yes与compute temp/com的区别

compute temp/chunk com yes是计算每个chunk的温度,方法是:对于某个chunk,比如是chunk1,将该chunk内的所有原子先求出质心速度,而后,把将该chunk内的所有原子的速度减掉求出的质心速度,在根据能量均分定理,计算获得该chunk的温度。
compute temp/com是计算某个group的温度,方法是:对于某个group,先将该group的原子求出质心速度,而后,将该group内的所有原子的速度减掉求出的质心速度,,在根据能量均分定理,计算获得该chunk的温度。

compute temp/chunk 与fix ave/chunk temp

  • This compute calculates the temperature for each chunk for a single snapshot. Fix ave/chunk can do that but can also time average those values over many snapshots, or it can compute a temperature as if the atoms in the chunk on different timesteps were collected together as one set of atoms to calculate their temperature.
  • If you want to time-average what compute temp/chunk produces (a global array of temp per chunk), you could use a column of it as input to fix ave/time in its vector mode. This will not do the fancy stuff that fix ave/chunk temp does with combing atoms across timesteps to accumulate one temp,as on its doc page.(这一点应该是说fix ave/chunk更好,因为它是将某一时间段内进入到该chunk的原子进行统计,而后进行温度计算,应该是温度数据震荡会更小吧?)
  • This compute allows the center-of-mass velocity of each chunk to be subtracted before calculating the temperature; fix ave/chunk does not.
    compute temp/chunk com yes + fix ave/time’与

(1) compute temp/chunk com yes能够实现每个chunk内原子减掉该chunk的质心速度,而后计算温度,并采用fix ave/time平均输出;(完整命令:

compute tempWcom all temp/chunk slices temp com yes
fix T_slices all ave/time 10 100 1000 c_tempWcom[*] file slices_equi.prof mode vector 

(2) ‘compute temp/chunk com yes + fix ave/time’ 与‘compute temp/chunk com yes + fix ave/chunk temp bias’ 的结果输出的一样

(3) compute temp/com + fix ave/chunk temp bias也能够实现针对于chunk的温度计算并输出,与(1)不同的是,每个chunk内原子减掉该compute所使用的group的质心速度,而后计算的温度。转载自s-q-dirac的博客

compute temp/partial

Define a computation that calculates the temperature of a group of atoms, after excluding one or more velocity components

在这里插入图片描述
转自公众号:LAMMPS 爱好者 一个剪切(shear)模拟例子的学习(3)

发布了12 篇原创文章 · 获赞 25 · 访问量 1065

猜你喜欢

转载自blog.csdn.net/qyb19970829/article/details/104896911
今日推荐