[gmx-users] Change in distances between two atom during MD

Erik Marklund erikm at xray.bmc.uu.se
Tue Sep 11 21:57:48 CEST 2007


Right. Without looking that much at the python code I have a hard  
time understanding why one would need to make ones own program for  
this task when g_dist does the job for you.

/Erik

11 sep 2007 kl. 18.44 skrev Arthur Roberts:

> Hello,
>
> I wrote a python script to do this.  I would used pymol.  Number  
> each of the pdb files 00000ps.pdb 00250ps.pdb, etc.  Also, remove  
> the water.  Just save the file as distances.py and run in pymol.
>
> from pymol import cmd
>
> cmd.reinitialize()
> Distances=[]
> Line=''
> TimeMax=11500
> TimeIncr=0
> AA=1
> AAMax=477
> Distances.append([]) ## This is for amino acid 0
> while AA <= AAMax:
>     Message = "Amino Acid Number "+ str(AA)+'\n'
>     print Message
>     Distances.append([])
>     TimeIncr=0
>     while TimeIncr <= TimeMax:
>         PDBTime=str("%05d"%TimeIncr)
>         PDBFile = PDBTime + 'ps.pdb'
>         Message = PDBTime + '\n'
>         print Message
>         cmd.load(PDBFile)
>         ## hide everything
>         ## dist=cmd.distance('tmp', PDBTime+'ps///91/CA',PDBTime 
> +'ps///478/FE')
>         dist=cmd.distance('tmp', PDBTime+'ps///'+str(AA)+'/ 
> CA',PDBTime+'ps///478/FE')
>         if AA==1:
>             ## print "OK"
>             Distances[0].append(PDBTime)
>             Line=str("%8.3f"%dist)
>             Distances[1].append(Line)
>         else:
>             Line=str("%8.3f"%dist)
>             Distances[AA].append(Line)
>         TimeIncr=TimeIncr+250
>         cmd.reinitialize()
>     AA=AA+1
>
> DistancesTranspose=[]
>
> Increment=0
> Line = 'Time\t'
> while Increment < AAMax-1:
>     Line = Line + 'aa'+str(Increment+18)+'\t'
>     Increment=Increment+1
> Line = Line + 'aa'+str(Increment+18)+'\r\n'
> DistancesTranspose.append(Line)
>
>
> Increment=0
> while Increment <= len(Distances[0])-1:
>     NestedIncrement=0
>     Line=''
>     while NestedIncrement <= len(Distances)-1:
>
>     	if NestedIncrement >=1:
>     		DistanceDifference = str(float(Distances[NestedIncrement] 
> [Increment])-float(Distances[NestedIncrement][0]))
>     	else:
>     		DistanceDifference = str(Distances[NestedIncrement][Increment])
>     		
>     	if NestedIncrement == (len(Distances)-1):
>             Line = Line + DistanceDifference + '\r\n' ##  
> DistFile.write("%s\t" % Test)
>         else:
>             Line = Line + DistanceDifference + '\t'
>
>         NestedIncrement=NestedIncrement+1
>     DistancesTranspose.append(Line)
>     Increment=Increment +1
> 	
> Message = "Writing File ...\n"
> print Message
>
> file('distances.dat', 'w').writelines(DistancesTranspose)
>
> Best wishes,
> Art
>
> On Sep 10, 2007, at 8:36 PM, Rui Li wrote:
>
>> Hi all,
>>
>> I want to get the plot of Change in distances between two atom  
>> during MD
>> simulation.
>> what program can I use?
>> Thank you in advance
>>
>>
>> _______________________________________________
>> gmx-users mailing list    gmx-users at gromacs.org
>> http://www.gromacs.org/mailman/listinfo/gmx-users
>> Please search the archive at http://www.gromacs.org/search before  
>> posting!
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-users-request at gromacs.org.
>> Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>
> _______________________________________________
> gmx-users mailing list    gmx-users at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before  
> posting!
> Please don't post (un)subscribe requests to the list. Use thewww  
> interface or send it to gmx-users-request at gromacs.org.
> Can't post? Read http://www.gromacs.org/mailing_lists/users.php

_______________________________________________
Erik Marklund, PhD student
Laboratory of Molecular Biophysics,
Dept. of Cell and Molecular Biology, Uppsala University.
Husargatan 3, Box 596,	75124 Uppsala, Sweden
phone:	+46 18 471 4537		fax: +46 18 511 755
erikm at xray.bmc.uu.se	http://xray.bmc.uu.se/molbiophys





More information about the gromacs.org_gmx-users mailing list