AMBER Archive (2002)

Subject: Re: Follow distances during MD

From: Raik Grunberg (raik_at_pasteur.fr)
Date: Thu Apr 11 2002 - 07:49:16 CDT


ptraj is the optimal tool for that. You need to write a small input file:

trajin md.crd
distance DIST @atom_number1 @atom_number2 out ptraj.out
go

then you run ptraj:

>ptraj prmtop ptraj.inp

where prmtop is your topology file, ptraj.inp and the 3-line input file.

and here comes everything as python script, in case you want to do it
several times:

mdist.py:
----------------
from sys import *
import commands
 
def ptraj_distance(f_top, f_crd, atom1, atom2):
    """call ptraj and dump 2 column list with frame
vs. interatom-distance"""
    # form ptraj input file
    ptraj_input = open('ptraj.inp','w')
    ptraj_input.write("""trajin %s
distance DIST @%d @%d out ptraj.out
go
""" % (f_crd, atom1, atom2))
    ptraj_input.close()
    try:
        print 'calling ptraj...please wait'
        print commands.getoutput('ptraj %s ptraj.inp' % f_top)
        print commands.getoutput('rm ptraj.inp')
    except:
        print "Error while creating ptraj input file."
 
#######################
# MAIN
#######################
if __name__ == '__main__':
    if len (argv) < 5: # at least 4 arguments
        print """Syntax: mdist |prmtop| |mdcrd| |atom1| |atom2|"""
    else:
        ptraj_distance(argv[1], argv[2], int(argv[3]), int(argv[4]))
--------------
That's it. Just call it "python mdist.py prmtop myMd.crd 23 195".

Ciao
Raik

On Thu, 11 Apr 2002, Francois Dupradeau wrote:

|Dear All,
|
|I would like to follow distances between 2 atoms during MD runs. Which
|AMBER program should I use and could you give me advice on the
|corresponding input ?
|
|I would like to get y=f(x) data to display them in graphical program....
|
|Thanks, Regards, Francois
|
|

=====================================================
Raik Grünberg | Bioinformatique Structurale
                        | Institut Pasteur
                        | 25-28 rue du docteur Roux
raik_at_pasteur.fr | 75015 Paris
Tel: +33/1.45.68.87.37 | France
-----------------------------------------------------
        http://www.raiks.de/contact.html
=====================================================