<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?action=history&amp;feed=atom&amp;title=Path2pdb.py</id>
	<title>Path2pdb.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?action=history&amp;feed=atom&amp;title=Path2pdb.py"/>
	<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Path2pdb.py&amp;action=history"/>
	<updated>2026-04-13T11:01:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Path2pdb.py&amp;diff=1264&amp;oldid=prev</id>
		<title>Adk44: Created page with &quot;Script useful for AMBER9 and NAB users   &#039;&#039;path.info&#039;&#039; file can be easy converted to the PDB format using Python program presented below. PDB file can be loaded to VMD and you...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/ro-walesdocs/wiki/index.php?title=Path2pdb.py&amp;diff=1264&amp;oldid=prev"/>
		<updated>2019-05-13T10:58:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Script useful for AMBER9 and NAB users   &amp;#039;&amp;#039;path.info&amp;#039;&amp;#039; file can be easy converted to the PDB format using Python program presented below. PDB file can be loaded to VMD and you...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Script useful for AMBER9 and NAB users&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;path.info&amp;#039;&amp;#039; file can be easy converted to the PDB format using Python program presented below. PDB file can be loaded to VMD and you can visualize your path. Because of simplicity all residues have the same name ALA therefore better is to load topology file and as next the PDB file. &lt;br /&gt;
&lt;br /&gt;
To do this save the code in &amp;#039;&amp;#039;path2pdb.py&amp;#039;&amp;#039; file, change privileges of this file:&lt;br /&gt;
&lt;br /&gt;
 chmod 755 path2pdb.py&lt;br /&gt;
&lt;br /&gt;
and type:&lt;br /&gt;
&lt;br /&gt;
 ./path2pdb.py&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 #!/usr/bin/env python&lt;br /&gt;
 &lt;br /&gt;
 import sys&lt;br /&gt;
 import string&lt;br /&gt;
 &lt;br /&gt;
 ###############################################################&lt;br /&gt;
 ##                                                            #&lt;br /&gt;
 ## Edyta Malolepsza                                           #&lt;br /&gt;
 ## David Wales&amp;#039; group, University of Cambridge                #&lt;br /&gt;
 ## in case of problems please send email: em427@cam.ac.uk     #&lt;br /&gt;
 ##                                                            #&lt;br /&gt;
 ###############################################################&lt;br /&gt;
 ##&lt;br /&gt;
 ## transform path.info into path_all.pdb&lt;br /&gt;
 ## ./path2pdb.py&lt;br /&gt;
 ##&lt;br /&gt;
 ###############################################################&lt;br /&gt;
 &lt;br /&gt;
 prmtop = open(&amp;quot;coords.prmtop&amp;quot;).read()&lt;br /&gt;
 f = string.split(prmtop, &amp;quot;\n&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 q0 = f.index(&amp;quot;%FLAG POINTERS                                                                  &amp;quot;)&lt;br /&gt;
 q1 = f.index(&amp;quot;%FLAG ATOM_NAME                                                                 &amp;quot;)&lt;br /&gt;
 q2 = f.index(&amp;quot;%FLAG RESIDUE_LABEL                                                             &amp;quot;)&lt;br /&gt;
 q3 = f.index(&amp;quot;%FLAG RESIDUE_POINTER                                                           &amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 ## names of tables are related to names in prmtop file&lt;br /&gt;
 &lt;br /&gt;
 atomNumber = int(string.split(f[q0+2])[0])&lt;br /&gt;
 &lt;br /&gt;
 atomName = []&lt;br /&gt;
 residueLabel = []&lt;br /&gt;
 &lt;br /&gt;
 an = 0&lt;br /&gt;
 line = 0&lt;br /&gt;
 while (an&amp;lt;atomNumber):&lt;br /&gt;
   for j in range(20):&lt;br /&gt;
     if (an&amp;lt;atomNumber):&lt;br /&gt;
       an = an+1&lt;br /&gt;
       atomName.append(f[q1+2+line][j*4:(j+1)*4].strip())&lt;br /&gt;
     else:&lt;br /&gt;
       break&lt;br /&gt;
   line = line+1&lt;br /&gt;
 &lt;br /&gt;
 for i in range(q3-q2-2):&lt;br /&gt;
   for j in range((len(f[q2+2+i])+1)/4):&lt;br /&gt;
     residueLabel.append(string.strip(f[q2+2+i][j*4:4*(j+1)]))&lt;br /&gt;
 &lt;br /&gt;
 info = open(&amp;quot;path.info&amp;quot;).read()&lt;br /&gt;
 ff = string.split(info, &amp;quot;\n&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 xyz = open(&amp;#039;path_all.pdb&amp;#039;,&amp;#039;w&amp;#039;)&lt;br /&gt;
 &lt;br /&gt;
 for i in range(len(ff)/(2+2*atomNumber)):&lt;br /&gt;
     m = atomNumber*2+2     # number of lines for each stationary points&lt;br /&gt;
     l = atomNumber+2       # number of lines before coordinates&lt;br /&gt;
     mm = 1                 # number of residue&lt;br /&gt;
     for j in range(atomNumber):&lt;br /&gt;
         x = float(string.split(ff[m*i+l+j])[0])&lt;br /&gt;
         y = float(string.split(ff[m*i+l+j])[1])&lt;br /&gt;
         z = float(string.split(ff[m*i+l+j])[2])&lt;br /&gt;
         if (atomName[j]==&amp;#039;N&amp;#039; and atomName[j+1]==&amp;#039;H&amp;#039;):&lt;br /&gt;
             mm = mm+1&lt;br /&gt;
         else:&lt;br /&gt;
             xyz.write(&amp;quot;%4s%7d %-4s %4s%5d%12.3f%8.3f%8.3f\n&amp;quot; % (&amp;#039;ATOM&amp;#039;, j+1, atomName[j], &amp;#039;ALA&amp;#039;, mm, x, y, z))&lt;br /&gt;
     xyz.write(&amp;quot;END\n&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 xyz.write(&amp;quot;\n&amp;quot;)&lt;br /&gt;
 xyz.close()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039;: this script works when &amp;#039;&amp;#039;path.info&amp;#039;&amp;#039; file was obtain without NOFRQS keyword. If NOFRQS was used, please, change values of two variables:&lt;br /&gt;
&lt;br /&gt;
     m = atomNumber+2     # number of lines for each stationary points&lt;br /&gt;
     l = 2                # number of lines before coordinates&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Bug fix: &lt;br /&gt;
There was bug when used with &amp;#039;&amp;#039;path.info&amp;#039;&amp;#039; output of A9OPTIM. To fix, edit if-else statement as below:&lt;br /&gt;
&lt;br /&gt;
        z = float(string.split(ff[m*i+l+j])[2])&lt;br /&gt;
        # bug fix on 12 Jan 2012. ss2029  &lt;br /&gt;
        if (atomName[j]==&amp;#039;N&amp;#039; and atomName[j+1]==&amp;#039;H&amp;#039;):&lt;br /&gt;
            mm = mm+1&lt;br /&gt;
        xyz.write(&amp;quot;%4s%7d %-4s %4s%5d%12.3f%8.3f%8.3f\n&amp;quot; % (&amp;#039;ATOM&amp;#039;, j+1, atomName[j], &amp;#039;ALA&amp;#039;, mm, x, y, z))&lt;/div&gt;</summary>
		<author><name>Adk44</name></author>
	</entry>
</feed>