loop循环
注意,用jump时,提交任务一定要用lmp -in input
而非lmp < input
,否则jump时找不到label!
代码示例
有时候需要在input里做循环,以升温为例,其循环部分代码如下:
variable mytemp index 500.0 700.0 900.0 1100.0 1300.0 1500.0 1700.0 1900.0 2100.0 2300.0
variable mytemp2 index 700.0 900.0 1100.0 1300.0 1500.0 1700.0 1900.0 2100.0 2300.0 2500.0
variable i loop 10
label loopa
fix 2 all nvt temp ${mytemp} ${mytemp2} 100.0
run 200
unfix 2
next mytemp
next mytemp2
next i
jump SELF loopa
说明:
xilock的代码
variable i loop 10
label loopa
print "system_after_nvt_$i.data"
velocity Octane set 0 0 0.005
velocity Mont set 0 0 -0.005
run 50000
write_restart nvt.restart
write_data system_after_nvt_$i.data
next i
jump SELF loopa
参考:
if条件
代码示例
if boolean then t1 t2 ... elif boolean f1 f2 ... elif boolean f1 f2 ... else e1 e2
boolean : 布尔表达式
then : 关键词
t1 t2 : 被执行的命令块
elif : 关键词
else : 关键词
f1 f2 : 被执行的命令块
参考资料
手机版“神探玺洛克”请扫码