Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit 8b3a4a36 authored by Mikkel Strange's avatar Mikkel Strange

split up libxc names in X and C if needed

parent 6debb5d0
from __future__ import print_function
import re
p = re.compile(
short_names = {
......@@ -27,6 +30,36 @@ def get_libxc_name(name):
return libxc_name
def get_libxc_xc_names(name):
"""get dictionary with
x_name: Exchange name (None if xc_name is not None)
c_name: Correlation name (-||-)
xc_name: XC 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 =, name)
if m is not None: # it is either a correlation or exchange functional
return xc
xc['xc_name'] = name # for something like BEEF-vdW
return xc
if __name__ == '__main__':
......@@ -10,7 +10,7 @@ import setup_paths
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 libxc_names import get_libxc_name
from libxc_names import get_libxc_xc_names
......@@ -87,8 +87,14 @@ def parse(filename):
electron_temperature, 'K'))
p.addRealValue('total_charge', r.c.charge)
with o(p, 'section_XC_functionals'):
xc = get_libxc_xc_names(r.c.exchange_correlation)
if xc['xc_name'] is not None:
p.addValue('XC_functional_name', xc['xc_name'])
if xc['x_name'] is not None:
p.addValue('XC_functional_name', xc['x_name'])
if xc['c_name'] is not None:
p.addValue('XC_functional_name', xc['c_name'])
with o(p, 'section_single_configuration_calculation'):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment