[gmx-users] Distance.dat file in umbrella sampling

Kieu Thu Nguyen kieuthu2212 at gmail.com
Mon Jun 17 01:47:09 CEST 2013

Dear Justin,

I am testing a umbrella simulation basing on your tutorial. But after using
your distances.pl script, i do not have the file "summary_distances.dat".
It only makes many xvg files.
I post the script below:

#!/usr/bin/perl -w

use strict;

# loop g_dist command - measure distance in each frame, write to a file
for (my $i=0; $i<=500; $i++) {
    print "Processing configuration $i...\n";
    system("g_dist_mpi_d -s pull.tpr -f conf${i}.gro -n index.ndx -o
dist${i}.xvg < groups.txt &>/dev/null");

# write output to single file
open(OUT, ">>summary_distances.dat");

for (my $j=0; $j<=500; $j++) {
    open(IN, "<dist${j}.xvg");
    my @array = <IN>;

    my $distance;

    foreach $_ (@array) {
        if ($_ =~ /[#@]/) {
            # do nothing, it's a comment or formatting line
        } else {
            my @line = split(" ", $_);
            $distance = $line[1];

    print OUT "$j\t$distance\n";


# clean up
print "Cleaning up...\n";

for (my $k=0; $k<=500; $k++) {
    unlink "dist${k}.xvg";


Do i have to modify the script ?

Thankful and regards,


More information about the gromacs.org_gmx-users mailing list