本文分享一个聚乙烯拉伸的案例代码。复合物的拉伸过程和金属的拉伸类似,差别在于势函数的设置。
金属原子直接没有键连接,因此,在进行金属材料拉伸时,只要指定势函数文件名和指定原子类型即可。
聚合物则需要设置键、键角、二面角等势函数参数。
具体模拟过程如下:
(1)在MS中生成50个单体、10个链的聚乙烯,设置cvff力场,导出car文件。
生成的聚乙烯如下图所示:
(2)运行msi2lmp pp -class I -frv cvff >data.pp命令,生成pp.data聚乙烯结构数据文件。
(3)在in.pp中设置势函数参数,读取pp.data,能量最小化后进行拉伸。
in.pp代码如下:
#聚乙烯拉伸# 模型初始化units realboundary p p patom_style full#设置键势类型bond_style harmonic#设置键角势类型angle_style harmonic#设置二面角势类型dihedral_style harmonic#设置对势类型pair_style lj/cut 10.5#读取聚乙烯结构数据read_data pp.data#设置邻居参数neighbor 0.4 binneigh_modify every 10 one 10000#nve系综下驰豫dump 1 all custom 100 nve.xyz id type x y z vx vy vz#温度初始化velocity all create 300.0 1231#设置nve系综fix 1 all nve#热力学输出thermo_style custom step temp pressthermo 100run 1000#取消fix、dump设置unfix 1undump 1#npt系综下驰豫 fix 1 all npt temp 300 300 50 iso 0 0 1000 drag 2#dump输出设置dump 1 all custom 100 npt.xyz id type x y z vx vy vz#热力学输出thermo_style custom step temp press epair ebond eangle edihed pxx pyy pzz lx ly lzthermo 10#重新设置模拟步长timestep 0.5#步数初始化reset_timestep 0#运行50000步run 50000#取消设置unfix 1undump 1#npt系综下拉伸#计算应变值variable tmp equal "lx"variable L0 equal ${tmp}variable strain equal "(lx - v_L0)/v_L0"#dump输出dump 1 all custom 1000 dump.pp id type x y z vx vy vz#设置npt系综fix 1 all npt temp 100 100 50 y 0 0 1000 z 0 0 1000 drag 2#deform拉伸,x方向fix 2 all deform 1 x erate 1e-5 units box remap x#热力学输出thermo_style custom step temp v_strain pxx pyy pzz lx ly lz epair ebond eangle edihedthermo 100reset_timestep 0#启动模拟,20万步run 200000unfix 1unfix 2undump 1
模拟结果如下图所示:
--------------------------------------------------------------------------
更多lammps公众号请关注微信公众号:lammps加油站