[gmx-users] umbrella sampling

Justin Lemkul jalemkul at vt.edu
Sat Nov 25 16:31:24 CET 2017



On 11/25/17 5:05 AM, rose rahmani wrote:
> Hi,
>
> i'm using umbrella sampling and i'm a beginner in GROMACS.
>
> as an example i got 5 dist.xvg files and then:
>
>>> command: perl  distances.pl
> this is distances.pl:
> #!/usr/bin/perl -w
>    use strict;
>
>
>            # write output to single file
>            open(OUT, ">>summary_distances.dat");
>
>            for (my $j=0; $j<=5; $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];
>
>           }
>
>               }
>
>
>                   close(IN);
>
>                       print OUT "$j\t$distance\n";
>
>                       }
>
>
>                       close(OUT);
>
>
>                       # clean up
>
>                       print "Cleaning up...\n";
>
>
>                       for (my $k=0; $k<=5; $k++) {
>
>                           unlink "dist${k}.xvg";
>
>                           }
>
>
>                          exit;
>
> but summary-distances.dat:
>
> 0       0.382
> 1       0.382
> 0       0.382
> 1       0.382
> 2       0.382
> 3       0.382
> 4       0.382
> 5       0.382
> ~
> ~
> ~
>
> 0.382 is just the first number in dist.xvg files;
>
> for example dist0.xvg is:
>
> # This file was created Sat Nov 25 04:47:25 2017
> # Created by:
> #                 :-) GROMACS - gmx distance, VERSION 5.1.4 (-:
> #
> # Executable:   /usr/local/gromacs/bin/gmx
> # Data prefix:  /usr/local/gromacs
> # Command line:
> #   gmx distance -s pull.tpr -f conf0.gro -n index.ndx -oall dist0.xvg
> # gmx distance is part of G R O M A C S:
> #
> #
> ¸­°<88><96><91><98>ò<90><91><8c><8b><9a><8d><8c>þ<91><9b>ü<93><90><91><96><91><98>ì<97><8d><96><92><8f><8c>
> #
> @    title "Distance"
> @    xaxis  label "Time (ps)"
> @    yaxis  label "Distance (nm)"
> @TYPE xy
>        0.000    0.382    0.382    0.383    0.383    0.383    0.383    1.178
>    0.382    0.382    0.383    0.383    0.383    0.383    0.383    0.382
> 0.818    0.382    0.382    0.382    0.382    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.382    0.382    0.383
> 0.383    0.383    0.383    1.178    0.382    0.382    0.383    0.383
> 0.383    0.383    0.383    0.382    0.818    0.382    0.382    0.382
> 0.382    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.541    0.541    0.541    0.541    0.541    0.541    0.541
> 0.541    0.151    0.237    0.160    0.242    0.123    0.147
> ~
> ~
>
> what is my mistake?is that perl script or?! or because of i selected very
> close conf.gro files (0-5)?

My Perl script expects each file to have *one* value in it, the COM 
distance between two chosen groups. Your output seems to be something 
else entirely, suggesting you didn't choose appropriate groups.

> i selected them just for testing my script and to tell the truth i didn't
> know how use gmx distance to get all 718 (configuration's) xvg files with
> just ONE command so i have to get .xvg files one by one.(would you please
> tell me?)

You don't. Run have to calculate each separately (trivial in a shell or 
other script loop), or otherwise just analyze the trajectory, get one 
time series, and do your own parsing.

>
> - it's much similar to tutorial's(by Mr Lemkul) perl script but not as same
> as it because i got some errors so i had to use gmx distance separately.

If you can tell me what the actual error are, I can help sort those out. 
As I said before, I have often heard "your script doesn't work" and then 
no one actually follows up to tell me why. If you're getting errors, I'd 
like to know so I can actually provide a solution.

-Justin

-- 
==================================================

Justin A. Lemkul, Ph.D.
Assistant Professor
Virginia Tech Department of Biochemistry

303 Engel Hall
340 West Campus Dr.
Blacksburg, VA 24061

jalemkul at vt.edu | (540) 231-3129
http://www.biochem.vt.edu/people/faculty/JustinLemkul.html

==================================================



More information about the gromacs.org_gmx-users mailing list