Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-elk
Commits
99a190a6
Commit
99a190a6
authored
Nov 16, 2016
by
Pardini, Lorenzo (lopa)
Browse files
Fixed bug with total energy
parent
4fedb990
Pipeline
#8439
passed with stage
in 5 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
parser/parser-elk/parser_elk.py
View file @
99a190a6
...
@@ -14,14 +14,15 @@ class ElkContext(object):
...
@@ -14,14 +14,15 @@ class ElkContext(object):
self
.
parser
=
None
self
.
parser
=
None
def
initialize_values
(
self
):
def
initialize_values
(
self
):
"""allows to reset values if the same superContext is used to parse different files"""
"""allows to reset values if the same superContext is used to parse different files"""
self
.
metaInfoEnv
=
self
.
parser
.
parserBuilder
.
metaInfoEnv
self
.
metaInfoEnv
=
self
.
parser
.
parserBuilder
.
metaInfoEnv
def
startedParsing
(
self
,
path
,
parser
):
def
startedParsing
(
self
,
path
,
parser
):
"""called when parsing starts"""
"""called when parsing starts"""
self
.
parser
=
parser
self
.
parser
=
parser
# allows to reset values if the same superContext is used to parse different files
# allows to reset values if the same superContext is used to parse different files
self
.
initialize_values
()
self
.
initialize_values
()
self
.
enTot
=
[]
def
onClose_x_elk_section_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
def
onClose_x_elk_section_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
latticeX
=
section
[
"x_elk_geometry_lattice_vector_x"
]
latticeX
=
section
[
"x_elk_geometry_lattice_vector_x"
]
...
@@ -111,6 +112,8 @@ class ElkContext(object):
...
@@ -111,6 +112,8 @@ class ElkContext(object):
backend
.
addArrayValues
(
"eigenvalues_values"
,
np
.
asarray
([
eigvalVal
]))
backend
.
addArrayValues
(
"eigenvalues_values"
,
np
.
asarray
([
eigvalVal
]))
backend
.
addArrayValues
(
"eigenvalues_occupation"
,
np
.
asarray
([
eigvalOcc
]))
backend
.
addArrayValues
(
"eigenvalues_occupation"
,
np
.
asarray
([
eigvalOcc
]))
backend
.
addValue
(
"energy_total"
,
self
.
enTot
[
-
1
])
def
onClose_section_system
(
self
,
backend
,
gIndex
,
section
):
def
onClose_section_system
(
self
,
backend
,
gIndex
,
section
):
backend
.
addArrayValues
(
'configuration_periodic_dimensions'
,
np
.
asarray
([
True
,
True
,
True
]))
backend
.
addArrayValues
(
'configuration_periodic_dimensions'
,
np
.
asarray
([
True
,
True
,
True
]))
self
.
secSystemDescriptionIndex
=
gIndex
self
.
secSystemDescriptionIndex
=
gIndex
...
@@ -128,7 +131,7 @@ class ElkContext(object):
...
@@ -128,7 +131,7 @@ class ElkContext(object):
def
onClose_section_scf_iteration
(
self
,
backend
,
gIndex
,
section
):
def
onClose_section_scf_iteration
(
self
,
backend
,
gIndex
,
section
):
Etot
=
section
[
"energy_total_scf_iteration"
]
Etot
=
section
[
"energy_total_scf_iteration"
]
backend
.
addValue
(
"energy_total"
,
Etot
[
-
1
])
self
.
enTot
.
append
(
Etot
[
0
])
# description of the input
# description of the input
mainFileDescription
=
\
mainFileDescription
=
\
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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