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
acf800d5
Commit
acf800d5
authored
Aug 03, 2016
by
Pardini, Lorenzo (lopa)
Browse files
added lattice vectors
parent
14159f66
Changes
1
Hide whitespace changes
Inline
Side-by-side
parser/parser-elk/parser_elk.py
View file @
acf800d5
...
...
@@ -22,6 +22,24 @@ class ElkContext(object):
# allows to reset values if the same superContext is used to parse different files
self
.
initialize_values
()
def
onClose_x_elk_section_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
latticeX
=
section
[
"x_elk_geometry_lattice_vector_x"
]
latticeY
=
section
[
"x_elk_geometry_lattice_vector_y"
]
latticeZ
=
section
[
"x_elk_geometry_lattice_vector_z"
]
cell
=
[[
latticeX
[
0
],
latticeY
[
0
],
latticeZ
[
0
]],
[
latticeX
[
1
],
latticeY
[
1
],
latticeZ
[
1
]],
[
latticeX
[
2
],
latticeY
[
2
],
latticeZ
[
2
]]]
backend
.
addValue
(
"simulation_cell"
,
cell
)
def
onClose_x_elk_section_reciprocal_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
recLatticeX
=
section
[
"x_elk_geometry_reciprocal_lattice_vector_x"
]
recLatticeY
=
section
[
"x_elk_geometry_reciprocal_lattice_vector_y"
]
recLatticeZ
=
section
[
"x_elk_geometry_reciprocal_lattice_vector_z"
]
recCell
=
[[
recLatticeX
[
0
],
recLatticeY
[
0
],
recLatticeZ
[
0
]],
[
recLatticeX
[
1
],
recLatticeY
[
1
],
recLatticeZ
[
1
]],
[
recLatticeX
[
2
],
recLatticeY
[
2
],
recLatticeZ
[
2
]]]
backend
.
addValue
(
"x_elk_simulation_reciprocal_cell"
,
recCell
)
# description of the input
mainFileDescription
=
\
SM
(
name
=
"root matcher"
,
...
...
@@ -34,11 +52,22 @@ mainFileDescription = \
sections
=
[
"section_run"
,
"section_method"
],
subMatchers
=
[
SM
(
name
=
'input'
,
startReStr
=
r
"All units are atomic \(Hartree, Bohr, etc.\)\s"
,
# startReStr = r"\|\sGround-state run starting from atomic densities\s\|\s",
# endReStr = r"\|\sDensity and potential initialised from atomic data\s",
startReStr
=
r
"\|\sGround-state run starting from atomic densities\s\|\s"
,
endReStr
=
r
"\|\sDensity and potential initialised from atomic data\s"
,
sections
=
[
'section_system'
],
subMatchers
=
[
SM
(
startReStr
=
r
"\s*Lattice vectors :"
,
sections
=
[
"x_elk_section_lattice_vectors"
],
subMatchers
=
[
SM
(
startReStr
=
r
"\s*(?P<x_elk_geometry_lattice_vector_x__bohr>[-+0-9.]+)\s+(?P<x_elk_geometry_lattice_vector_y__bohr>[-+0-9.]+)\s+(?P<x_elk_geometry_lattice_vector_z__bohr>[-+0-9.]+)"
,
repeats
=
True
)
]),
SM
(
startReStr
=
r
"Reciprocal lattice vectors :"
,
sections
=
[
"x_elk_section_reciprocal_lattice_vectors"
],
subMatchers
=
[
SM
(
startReStr
=
r
"\s*(?P<x_elk_geometry_reciprocal_lattice_vector_x__bohr_1>[-+0-9.]+)\s+(?P<x_elk_geometry_reciprocal_lattice_vector_y__bohr_1>[-+0-9.]+)\s+(?P<x_elk_geometry_reciprocal_lattice_vector_z__bohr_1>[-+0-9.]+)"
,
repeats
=
True
)
]),
SM
(
r
"\s*Unit cell volume\s*:\s*(?P<x_elk_unit_cell_volume__bohr3>[-0-9.]+)"
),
SM
(
r
"\s*Brillouin zone volume\s*:\s*(?P<x_elk_brillouin_zone_volume__bohr_3>[-0-9.]+)"
)
]
)
...
...
@@ -52,6 +81,17 @@ parserInfo = {
metaInfoPath
=
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"../../../../nomad-meta-info/meta_info/nomad_meta_info/elk.nomadmetainfo.json"
))
metaInfoEnv
,
warnings
=
loadJsonFile
(
filePath
=
metaInfoPath
,
dependencyLoader
=
None
,
extraArgsHandling
=
InfoKindEl
.
ADD_EXTRA_ARGS
,
uri
=
None
)
cachingLevelForMetaName
=
{
"x_elk_geometry_lattice_vector_x"
:
CachingLevel
.
Cache
,
"x_elk_geometry_lattice_vector_y"
:
CachingLevel
.
Cache
,
"x_elk_geometry_lattice_vector_z"
:
CachingLevel
.
Cache
,
"x_elk_section_lattice_vectors"
:
CachingLevel
.
Ignore
,
"x_elk_geometry_reciprocal_lattice_vector_x"
:
CachingLevel
.
Cache
,
"x_elk_geometry_reciprocal_lattice_vector_y"
:
CachingLevel
.
Cache
,
"x_elk_geometry_reciprocal_lattice_vector_z"
:
CachingLevel
.
Cache
,
"x_elk_section_reciprocal_lattice_vectors"
:
CachingLevel
.
Ignore
}
if
__name__
==
"__main__"
:
superContext
=
ElkContext
()
mainFunction
(
mainFileDescription
,
metaInfoEnv
,
parserInfo
,
superContext
=
superContext
)
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