例一
units metal # 单位为lammps 中的metel 类型 boundary p p p # 周期性边界条件 atom_style atomic # 原子模式
lattice fcc 3.61 # Cu 的晶格常数3.61
region box block 0 4 0 4 0 4 # x,y,z 各方向上的晶胞重复单元数,也即区域大小 create_box 1 box # 将上述区域指定为模拟的盒子 create_atoms 1 box # 将原子按晶格填满盒子 pair_style eam # 选取 Cu 的EAM 势作为模型 pair_coeff * * Cu_u3.eam # EAM 势文件名称
run 0 # 运行0 步,仅为启动lammps 的热力学数据计算 variable E equal pe # 定义变量 E 为系统总势能
variable N equal atoms # 定义变量 N 为系统总原子数
print \打印信息 create_atoms 1 single 2.45 2.05 2.05 # 在该位置插入一个原子
min_style sd # 能量最小化模式,sd
minimize 1.0e-12 1.0e-12 1000 1000 # 能量最小化参数,指数越大最小化程度越深 print \
fix 1 all nvt 100 100 100 drag 0.2 # nvt 系综,原子数、体积和温度保持不变;T=100K timestep 0.005 # 步长 0.005fs
run 1000 # 运行 1000 步
print \
fix 1 all nvt 100 0.0001 100 drag 0.2 # nvt 系综,温度由100K 到0.0001K run 1000 # 运行 1000 步
print \compute 3 all pe/atom # 计算每个原子的势能
compute 4 all ke/atom # 计算每个原子的动能
compute 5 all coord/atom 3.0 # 计算每个原子的近邻原子数
dump 1 all custom 1 dump.atom id xs ys zs c_3 c_4 c_5 # 将信息写入dump.atom min_style sd
minimize 1.0e-12 1.0e-12 10000 10000 # 再次能量最小化 print \打印信息 ~ 例二
boundary p s s # 边界条件,拉伸方向是周期性,其余是自由边界;如果是薄膜拉伸则是两个周期性,块体则是三个周期性
units metal #单位制定义为metal atom_style atomic #原子类型自动
neighbor 2.0 bin #截断半径相关的东西 neigh_modifydelay 1 check yes # 邻近原子列表更新速度
#create geometry
lattice fcc 3.61 # 定义晶胞为fcc,晶格常数3.61A region box block 0 30 0 3 0 3 #定义一个长方体区域叫box,长30,宽和高是3
create_box 1 box #创建了这样一个box create_atoms 1 box #在box里创建了一种原子
mass 1 63.546 #定义这种原子的质量是63.546
# potentials
pair_style eam # 定义势函数是EAM pair_coef * * Cu_u3.eam #势所需要的参数在此文件里
#define groups
region 1 block INF 1 INF INF INF INF # 定义了一个叫1的区域
group left region 1 #定义此区域里的原子叫left
region 2 block 29 INF INF INF INF INF #定义了一个叫2的区域 group right region 2 #定义此区域里的原子叫right
group boundary union left right #定义left+ right = boundary
group mobile subtract all left # 定义mobile= all - left
# initialvelocities
velocity left set 0.0 0.0 0.0 # 设置原子初速度为0
computep all pressure thermo_temp # 计算应力,计算结果记为p
variable pressx equal c_p[1] #定义变量pressx=c_p[1],c_p[1]的意思是p里第一个值
variable pressy equal c_p[2] #定义变量pressy=c_p[2],c_p[2]的意思是p里第二个值
variable pressz equal c_p[3] #定义变量pressz=c_p[3],c_p[3]的意思是p里第三个值
thermo_style custom step temp etotal press v_pressx v_pressy v_pressz vol
dump 1 all atom 1000 dump.tensile # 输出结果到dump.tensile minimize 1.0e-6 1.0e-6 1000 1000 # 驰豫
fix 1 left setforce 0.0 NULL NULL #固定左边的原子 fix 2 all npt 1.0 1.0 1.0 aniso 0.0 0.0 NULL NULL NULL NULL 10.0 drag 1.0
thermo 1000 # 每1000步输出一次结果
timestep 0.002 #时间步长0.002ps
run 10000 #运行10000步
unfix2
fix 3 all nve
fix 4 all temp/rescale 100 1.0 1.0 5 1.0
fix 5 all deform 1000 x erate 0.002 units box #设置沿x方向拉伸,应变率为0.002(1/ps)
compute s all stress/atom #计算每个原子上的应力,计算结果记为s
compute strea all reduce sum c_s[1] #将s里第一个值求和,计算结果记为strea
variable stressa equal c_strea/vol # 定义变量stressa= strea/vol, vol是体积
compute streb all reduce sum c_s[2] variable stressb equalc_streb/vol
compute strec all reduce sum c_s[3] variable stressc equal c_strec/vol
thermo_style custom step tempetotal press v_stressa v_stressb v_stressc vol run 300000
相关推荐: