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
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
Markus Scheidgen
parser-exciting
Commits
042c3311
Commit
042c3311
authored
Aug 18, 2016
by
Pardini, Lorenzo (lopa)
Browse files
added conversion for eigenvalues
parent
5bc13711
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser/parser-exciting/parser_exciting.py
View file @
042c3311
...
...
@@ -4,6 +4,7 @@ import numpy as np
from
nomadcore.simple_parser
import
SimpleMatcher
as
SM
,
mainFunction
from
nomadcore.local_meta_info
import
loadJsonFile
,
InfoKindEl
from
nomadcore.caching_backend
import
CachingLevel
from
nomadcore.unit_conversion
import
unit_conversion
import
os
,
sys
,
json
,
exciting_parser_dos
,
exciting_parser_bandstructure
class
ExcitingParserContext
(
object
):
...
...
@@ -53,12 +54,44 @@ class ExcitingParserContext(object):
dirPath
=
os
.
path
.
dirname
(
self
.
parser
.
fIn
.
name
)
dosFile
=
os
.
path
.
join
(
dirPath
,
"dos.xml"
)
bandFile
=
os
.
path
.
join
(
dirPath
,
"bandstructure.xml"
)
eigvalFile
=
os
.
path
.
join
(
dirPath
,
"EIGVAL.OUT"
)
if
os
.
path
.
exists
(
dosFile
):
with
open
(
dosFile
)
as
f
:
exciting_parser_dos
.
parseDos
(
f
,
backend
)
if
os
.
path
.
exists
(
bandFile
):
with
open
(
bandFile
)
as
g
:
exciting_parser_bandstructure
.
parseBand
(
g
,
backend
)
if
os
.
path
.
exists
(
eigvalFile
):
eigvalGIndex
=
backend
.
openSection
(
"section_eigenvalues"
)
with
open
(
eigvalFile
)
as
g
:
eigvalKpoint
=
[]
eigvalVal
=
[[],[]]
eigvalOcc
=
[]
fromH
=
unit_conversion
.
convert_unit_function
(
"hartree"
,
"J"
)
while
1
:
s
=
g
.
readline
()
if
not
s
:
break
s
=
s
.
strip
()
# print ("s= ", s)
# print ("len(s)= ", len(s))
if
len
(
s
)
<
20
:
continue
elif
len
(
s
)
>
50
:
eigvalVal
[
0
].
append
([])
eigvalVal
[
1
].
append
([])
eigvalKpoint
.
append
(
list
(
map
(
float
,
s
.
split
()[
1
:
4
])))
# print ("eigvalKpoint= ", eigvalKpoint)
else
:
try
:
int
(
s
[
0
])
except
ValueError
:
continue
else
:
n
,
e
,
occ
=
s
.
split
()
eigvalVal
[
0
][
-
1
].
append
(
int
(
n
))
eigvalVal
[
1
][
-
1
].
append
(
fromH
(
float
(
e
)))
# print ("eigvalVal= ", eigvalVal)
backend
.
addArrayValues
(
"eigenvalues_kpoints"
,
np
.
asarray
(
eigvalKpoint
))
backend
.
addArrayValues
(
"eigenvalues_values"
,
np
.
asarray
(
eigvalVal
))
def
onClose_section_system
(
self
,
backend
,
gIndex
,
section
):
backend
.
addArrayValues
(
'configuration_periodic_dimensions'
,
np
.
asarray
([
True
,
True
,
True
]))
...
...
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