Lammps基础命令(2020.3.26.01已更新) 您所在的位置:网站首页 kcal和kal的区别 Lammps基础命令(2020.3.26.01已更新)

Lammps基础命令(2020.3.26.01已更新)

2023-12-22 23:23| 来源: 网络整理| 查看: 265

我的辣鸡命令们 声明常用命令fix addforcereal的force单位write_restart ,read_restartmove linearreal的velocity单位How to chunk(未完成)compute temp/chunkchunk/atom+ave/chunkcompute chunk/atomcompute temp/chunk com yes与compute temp/com的区别compute temp/chunk 与fix ave/chunk tempcompute temp/partialfix nve/timecompute reduce(未完成)fix nve/limitfix nve/noforcefix rigidfix rigid singlerigid/nvefix rigid:force and torque keywordsreset_timestep

声明

命令以及分析仅限于我在学习过程中涉及到的以及各位为我补充的,具体细节还是得根据:美帝的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

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

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 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 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

chunk/atom+ave/chunk

这个组合简单来说就是,把你想要的group均分为块,然后求出每个块内的属性值,例如数密度,温度等。可参考二维温度云图实现。采样的解释同ave/time.

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能量就是和速度相关,所以人为设定的外部速度的存在是会影响结果的。 在这里插入图片描述 Example中shear例子中的体现(在friction中也有): 在这里插入图片描述 转自公众号:LAMMPS 爱好者 一个剪切(shear)模拟例子的学习(3)

fix nve/time

时间范围内进行采样 在这里插入图片描述 注意保存成restart文件的时候,下次读取仍然需要再次声明fix!

No information about this fix is written to binary restart files. None of the fix_modify options are relevant to this fix.

compute reduce(未完成)

功能和python reduce函数一样,具有累加的功能

fix nve/limit

注意:此命令只适合在模拟前期使用,在真正数据收集的过程中,请不要使用此命令,而改成需要的系综,如fix nve, fix NVT等!!!!! 转自:fix nve/limit command使用及注意

fix nve/noforce

会匀速更新原子坐标,需要配合velocity group set 0.0 0.0 0.0实现对边界的固定,另外和setforce固定不同的是,该命令下原子是受力的,信息可以被dump出。

#-----------------------A层固定 velocity A set 0.0 0.0 0.0 fix 17 A nve/noforce

Perform updates of position, but not velocity for atoms in the group each timestep. In other words, the force on the atoms is ignored and their velocity is not updated. The atom velocities are used to update their positions.

This can also be accomplished via the fix setforce command, but with fix nve/noforce, the forces on the wall atoms are unchanged, and can thus be printed by the dump command or queried with an equal-style variable that uses the fcm() group function to compute the total force on the group of atoms.

fix rigid

论文中的rigid描述(个人推测,仅供参考) 在这里插入图片描述 在这里插入图片描述

fix rigid single

single相当于把一个group的原子看成一个rigid body,施加力的时候需要考虑大小,例如1Gpa对于1000个原子,针对single类型,只需要1Mpa的数值。

For bodystyle single the entire fix group of atoms is treated as one rigid body.

id styles.

rigid/nve

该命令执行nve积分,不需要在叠加其他积分运算了

The rigid, rigid/nve, rigid/small, and rigid/small/nve styles perform constant NVE time integration. The only difference is that the rigid and rigid/small styles use an integration technique based on Richardson iterations. The rigid/nve and rigid/small/nve styles uses the methods described in the paper by Miller, which are thought to provide better energy conservation than an iterative approach

fix rigid:force and torque keywords

off:代表清除那个方向上与其他原子之间的作用 on:保持与其他原子之间的相互作用 没有力并不代表不会运动,没有速度,如果需要固定,则需要提前velocity set 0 0 0.

reset_timestep

我以后不会再用了。。。。。。 Various fixes use the current timestep to calculate related quantities. If the timestep is reset, this may produce unexpected behavior, but LAMMPS allows the fixes to be defined even if the timestep is reset. For example, commands which thermostat the system, e.g. fix nvt, allow you to specify a target temperature which ramps from Tstart to Tstop which may persist over several runs. If you change the timestep, you may induce an instantaneous change in the target temperature.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有