<div dir="ltr"><div>Hi,</div><div><br></div><div>Just some minor modifications then,</div><div><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span style="color:#008">for</span><span style="color:#000"> </span><span style="color:#660">((</span><span style="color:#000">i</span><span style="color:#660">=</span><span style="color:#066">0</span><span style="color:#660">;</span><span style="color:#000"> i</span><span style="color:#660"><</span><span style="color:#066">310</span><span style="color:#660">;</span><span style="color:#000"> i</span><span style="color:#660">++));</span><span style="color:#000"> </span><span style="color:#008">do</span><span style="color:#000"> a</span><span style="color:#660">=</span><span style="color:#080">`echo "30 + $RANDOM/30" | bc`</span><span style="color:#660">;</span><span style="color:#000"> b</span><span style="color:#660">=</span><span style="color:#080">`echo "30 + $RANDOM/30" | bc`</span><span style="color:#660">;</span><span style="color:#000"> c</span><span style="color:#660">=</span><span style="color:#080">`echo "30 + $RANDOM/30" | bc`</span><span style="color:#660">;</span><span style="color:#000"> vol</span><span style="color:#660">=</span><span style="color:#080">`echo "$a*$b*$c" | bc`</span><span style="color:#660">;</span><span style="color:#000"> echo </span><span style="color:#080">"$i $i $a 0 0 0 $b 0 0 0 $c $vol"</span><span style="color:#660">;</span><span style="color:#000"> </span><span style="color:#008">done</span><span style="color:#000"> </span><span style="color:#660">></span><span style="color:#000"> foo</span><span style="color:#660">-</span><span style="color:#066">1.cell</span><br></div></code></div></div><div><br></div><div>Just swap out the cell specification by angles with the 9 component one,</div><div><br></div><div><div style="background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span style="color:#606">#!/usr/bin/env python3<br><br>'''<br>usage: python3 xyzcell2gro.py<br><br>Reads XMOL format file, adds lattice parameters, dumps Gromos file that can<br>be read by VMD.<br>'''<br><br>import glob<br>import os<br>import sys<br>import numpy as np<br><br>import ase<br>from <a href="http://ase.io" target="_blank">ase.io</a> import read, write<br><br>dir = os.getcwd()<br><br># trajectory is XMOL format<br># cell       is step time ax ay az bx by bz cx cy cz vol<br>for file in glob.glob('%s/*-pos-*.xyz' % dir):<br>   filename, fileext = os.path.splitext(file)<br>   fileroot, filescrap = filename.split('-pos')<br>   trj = read('%s%s' % (filename, fileext) , format='xyz', index=':')<br>   cel = np.loadtxt('%s-1.cell' % (fileroot), usecols=range(2,11), dtype=np.double)<br>   nframes = len(trj)<br>   for frame in range(nframes):<br>      trj[frame].set_cell([(cel[frame][0], cel[frame][1], cel[frame][2]),<br>                           (cel[frame][3], cel[frame][4], cel[frame][5]),<br>                           (cel[frame][6], cel[frame][7], cel[frame][8])])<br>      trj[frame].set_pbc([True, True, True])<br>      write('%s.g96' % (fileroot), trj[frame], format='gromos', append=True)</span><span style="color:#660"></span></div></code></div><br>-T<br></div><div><br></div><div><br></div>On Wednesday, October 23, 2019 at 4:52:29 PM UTC-3, Ant wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thank you very much, Travis! <br></div><div><br></div><div>Here are the first few lines of a .cell file directly from CP2K (below).  My cells are all cubic (90 degree angles, equal dimensions), so I can change these to three columns; e.g., Ax, By, Cz.<br></div><div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-family:Calibri,sans-serif;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="1"><span style="color:rgb(0,0,0)"><span style="background-color:rgb(255,255,255)"><span style="font-family:Courier">Step   Time [fs]       Ax [Angstrom]       Ay [Angstrom]       Az [Angstrom]       Bx [Angstrom]       By [Angstrom]       Bz [Angstrom]       Cx [Angstrom]       Cy [Angstrom]       Cz [Angstrom]      Volume [Angstrom^3]</span></span></span></font></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-family:Calibri,sans-serif;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="1"><span style="color:rgb(0,0,0)"><span style="background-color:rgb(255,255,255)"><span style="font-family:Courier">       0       0.000       13.6105000000        0.0000000000        0.0000000000        0.0000000000       13.6105000000        0.0000000000        0.0000000000        0.0000000000       13.6105000000          2521.2867393576</span></span></span></font></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-family:Calibri,sans-serif;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="1"><span style="color:rgb(0,0,0)"><span style="background-color:rgb(255,255,255)"><span style="font-family:Courier">       1       0.500       13.6102685896        0.0000000000        0.0000000000        0.0000000000       13.6102685896        0.0000000000        0.0000000000        0.0000000000       13.6102685896          2521.1581382194</span></span></span></font></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-family:Calibri,sans-serif;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="1"><span style="color:rgb(0,0,0)"><span style="background-color:rgb(255,255,255)"><span style="font-family:Courier">       2       1.000       13.6101388560        0.0000000000        0.0000000000        0.0000000000       13.6101388560        0.0000000000        0.0000000000        0.0000000000       13.6101388560          2521.0860435793</span></span></span></font></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-family:Calibri,sans-serif;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="1"><span style="color:rgb(0,0,0)"><span style="background-color:rgb(255,255,255)"><span style="font-family:Courier">       3       1.500       13.6101072636        0.0000000000        0.0000000000        0.0000000000       13.6101072636        0.0000000000        0.0000000000        0.0000000000       13.6101072636          2521.0684874332</span></span></span></font></p></div><div><font size="1"><br></font></div><div>This is finally making sense.  Now I understand why I have a problem.  My simple XYZ trajectories don't contain my cell dimensions.  Your code adds the cell dimensions and then I can read that new file right into the GUI where I would usually read in my simple XYZ file.  It's great to finally understand what is going on.  Thank you very much.<br></div></div></blockquote></div>