Skip to content

Commit

Permalink
refactor xml2qeinput so that is uses fetch schema
Browse files Browse the repository at this point in the history
to use fetch schema the source must be passed to the constructor
otherwise a default schema is used instead of the one indicated
by the schemaLocation attribute
  • Loading branch information
pietrodelugas committed Apr 20, 2023
1 parent eed8e09 commit c9466b3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scripts/xml2qeinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,26 @@ def parse_args():
root = tree.getroot()
element_name = root.tag.split('}')[-1]
if element_name == 'espresso':
xml_document = qeschema.PwDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.PwDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'nebRun':
xml_document = qeschema.NebDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.NebDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'espressoph':
xml_document = qeschema.PhononDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.PhononDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'tddfpt':
xml_document = qeschema.TdDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.TdDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'spectrumDoc':
xml_document = qeschema.TdSpectrumDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.TdSpectrumDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'xspectra':
xml_document = qeschema.XSpectraDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.XSpectraDocument(source=input_fn, schema=INPUT_SCHEMA)
elif element_name == 'epw':
xml_document = qeschema.EPWDocument(schema=INPUT_SCHEMA)
xml_document = qeschema.EPWDocument(souce=input_fn, schema=INPUT_SCHEMA)
else:
sys.stderr.write("Could not find correct XML in %s, exiting...\n" % input_fn)
sys.exit(1)

root = None
tree = None

xml_document.read(input_fn)
qe_in = xml_document.get_fortran_input()

input_fn_name, input_fn_ext = os.path.splitext(input_fn)
Expand Down

0 comments on commit c9466b3

Please sign in to comment.