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-wien2k
Commits
bcea07aa
Commit
bcea07aa
authored
Nov 04, 2020
by
Pavel Ondračka
Committed by
Markus Scheidgen
Jan 04, 2021
Browse files
Parse total DOS
parent
fbd5196d
Changes
1
Hide whitespace changes
Inline
Side-by-side
wien2kparser/parser_wien2k.py
View file @
bcea07aa
...
...
@@ -136,6 +136,7 @@ class Wien2kContext(object):
# write the references to section_method and section_system
backend
.
addValue
(
'single_configuration_to_calculation_method_ref'
,
self
.
secMethodIndex
)
backend
.
addValue
(
'single_configuration_calculation_to_system_ref'
,
self
.
secSystemIndex
)
fromR
=
unit_conversion
.
convert_unit_function
(
"rydberg"
,
"J"
)
if
self
.
eTot
is
not
None
:
backend
.
addValue
(
"energy_total"
,
self
.
eTot
)
...
...
@@ -154,7 +155,12 @@ class Wien2kContext(object):
# case.energyup and case.energydn for spinpolarized serial calculation
# case.energy_x files for non spinpolarized parallel calculation
# case.energyup_x and case.energydn_x for spinpolarized parallel calculation
suffixes
=
[
""
,
"up"
,
"dn"
]
if
self
.
spinPol
==
None
:
suffixes
=
[
""
,
"up"
,
"dn"
]
elif
self
.
spinPol
:
suffixes
=
[
"up"
,
"dn"
]
else
:
suffixes
=
[
""
]
spin
=
0
for
suf
in
suffixes
:
...
...
@@ -171,7 +177,6 @@ class Wien2kContext(object):
eigvalVal
.
append
([])
else
:
spin
=
0
fromR
=
unit_conversion
.
convert_unit_function
(
"rydberg"
,
"J"
)
eigvalToRead
=
0
for
l
in
g
:
if
len
(
l
)
>
90
:
...
...
@@ -203,6 +208,57 @@ class Wien2kContext(object):
backend
.
addArrayValues
(
"eigenvalues_kpoints_multiplicity"
,
np
.
asarray
(
eigvalKpointMult
))
backend
.
closeSection
(
"section_eigenvalues"
,
eigvalGIndex
)
#iterate over all dos files, for now just the total dos is supported
spin
=
0
DOS
=
[[]]
ene
=
[]
eneNorm
=
[]
for
suf
in
suffixes
:
for
n
in
range
(
1
,
50
):
fName
=
mainFile
[:
-
4
]
+
".dos"
+
str
(
n
)
+
suf
if
os
.
path
.
exists
(
fName
):
#read the DOS file
with
open
(
fName
)
as
f
:
if
suf
==
"dn"
:
spin
=
1
if
len
(
DOS
)
==
1
:
DOS
.
append
([])
ene
=
[]
eneNorm
=
[]
Ef
=
0.0
totDOScol
=
0
for
i
,
l
in
enumerate
(
f
):
l
=
l
.
split
()
if
i
==
1
:
Ef
=
float
(
l
[
1
])
if
i
==
2
:
#find out which column is the total DOS
for
j
,
w
in
enumerate
(
l
):
if
"total-DOS"
in
w
or
"TOTAL"
in
w
:
totDOScol
=
j
-
1
break
# there is no total DOS column here
if
totDOScol
==
0
:
break
if
i
>
2
:
ene
.
append
(
fromR
(
float
(
l
[
0
])))
eneNorm
.
append
(
fromR
(
float
(
l
[
0
])
-
Ef
))
DOS
[
spin
].
append
(
float
(
l
[
totDOScol
])
/
fromR
(
1.0
))
# we found the total DOS, ignore the rest of files
if
DOS
[
spin
]:
break
else
:
break
if
DOS
[
0
]:
DOSGIndex
=
backend
.
openSection
(
"section_dos"
)
backend
.
addArrayValues
(
"dos_energies"
,
np
.
asarray
(
ene
))
backend
.
addArrayValues
(
"dos_energies_normalized"
,
np
.
asarray
(
eneNorm
))
backend
.
addArrayValues
(
"dos_values"
,
np
.
asarray
(
DOS
))
backend
.
addValue
(
"dos_kind"
,
"electronic"
)
backend
.
addValue
(
"number_of_dos_values"
,
len
(
DOS
[
0
]))
backend
.
closeSection
(
"section_dos"
,
DOSGIndex
)
def
onClose_section_system
(
self
,
backend
,
gIndex
,
section
):
# atom labels
...
...
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