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

Arthur Roberts aroberts99163 at yahoo.com
Tue Sep 11 18:44:38 CEST 2007


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




More information about the gromacs.org_gmx-users mailing list