Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Markus Scheidgen
parser-exciting
Commits
dca9e01f
Commit
dca9e01f
authored
Oct 10, 2016
by
Pardini, Lorenzo (lopa)
Browse files
fixed bug with atomic positions
parent
2d437e39
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
parser/parser-exciting/exciting_parser_input.py
deleted
100644 → 0
View file @
2d437e39
import
xml.sax
import
logging
class
InputHandler
(
xml
.
sax
.
handler
.
ContentHandler
):
def
__init__
(
self
,
backend
):
self
.
backend
=
backend
self
.
inputSectionGIndex
=
-
1
self
.
inInput
=
False
def
endDocument
(
self
):
pass
def
startElement
(
self
,
name
,
attrs
):
if
name
==
"structure"
:
self
.
inputSectionGIndex
=
self
.
backend
.
openSection
(
"section_system"
)
self
.
inInput
=
True
elif
name
==
"atom"
and
self
.
inInput
:
g
=
attrs
.
getValue
(
'coord'
)
# print ("coord=", g)
# self.backend.addValue("atom_positions",float(attrs.getValue('coord')))
# self.backend.addValue("x_exciting_dos_energy",float(attrs.getValue('e')))
# attrDict={}
# for name in attrs.getNames():
# attrDict[name] = attrs.getValue(name)
# logging.error("start element %s attr %s", name, attrDict)
def
endElement
(
self
,
name
):
if
name
==
'structure'
:
self
.
inInput
=
False
self
.
backend
.
closeSection
(
"section_system"
,
self
.
inputSectionGIndex
)
self
.
inputSectionGIndex
=
-
1
# logging.error("end element %s", name)
# def startElementNS(self, name, qname, attrs):
# attrDict={}
# for name in attrs.getNames():
# attrDict[name] = attrs.getValue(name)
# logging.error("start element %s ns %s attr %s", name, qname, attrDict)
# def endElementNS(self, name, qname):
# logging.error("end element %s ns %s", name, qname)
# def characters(self, content):
# pass
def
parseInput
(
inF
,
backend
):
handler
=
InputHandler
(
backend
)
logging
.
error
(
"will parse"
)
xml
.
sax
.
parse
(
inF
,
handler
)
logging
.
error
(
"did parse"
)
parser/parser-exciting/out
View file @
dca9e01f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment