[gmx-users] umbrella sampling

Justin Lemkul jalemkul at vt.edu
Sat Nov 25 21:01:43 CET 2017



On 11/25/17 12:57 PM, rose rahmani wrote:
> On Sat, Nov 25, 2017 at 7:01 PM, Justin Lemkul <jalemkul at vt.edu> wrote:
>
>>
>> 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.
>>
>>
> first, when you open script file in browser ,then copy it and paste it to
> Linux, all lines will be started with "#" which makes all scripts
> inactive.That was a carelessness personally from me ;)))

Right-click, save as. Don't open or manipulate the script in a browser.

> - When i use your script,
> a)  i need to change 1-Chain_A  2-Chain_B  3- number"500"
> b)  perl distances.pl
> c) Processing configuration 0...
> Processing configuration 1...
> Processing configuration 2...
> Processing configuration 3...
> Processing configuration 4...
> Processing configuration 5...
> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.

This and the errors that follow mean the script can't find a file to 
open. I'm not sure all of what you've changed in the script, because if 
truly you are only trying to process six files (indices 0-5), then this 
shouldn't happen.

> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.
> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.
> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.
> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.
> readline() on closed filehandle IN at distances.pl line 14.
> Use of uninitialized value $distance in concatenation (.) or string at
> distances.pl line 28.
>
> i think this is the common error for most of us.Because of this, as i said
> i had to run gmx distance separately and delete these lines from perl
> scripts( which you suggested).it worked,but my problem is why my
> summarydistances.dat is like this:
> 0       0.382
> 1       0.382
> 2       0.382
> 3       0.382
> 4       0.382
> 5       0.382
> ~
>
> Oh!!!! yes you're right. Although i choose groups which i need to calculate
> distances,BUT they didn't actually move as i expected and i've been
> intending and looking for from the first!

This is the first problem you should solve. Running these 
post-processing scripts is a waste of time if your simulation didn't act 
as you expected it.

> ?-if you remember yesterday i told that the protein in getting closer to
> wall instead of ZnO!! (protein is between ZnO and wall) ,while i'm trying
> to calculate different distances between ZnO and Protein!!!! and i asked
> which part of my work may be wrong?it means that protein tends to wall more
> than ZnO????

More likely, your .mdp settings were wrong. Please post (do not attach) 
the contents of your .mdp file.

> ?- and what i don't undrstand is that how perl script calculate just "one"
> value from xvg file which contain many values?i cant understand.

When gmx distance is executed properly on a single coordinate file, 
there can (by definition) be only one COM distance between two groups. 
If you're getting anything else, you're using gmx distance wrong. Run it 
interactively to be sure you understand the syntax and can execute the 
command and get a sensible result before layering on the complexity of 
my processing script.

-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