diff --git a/parser/parser-elastic/elastic_parser_input.py b/parser/parser-elastic/elastic_parser_input.py deleted file mode 100644 index 63b69f08b8be3b89afc4e7d10e67a10e423e7210..0000000000000000000000000000000000000000 --- a/parser/parser-elastic/elastic_parser_input.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 2016-2018 The NOMAD Developers Group -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com> -import xml.sax -import logging -import numpy as np -from nomadcore.unit_conversion.unit_conversion import convert_unit_function -from nomadcore.unit_conversion.unit_conversion import convert_unit -from nomadcore.unit_conversion import unit_conversion - -class InputHandler(xml.sax.handler.ContentHandler): - - def __init__(self, backend): - self.backend = backend - self.inputSectionGIndex = -1 - self.basevect = [] - self.latticeDummy = '' - self.CurrentData = '' - self.atomCoor = [] - self.atomCoorDummy = [] - self.speciesfileDummy = '' - self.speciesfile = [] - self.scale = 1 - self.cell = [] - self.cellDummy = [] - - def endDocument(self): - bohr_to_m = convert_unit(1, "bohr", "m") - for i in range(0,len(self.cellDummy)): - for j in range(0,3): - self.cell[i].append(float(self.cellDummy[i][j])*self.scale*bohr_to_m) - self.backend.addValue("lattice_vectors", self.cell) - self.backend.addValue('atom_positions',self.atomCoor) - for i in range(0,len(self.atomCoor)): - self.speciesfile.append(self.speciesfileDummy) - self.backend.addValue("atom_labels", self.speciesfile) - def startElement(self, name, attrs): - self.CurrentData = name - if name == "crystal": - self.scale = float(attrs.getValue('scale')) - elif name == 'species': - self.speciesfileDummy = attrs.getValue('speciesfile')[:-4] - elif name == 'atom': - self.atomCoorDummy = attrs.getValue('coord').split() - for j in range(0,3): - self.atomCoorDummy[j]=float(self.atomCoorDummy[j]) - self.atomCoor.append(self.atomCoorDummy) - else: - pass - - def endElement(self, name): - pass - - def characters(self, content): - if self.CurrentData == 'basevect': - self.latticeDummy = content - lattice = self.latticeDummy.split() - if lattice != []: - self.cellDummy.append(lattice) - self.cell.append([]) - else: - pass - -def parseInput(inF, backend): - handler = InputHandler(backend) - logging.error("will parse") - xml.sax.parse(inF, handler) - logging.error("did parse") diff --git a/parser/parser-elastic/elastic_parser_input_exciting.py b/parser/parser-elastic/elastic_parser_input_exciting.py index 78b4dd6ac9de60b51932d957ac519dc9f826e4e2..e4fd63be0f7231409683cfe5eb73c0dddd8e48a0 100644 --- a/parser/parser-elastic/elastic_parser_input_exciting.py +++ b/parser/parser-elastic/elastic_parser_input_exciting.py @@ -1,4 +1,4 @@ -# Copyright 2016-2018 The NOMAD Developers Group +# Copyright 2017-2018 Lorenzo Pardini # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,8 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com> + import xml.sax import logging import numpy as np diff --git a/parser/parser-elastic/elastic_parser_input_wien2k.py b/parser/parser-elastic/elastic_parser_input_wien2k.py index 63b69f08b8be3b89afc4e7d10e67a10e423e7210..93a17d3f2132b28c5a0e23a83ce620abb666dbd2 100644 --- a/parser/parser-elastic/elastic_parser_input_wien2k.py +++ b/parser/parser-elastic/elastic_parser_input_wien2k.py @@ -1,4 +1,4 @@ -# Copyright 2016-2018 The NOMAD Developers Group +# Copyright 2017-2018 Lorenzo Pardini # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,8 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com> + import xml.sax import logging import numpy as np diff --git a/parser/parser-elastic/parser_elastic.py b/parser/parser-elastic/parser_elastic.py index 8735ac5f2a5d5c6b930550d548cd2ecea497f09a..b916c90ba618480079cb401ade51c6845f090f35 100644 --- a/parser/parser-elastic/parser_elastic.py +++ b/parser/parser-elastic/parser_elastic.py @@ -1,4 +1,4 @@ -# Copyright 2016-2018 The NOMAD Developers Group +# Copyright 2017-2018 Lorenzo Pardini # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,8 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com> + from builtins import object import setup_paths import numpy as np