lammps已跑完,不想重跑,如何补充新的计算?

大家好,我是小马老师。

本文介绍rerun命令的用法。

lammps模拟中,可能会遇到这样的情况:把lammps in文件提交到服务器运行完成后,发现少算了一个数据(如rdf),重新写代码提交,费时费力。

lammps提供了一个命令可以解决此类问题:rerun。

rerun可以理解为重新运算,但是这个运算并不会和run命令一样,从头开始运算,而是从run运算的结果中提取原子信息,如坐标、速度等,以此进行能量、力以及热力学的输出等。

该命令的优点是不需要重新积分运算,不影响原来的运行结果,仅提取需要的信息进行部分运算,运算速度快。

下面以补充计算rdf为例,介绍rerun的使用方法。

(1)in.first
in.first文件模拟了一个溶液体系的原子演化过程,运行1000步,轨迹文件保存到lj.dump文件中。
这个in文件没有进行rdf的计算。

in文件代码:

#in.first
variable	x index 1
variable	y index 1
variable	z index 1
variable	xx equal 20*$x
variable	yy equal 20*$y
variable	zz equal 20*$z
units		lj
atom_style	atomic
lattice		fcc 0.8442
region		box block 0 ${xx} 0 ${yy} 0 ${zz}
create_box	1 box
create_atoms	1 box
mass		1 1.0
velocity	all create 1.44 87287 loop geom
pair_style	lj/cut 2.5
pair_coeff	1 1 1.0 1.0 2.5
neighbor	0.3 bin
neigh_modify	delay 0 every 20 check no
fix		1 all nve
dump            1 all custom 100 lj.dump id type x y z vx vy vz
thermo          100
run		1000

(2)in.rdf
在lj.dump文件的基础上补充rdf的运算,首先把rdf命令写到in文件,把最后一句的run语句改成rerun语句:

compute myRDF all rdf 100 cutoff 5.0
fix 2 all ave/time 100 10 1000 c_myRDF[*] file rdf.rerun mode vector
rerun lj.dump dump x y z

rerun后面紧跟dump文件名,之后是需要提取的原子坐标。
这样重启动一个“运算”就可以把rdf计算出来。

in文件代码:

#in.rdf
variable	x index 1
variable	y index 1
variable	z index 1
variable	xx equal 20*$x
variable	yy equal 20*$y
variable	zz equal 20*$z
units		lj
atom_style	atomic
lattice		fcc 0.8442
region		box block 0 ${xx} 0 ${yy} 0 ${zz}
create_box	1 box
create_atoms	1 box
mass		1 1.0
pair_style	lj/cut 5.0
pair_coeff	1 1 1.0 1.0
neighbor	0.3 bin
thermo          100
compute         myRDF all rdf 100 cutoff 5.0
fix             2 all ave/time 100 10 1000 c_myRDF[*] file rdf.rerun mode vector
rerun           lj.dump dump x y z

为了方便大家理解这个命令,我选了最简单了一个例子,rerun还有很多高级用法,具体可以查看官网手册介绍,以及read_dump命令。

公众号:lammps加油站

  • 4
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lammps加油站

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值