This is just a longer version of what I sent before.<br>It&#39;s not Shakespeare.&nbsp; I hope at least the worst spelling mistakes are gone.<br><br>----------------------<br><br>syntax (typical usage):<br><br>&nbsp;&nbsp; xpm2matrix hbond.ndx
 groups1.ndx groups2.ndx [DA,AD] &lt; hbmap.xpm &gt; con.mat<br><br>Description:<br><br>&nbsp;&nbsp;&nbsp; This program reads .xpm files generated by &quot;g_hbond -hbm ...&quot;,<br>&nbsp;and, for each frame in the trajectory, prints out a 2-dimensional table
<br>&nbsp;indicating which pairs of atoms (or residues, or groups of atoms)<br>&nbsp;are connected together (a connectivity matrix). This table may be easier<br>&nbsp;to interpret than the original .xpm file.&nbsp; As an input it requires a pair
<br>&nbsp;of files (&quot;groups1.ndx&quot; and &quot;groups2.ndx&quot; in this example) and each file<br>&nbsp;contains a list of groups.&nbsp; (Each group typically represents the atoms<br>&nbsp;belonging to each amino acid or nucleotide in a molecule.)&nbsp; Since there
<br>&nbsp;are two lists of groups, you can look at the connectivity matrix between<br>&nbsp;two different molecules.&nbsp; The the two lists of groups do not have to<br>&nbsp;correspond to residues from different molecules.&nbsp; They can be identical.
<br>&nbsp;&nbsp;&nbsp;&nbsp; The atoms in each group are not required to be donors or acceptors<br>&nbsp;(other atoms will be ignored).&nbsp; It is possible to tell xpm2matrix<br>&nbsp;to only consider the donor atoms from one group, and the acceptor atoms
<br>&nbsp;from another group. (See &quot;DA&quot; / &quot;AD&quot; below).<br>&nbsp;&nbsp;&nbsp;&nbsp; Again, groups do not have to correspond to residues.&nbsp; Of course, there<br>&nbsp;can be multiple donors and acceptors in each group, and more than one h-bond
<br>&nbsp;connecting each pair of groups.&nbsp; For example, one of list of groups<br>&nbsp;(say &quot;groups2.ndx&quot;) might contain only a single group consisting of all<br>&nbsp;of the solvent atoms.&nbsp; In that case, for every frame in the trajectory
<br>&nbsp;xpm2matrix would simply report the number of water molecules bonded to <br>&nbsp;every residue/group in the molecule.<br><br>Output (stored in the &quot;con.mat&quot; file in the example above):<br><br>&nbsp;&nbsp;&nbsp; For each frame in the trajectory used to generate the xpm file, this
<br>&nbsp;program generates a connectivity matrix (delimited by spaces and newlines):<br><br>c11 c12 c13 ... c1n<br>c21 c22 c23 ... c2n<br>c31 c32 c33 ... c3n<br>&nbsp;:&nbsp;&nbsp; :&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :<br>cm1 cm2 cm3 ... cmn<br><br>&nbsp;where cij = the number of hydrogen bonds connecting group i (from the
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; first list of groups) with group j (from the second list)<br><br>Input:<br><br>&nbsp;hbmap.xpm&nbsp;&nbsp;&nbsp; An .xpm file created by &quot;g_hbond -hbm&quot; that you want to analyze<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (See documentation for g_hbond.)
<br><br>Arguments:<br><br>&nbsp;hbond.ndx&nbsp;&nbsp;&nbsp; The ndx file created by &quot;g_hbond -hbn ...&quot;<br>&nbsp;groups1.ndx&nbsp;&nbsp;&nbsp;&nbsp; The number of hydrogen bonds is counted between every pair<br>&nbsp;groups2.ndx&nbsp;&nbsp;&nbsp;&nbsp; of groups in these two index files: 
groups1.ndx &amp; groups2.ndx.<br>&nbsp;DA or AD&nbsp;&nbsp;&nbsp;&nbsp; The 4th argument DA / AD is optional.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; By using the &quot;DA&quot; and &quot;AD&quot; arguments, the user can limit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the atoms that the program considers from 
groups1.ndx<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and groups2.ndx.&nbsp; The DA command line argument causes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xpm2matrix to ignore all atoms from the first list of<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; groups which are not potential donor atoms, and all atoms
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from the second list which are not potential acceptors.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (The reverse is true for the AD command.)<br><br>Performance Issues:<br><br>&nbsp;This program can consume lots of memory, due to the order that data is
<br>&nbsp;saved to the xpm file, especially for long trajectories.&nbsp; If the program<br>&nbsp;is performing very slowly (running out of memory), you can get around the<br>&nbsp;problem by running g_hbond multiple times using the &quot;-b&quot; and &quot;-e&quot; flags,
<br>&nbsp;in order to generate multiple smaller .xpm files.&nbsp; You can run xpm2matrix<br>&nbsp;multiple times and concatenate the results together.<br><br><br>