• 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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    (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
    
    • 1
    • 2
    • 3

    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
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21

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

    公众号:lammps加油站

  • 相关阅读:
    04_服务注册Eureka
    LeetCode·23.合并K个升序链表·递归·迭代
    liunx Centos-7.5上 rabbitmq安装
    2-1两数之和
    Qt的简单应用:翻金币游戏( 含源码 )
    「高并发」面试官:讲讲高并发场景下如何优化加锁方式?
    上周热点回顾(2.6-2.12)
    矩池云快速安装torch-sparse、torch-geometric等包
    一种新的数据聚类启发式优化方法——黑洞算法(基于Matlab代码实现)
    路由器基础(十二):IPSEC VPN配置
  • 原文地址:https://blog.csdn.net/lammps_jiayou/article/details/126541873