Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-lib-atoms
Commits
22bc82b9
Commit
22bc82b9
authored
Mar 04, 2019
by
Daniel Speckhard
Browse files
Fixed trajectory file.
parent
d7bfc62d
Changes
2
Hide whitespace changes
Inline
Side-by-side
libatomsparser/libAtomsParser.py
View file @
22bc82b9
...
...
@@ -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
...
...
libatomsparser/libLibAtomsParser.py
View file @
22bc82b9
...
...
@@ -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
):
...
...
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