[gmx-developers] automatization of make_ndx

Paul van Maaren maaren at home.nl
Fri May 21 11:41:07 CEST 2004

+++ leonardo seplveda [Thu, May 20, 2004 at 10:21:50PM +0000]:
> Hello , I was trying to automatize the input of make_ndx to process a lot 
> of structures. I maked a short perl script to create a group for each 
> residue, which is
> system("make_ndx -f p.gro -o index.ndx &");
> for ($i=1;$i<=number of residues;$i++){
>        system("r $i\n &");
> };
> system("q\n &");
> the firt system call it is ok, but the second and the last do not print 
> anything;it only  change of line, making an infinite loop. A friend tried 
> to do the same in bash, and it do not work either. I dont have problems to 
> print an entry with  system("r $i\n &"); to select the FF number in pdb2mx, 
> I really do not know what is happening.

Something like this?


my $nres = number of residues;

my $pid = open(MAKENDX, "| make_ndx -f p.gro -o index") or die("Cannot open pipe: $!\n");
for(my $i=0; ($i < $nres); $i++) {
        print MAKENDX "r $i\n";
print MAKENDX "q\n";



More information about the gromacs.org_gmx-developers mailing list