考虑:
#!/usr/bin/perl -w
use strict;
for (my $i=0; $i<=500; $i++)
{
print "Processing configuration $i...\n";
system("g_dist -s pull.tpr -f conf${i}.gro -n index.ndx -o dist${i}.xvg < groups.txt &>/dev/null");
}
我有一个执行格式化所需的系统命令,因此基本上该命令将输入文件提供给Gromacs。我的文件不像conf1.gro,conf2.gro等。它们像0001conf1.gro,0002conf2.gro等。因此,我想编辑以下命令:
我尝试使用“%04d”,因为所有数字都是四位数,但是在这里我不怎么正确使用从零开始的数字...
该范围操作符是“神奇”,并且可以用来增量的字符串是这样的:
for my $num ( '0001' .. '0010' ) {
my $conf = "conf$num.gro";
my $dist = "dist$num.xvg";
....
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句