[gmx-users] g_rms with two trajectories

Julian julimoxx at gmail.com
Mon Feb 9 16:55:43 CET 2015


After some further search I found this very useful script which converts
xpm to digits. This has solved my problem.

#!/usr/bin/env python

import sys

def unquote(s):
    return s[1+s.find('"'):s.rfind('"')]

def uncomment(s):
    return s[2+s.find('/*'):s.rfind('*/')]

def col(c):
    color = c.split('/*')
    value = unquote(color[1])
    color = unquote(color[0]).split()
    sys.stderr.write("%s: %s %s %s\n"%(c.strip(),color[0], color[1], value))
    return color[0], value

# Open the xpm file for reading
xpm = open(sys.argv[1])

# Read in lines until we fidn the start of the array
meta = [xpm.readline()]
while not meta[-1].startswith("static char *gromacs_xpm[]"):
    meta.append(xpm.readline())

# The next line will contain the dimensions of the array
dim = xpm.readline()
# There are four integers surrounded by quotes
nx, ny, nc, nb = [int(i) for i in unquote(dim).split()]

# The next dim[2] lines contain the color definitions
# Each pixel is encoded by dim[3] bytes, and a comment
# at the end of the line contains the corresponding value
colors = dict([col(xpm.readline()) for i in range(nc)])

for i in xpm:
    if i.startswith("/*"):
        continue
    j = unquote(i)
    z = [colors[j[k:k+nb]] for k in range(0,nx,nb)]
    sys.stdout.write(" ".join(z)+"\n")


https://mailman-1.sys.kth.se/pipermail/gromacs.org_gmx-users/2010-October/054557.html


2015-02-09 15:16 GMT+01:00 Julian <julimoxx at gmail.com>:

> Dear Erik,
>
> I have the matrix and I converted it with xpm2ps into a coloured image.
>
> I want to compare the ligands at the "same time"  so I would be interested
> in the diagonal.
>
> Which is the best way to get from the xpm matrix the diagonal plotted in
> 2d as a function of time and rmsd value?
>
> Best regards,
> Julian
>
> Message: 5
>> Date: Mon, 9 Feb 2015 12:28:04 +0000
>> From: Erik Marklund <erik.marklund at chem.ox.ac.uk>
>> To: "gmx-users at gromacs.org" <gmx-users at gromacs.org>
>> Subject: Re: [gmx-users] g_rms with two trajectories
>> Message-ID: <B783245E-BBC6-45DD-908F-CD21B2DA3F80 at chem.ox.ac.uk>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Dear Julian,
>>
>> Use the -m flag.
>>
>> Kind regards,
>> Erik
>>
>>
>> Erik Marklund, PhD
>> Postdoctoral Research Fellow, Fulford JRF
>>
>> Department of Chemistry
>> Physical & Theoretical Chemistry Laboratory
>> University of Oxford
>> South Parks Road
>> Oxford
>> OX1 3QZ
>>
>>
>> On 9 Feb 2015, at 12:20, Julian <julimoxx at gmail.com<mailto:
>> julimoxx at gmail.com>> wrote:
>>
>> Dear Gromacs Users,
>>
>> I want to calculate the rmsd between two ligands - the system is exactly
>> the same, just the ligand binding conformations are different.
>>
>> Therefore i want to use g_rms with the option -f2 as in the following
>> command:
>>
>> g_rms -f trajout.trr -f2 ../2/trajout.trr  -n -o
>>
>> In g_rms -h it says that this "generates a comparison matrix of one
>> trajectory versus the other" but I don't get this matrix.
>> Only the "normal" rmsd.xvg but it seems as it is calculated to the
>> starting
>> snapshot and the f2-trajectory file is not considered.
>>
>> Could anyone explain me how I execute this command correctly?
>>
>> Thanks and best regards!
>> --
>> Gromacs Users mailing list
>>
>> * Please search the archive at
>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>> posting!
>>
>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>
>> * For (un)subscribe requests visit
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>> send a mail to gmx-users-request at gromacs.org<mailto:
>> gmx-users-request at gromacs.org>.
>>
>


More information about the gromacs.org_gmx-users mailing list