diff --git a/libatomsparser/libAtomsParser.py b/libatomsparser/libAtomsParser.py index 88e1589a822c2031403a5981cf31160e6e0c6432..2ac434881cdb88009f2c346163de3d7626c34a25 100644 --- a/libatomsparser/libAtomsParser.py +++ b/libatomsparser/libAtomsParser.py @@ -66,6 +66,7 @@ def log(msg, highlight=None, enter=endl): # if osio: # if highlight==None: hightlight = osio.ww # osio << highlight << msg << enter + logging.debug(msg) return # CONTEXT GUARD @@ -109,8 +110,9 @@ def parse_without_class(output_file_name, backend, parser_info): terminal_gap.ParseOutput(output_file_name, base_dir) terminal_trj = terminal_gap.trj - + logging.debug("Start parsing...") # osio << "Start parsing ..." << osio.endl + logging.debug('Base directory = %s' % base_dir) # osio << "Base directory = '%s'" % base_dir << osio.endl gap = terminal_gap diff --git a/libatomsparser/libLibAtomsParser.py b/libatomsparser/libLibAtomsParser.py index 5ccc4cc1ccf51e611af3c266eef09c7dda3f94fa..bdff6e071ac29c20bf8a4b0b2163aa016b12f67d 100644 --- a/libatomsparser/libLibAtomsParser.py +++ b/libatomsparser/libLibAtomsParser.py @@ -23,6 +23,7 @@ import sys import re import numpy as np import xml.dom.minidom +from nomad.utils import create_uuid try: import ase @@ -197,7 +198,7 @@ class LibAtomsGapParser(LibAtomsParser): dom = xml.dom.minidom.parse(output_file) root = XmlGetUnique(dom, 'GAP_params') # Child keys should be: ['gpSparse', 'command_line', 'GAP_data', 'XYZ_data'] - #print(list(child_nodes.keys())) + # print(list(child_nodes.keys())) child_nodes = XmlGetChildDict(root) # 'GAP_params' @@ -286,16 +287,17 @@ class LibAtomsGapParser(LibAtomsParser): if key in child_nodes: node = child_nodes[key][0] text = XmlGetText(node) - trj_file = 'lib-atoms-gap.from-xml.xyz' - # ofs = open(trj_file, 'w') - # for child in node.childNodes: - # if child.nodeValue == None: continue - # ln = child.nodeValue.strip(' \n') - # if ln == '': continue - # ofs.write(ln+'\n') - # ofs.close() + unique_ID = create_uuid() + trj_file = '/tmp/' + unique_ID + '-lib-atoms-gap.from-xml.xyz' + ofs = open(trj_file, 'w') + for child in node.childNodes: + if child.nodeValue == None: continue + ln = child.nodeValue.strip(' \n') + if ln == '': continue + ofs.write(ln+'\n') + ofs.close() self.trj = LibAtomsTrajectory(self.log) - # self.trj.ParseOutput(trj_file) + self.trj.ParseOutput(trj_file) return class LibAtomsTrajectory(LibAtomsParser):