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-gpaw
Commits
42ac20c6
Commit
42ac20c6
authored
Sep 21, 2016
by
Mikkel Strange
Browse files
xc name seperated out in x and c parts
parent
d9c3b9f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
parser/parser-gpaw/libxc_names.py
View file @
42ac20c6
from
__future__
import
print_function
import
re
#p = re.compile(r"(?P<x_name>.*_X.*)\+(?P<c_name>.*_C.*)")
p
=
re
.
compile
(
'((?P<x_name>(GGA|LDA|MGGA|HF|HYB_MGGA)_X.*)|(?P<c_name>(GGA|LDA|MGGA)_C.*))'
)
short_names
=
{
'LDA'
:
'LDA_X+LDA_C_PW'
,
...
...
@@ -24,7 +28,38 @@ def get_libxc_name(name):
libxc_name
=
name
return
libxc_name
def
get_libxc_xc_names
(
name
):
name
=
get_libxc_name
(
name
)
xc
=
{
'xc_name'
:
None
,
'x_name'
:
None
,
'c_name'
:
None
}
if
'_XC_'
in
name
:
xc
[
'xc_name'
]
=
name
return
xc
if
'+'
in
name
:
s
=
name
.
split
(
'+'
)
xc
[
'x_name'
]
=
s
[
0
]
xc
[
'c_name'
]
=
s
[
1
]
return
xc
m
=
re
.
search
(
p
,
name
)
if
m
is
not
None
:
# it is either a correlation or exchange functional
xc
.
update
(
m
.
groupdict
())
return
xc
xc
[
'xc_name'
]
=
name
# for something like BEEF-vdW
return
xc
if
__name__
==
'__main__'
:
print
(
get_libxc_name
(
'LDA'
))
print
(
get_libxc_name
(
'GGA_X_PBE'
))
# print(get_libxc_name('LDA'))
# print(get_libxc_name('GGA_X_PBE'))
names
=
[
'GGA_X_B88+GGA_C_LYP'
,
'HF_X'
,
'HYB_GGA_XC_B1LYP'
,
'HYB_GGA_XC_HSE03'
,
'BEEF-vdW'
,
'LDA_K_TF'
]
for
name
in
names
:
print
(
get_libxc_xc_names
(
name
))
parser/parser-gpaw/parser.py
View file @
42ac20c6
...
...
@@ -8,7 +8,7 @@ from nomadcore.unit_conversion.unit_conversion import convert_unit as cu
from
nomadcore.local_meta_info
import
loadJsonFile
,
InfoKindEl
from
nomadcore.parser_backend
import
JsonParseEventsWriterBackend
from
tar
import
Reader
from
libxc_names
import
get_libxc_name
from
libxc_names
import
get_libxc_
xc_
name
s
@
contextmanager
...
...
@@ -87,8 +87,10 @@ def parse(filename):
p
.
addRealValue
(
'smearing_width'
,
c
(
r
.
FermiWidth
,
'hartree'
))
with
o
(
p
,
'section_XC_functionals'
):
p
.
addValue
(
'XC_functional_name'
,
get_libxc_name
(
r
.
XCFunctional
))
xc_names
=
get_libxc_xc_names
(
r
.
XCFunctional
)
for
name
in
xc_names
.
values
():
if
name
is
not
None
:
p
.
addValue
(
'XC_functional_name'
,
name
)
with
o
(
p
,
'section_single_configuration_calculation'
):
p
.
addValue
(
'single_configuration_calculation_to_system_ref'
,
system_gid
)
...
...
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