Commit beb8bee0 by Francois Gygi

Cleanup trailing spaces in util scripts

parent 3137cbda
......@@ -4,5 +4,5 @@
# use: get_atomset sample.xml
#
nlines=$(grep /atomset -m 1 -n $1 | cut -f1 -d: - )
head -$nlines $1
head -$nlines $1
echo "</fpmd:sample>"
......@@ -36,7 +36,7 @@ de = (emax - emin)/(ndos-1)
# f(x) = 1/(sqrt(pi)*width) * exp(-(x/width)^2 )
def gauss(x, width):
return (1.0/(math.sqrt(math.pi)*width)) * math.exp(-(x/width)**2)
# Qbox output handler to extract and process data
class QboxOutputHandler(xml.sax.handler.ContentHandler):
def __init__(self):
......
......@@ -73,9 +73,9 @@ for h in hlist:
print "# current ",h[1]," at ", h[3],h[4],h[5]
print "# nearest O is at ", nearest_o[3],nearest_o[4],nearest_o[5]
print "# move ",h[1]," by ", sx_min, sy_min, sz_min
h[3] += sx_min
h[4] += sy_min
h[5] += sz_min
h[3] += sx_min
h[4] += sy_min
h[5] += sz_min
for o in olist:
print o[0],o[1],o[2],'%10.5f'%o[3],'%10.5f'%o[4],'%10.5f'%o[5]
......
......@@ -7,7 +7,7 @@
# use: qbox_species_temp.sh species_name file [file ...]
#
if (($#<2))
then echo " use: qbox_species_temp.sh species file [file ...]"
then echo " use: qbox_species_temp.sh species file [file ...]"
exit 1
fi
species=$1
......
#!/bin/bash
# qbox_translate: translate all atoms
# qbox_translate: translate all atoms
# use: qbox_replicate cell.sys dx dy dz > newcell.sys
#
if (( $# != 4 ))
......
......@@ -3,7 +3,7 @@
# This file is part of Qbox
#
# qbox_xyz.py: extract sets of atomic positions in xyz format
# from a Qbox output file or from a Qbox sample file using SAX
# from a Qbox output file or from a Qbox sample file using SAX
# incremental parsing
#
# use: qbox_xyz.py [-first] {file|URL}
......
......@@ -45,10 +45,10 @@ class AtomSet:
class Sample:
def __init__(self):
self.atoms = AtomSet()
# The following handler processes the <atomset> element of
# an XML document and updates the AtomSet data of the Sample
# If multiple instances of <atomset> are found, the
# If multiple instances of <atomset> are found, the
# handler overwrites the AtomSet data
class QSOAtomSetHandler(xml.sax.handler.ContentHandler):
def __init__(self,sample):
......@@ -73,7 +73,7 @@ class QSOAtomSetHandler(xml.sax.handler.ContentHandler):
self.s.atoms.cell.a = attributes["a"]
self.s.atoms.cell.b = attributes["b"]
self.s.atoms.cell.c = attributes["c"]
elif (name == "species"):
elif (name == "species"):
self.inSpecies = True
self.species_name = "species_name"
if "name" in attributes:
......@@ -83,9 +83,9 @@ class QSOAtomSetHandler(xml.sax.handler.ContentHandler):
self.species_href = attributes["href"]
self.species_symbol = self.species_name+"_symbol"
self.species_atomic_number = self.species_name+"_atomic_number"
self.species_mass = self.species_name+"_mass"
self.species_mass = self.species_name+"_mass"
elif (name == "atom") and self.inAtomSet:
self.inAtom = True
self.inAtom = True
self.atom_name = attributes["name"]
self.atom_species = attributes["species"]
sp = Species(self.species_name,self.species_href,self.species_symbol,
......@@ -124,7 +124,7 @@ class QSOAtomSetHandler(xml.sax.handler.ContentHandler):
x = float(pos[0])
y = float(pos[1])
z = float(pos[2])
self.atom_position = [x,y,z]
self.atom_position = [x,y,z]
self.inPosition = False
if (name == "velocity") and self.inAtom:
vel = self.buffer.split()
......
#!/usr/bin/python
# Convert <atomset> elements from quantum-simulation.org (QSO) format
# Convert <atomset> elements from quantum-simulation.org (QSO) format
# to Qbox input file
# use: qso2qbox.py [-last] {file|URL}
# Default: only the first <atomset> element is processed
......@@ -10,7 +10,7 @@ import os.path
import xml.sax
import sys
import urllib2
import datetime
import datetime
def usage():
print "use: ",sys.argv[0]," [-last] {file|URL}"
......
......@@ -18,7 +18,7 @@ xmlns:fpmd="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0">
</xsl:template>
<xsl:template match="atom">
<xsl:text>move </xsl:text>
<xsl:value-of select="@name"/>
<xsl:value-of select="@name"/>
<xsl:text> to </xsl:text>
<xsl:value-of select="position"/> <xsl:text>
</xsl:text>
......
......@@ -32,8 +32,8 @@ xmlns:fpmd="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0">
<xsl:text>atom </xsl:text>
<xsl:value-of select="@name"/> <xsl:text> </xsl:text>
<xsl:value-of select="@species"/> <xsl:text> </xsl:text>
<xsl:value-of select="position"/> <xsl:text> </xsl:text>
<xsl:value-of select="velocity"/> <xsl:text>
<xsl:value-of select="position"/> <xsl:text> </xsl:text>
<xsl:value-of select="velocity"/> <xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="*"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment