Trouble executing a Python script
<p>I'm trying to extract information from a large output file from the program DL_POLY 4 and make it into a simpler file, formatted for some visualisation software.</p>

<p>Supposedly someone has already written a script to convert the large HISTORY output file (essentially just contains lots of text) into an .xyz (extension is arbitrary) which is the correct format to be processed by VMD. (full documentation from the script creator is available here: <a href="http://www.ccp5.ac.uk/DL_POLY_CLASSIC/FAQ/FAQ9.shtml" rel="nofollow">http://www.ccp5.ac.uk/DL_POLY_CLASSIC/FAQ/FAQ9.shtml</a>)</p>

<p>Here is the script (also available <a href="http://www.ccp5.ac.uk/DL_POLY_CLASSIC/FAQ/his2xyz.py" rel="nofollow">online</a>):</p>

<pre><code>#!/usr/bin/env python
import sys,string

atomList=['Si','Al','O_','O','H','C','Cl','Na','Zr','Y_','Mg','K','Ag','Ar']
inputFile=open(sys.argv[1],'r')
outFile=open(sys.argv[2],'w')

title=inputFile.readline()
line=inputFile.readline()

while(line!=""): 
if string.split(line)[0]=='timestep':
    timestep='step= '+string.split(line)[1]+'\n'
    totalAtom=string.split(line)[2]+'\n'    
    outFile.write(totalAtom)
    outFile.write(timestep)

if string.split(line)[0][:2] in atomList:
        atomName=string.split(line)[0][:2]+'\t'
    outFile.write(atomName)
    xyzline=inputFile.readline()
    outFile.write(xyzline)

line=inputFile.readline()

inputFile.close()
outFile.close()
</code></pre>

<p>I have tried saving the script as a file I named his2xyz.py (In the directory containing the HISTORY file) and running through Python, but this does nothing and does not produce an output.</p>

<p>Does this script look like it should work?</p>

<p>I would like to try writing my own script, but in honesty, I'm not sure how to do it.</p>
