Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble executing a Python script
    primarykey
    data
    text
    <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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload