QuantumEspressoXC.py 44.7 KB
Newer Older
1
2
3
# original developer: Henning Glawe, henning.glawe@mpsd.mpg.de
# updated by: temok.salazar@physik.hu-berlin.de

Henning Glawe's avatar
Henning Glawe committed
4
5
import logging
import re
6
import copy
Henning Glawe's avatar
Henning Glawe committed
7
8
9
10
11


LOGGER = logging.getLogger(__name__)


12
13
14
15
16
17
18
19
20
21
def parse_qe_xc_num(xc_functional_num):
    """parse Quantum Espresso XC number/index notation
    :returns: list with 6 integer elements (components of QE XC functionals)
              [iexch, icorr, igcx, igcc, imeta, inlc]
                iexch, icorr - density exchange/correlation
                igcx, igcc   - gradient correction exchange/correlation
                imeta        - meta-GGA
                inlc         - non-local term of Van der Waals functionals
    """
    xf_num_split_i = []
22
    xf_num_split = re.split(r'\s+', xc_functional_num.strip())
23
24
    if len(xf_num_split) > 6:
        # tested versions of espresso <=5.4.0 have 6 elements
25
26
        raise RuntimeError("unsupported number of XC components: %d" % (
            len(xf_num_split)))
27
28
    elif len(xf_num_split) == 6:
        # trivial case: we got 6 components from simply splitting
29
30
        xf_num_split_i = [int(x) for x in xf_num_split]
    elif len(xf_num_split) == 1 and len(xc_functional_num) == 4:
31
        # old 4-component form without space separator
32
33
34
35
36
        xf_num_split_i = [int(x) for x in re.findall(
            '(\d)', xc_functional_num)]
    elif len(xc_functional_num) == 10:
        # intermediate versions used 2-digit, 5 component form,
        # occasionally missing spaces
37
38
39
        # examples:
        # ( 1 4 4 0 1)
        # ( 0 413 0 2)  <- missing space
40
41
        xf_num_split_i = [int(x) for x in re.findall(
            '([ \d]\d)', xc_functional_num)]
42
    else:
43
44
45
46
47
        try:
            xf_num_split_i = [int(x) for x in xc_functional_num.split(' ') if x.strip() != '']
        except Exception:
            raise RuntimeError("unparsable input: '%s'", xc_functional_num)

48
    if len(xf_num_split_i) < 1:
49
50
        raise RuntimeError("this should not happen")
    # zero-pad up to 6 elements
51
    xf_num_split_i += [0] * (6 - len(xf_num_split_i))
52
53
54
    return xf_num_split_i


55
def translate_qe_xc_num(xc_functional_num, exact_exchange_fraction=None):
56
57
    # all remainders of excact_exchange_fraction must be ordinary DFT
    if exact_exchange_fraction is None:
58
        exact_exchange_fraction = 0.0
59
    xf_num = parse_qe_xc_num(xc_functional_num)
60
    LOGGER.debug('num <- input: %s <- %s, exx_fraction: %s', str(xf_num),
61
                 xc_functional_num, str(exact_exchange_fraction))
62
    # use dictionaries to ensure uniqueness:
63
64
65
    #   exchange/correlation functionals may be combined into _XC_, and we
    #   only want to emit such combinations once
    xc_data = {}
66
67
68
69
    #   libXC definitions of GGAs/Hybrids include the density contribution
    #   while QE allows to freely combine density, gradient etc. dependency
    #   so we need to remove at least the default settings to be compliant
    #   with libXC and NOMAD metaInfo
70
    xc_data_remove = {}
71
    # collect everything that will go to section_method
72
    xc_section_method = {}
73
    for component_i in range(6):
74
75
76
77
        this_xf_num = xf_num[component_i]
        if this_xf_num == 0:
            # 0 means unset component
            continue
78
        component_max = len(XC_COMPONENT[component_i])-1
79
80
        this_component = None
        if this_xf_num > component_max:
81
82
            LOGGER.error(
                "%s[%d] beyond limit of %d",
83
84
                XC_COMPONENT_NAME[component_i], this_xf_num, component_max)
        else:
85
            this_component = XC_COMPONENT[component_i][this_xf_num]
86
87
88
        if this_component is None:
            raise RuntimeError("Undefined XC component %s[%d]" % (
                XC_COMPONENT_NAME[component_i], this_xf_num))
89
        xc_section_method.update(this_component['xc_section_method'])
90
        for this_term in this_component['xc_terms']:
91
            apply_term_add(
92
                xc_data, this_term, exact_exchange_fraction)
93
94
95
96
97
        # collect all to-be-removed terms
        for this_term in this_component.get('xc_terms_remove', []):
            apply_term_add(
                xc_data_remove, this_term, exact_exchange_fraction)
    # remove all collected terms from xc_terms_remove from xc_data
98
    apply_terms_remove(xc_data, xc_data_remove)
99
    # filter terms in xc_data:
100
    apply_terms_filter(xc_data)
101
    xc_functional = xc_functional_str(xc_data)
102
103
104
105
106
107
108
109
    # apply shortcuts/overrides for libXC compliance
    if xc_functional in LIBXC_SHORTCUT:
        xc_data = {}
        for this_term in LIBXC_SHORTCUT[xc_functional]['xc_terms']:
            apply_term_add(
                xc_data, this_term, exact_exchange_fraction)
        apply_terms_filter(xc_data)
        xc_functional = xc_functional_str(xc_data)
110
    xc_section_method['XC_functional'] = xc_functional
Henning Glawe's avatar
Henning Glawe committed
111
    result = []
Henning Glawe's avatar
Henning Glawe committed
112
113
    for k in sorted(xc_data.keys()):
        v = xc_data[k]
Henning Glawe's avatar
Henning Glawe committed
114
        result.append(v)
115
    return (xc_section_method, result)
116
117


118
def apply_term_add(xc_data, this_term, exact_exchange_fraction):
119
    term = copy.deepcopy(this_term)
Henning Glawe's avatar
Henning Glawe committed
120
121
122
    if 'exx_compute_weight' in term:
        term['XC_functional_weight'] = term['exx_compute_weight'](
            exact_exchange_fraction)
123
124
    if 'XC_functional_weight' not in term:
        term['XC_functional_weight'] = 1.0
Henning Glawe's avatar
Henning Glawe committed
125
126
127
128
129
130
131
132
    if term['XC_functional_name'] not in xc_data:
        xc_data[term['XC_functional_name']] = term
    else:
        LOGGER.info("pre-existing XC term: %s",
                    term['XC_functional_name'])
    return xc_data


133
def apply_terms_remove(xc_data, xc_data_remove):
134
135
136
137
138
139
140
141
    for (k, v) in xc_data_remove.items():
        if k in xc_data:
            xc_data[k]['XC_functional_weight'] -= v['XC_functional_weight']
        else:
            xc_data[k] = v
            xc_data[k]['XC_functional_weight'] *= -1.0


142
def apply_terms_filter(xc_data):
Henning Glawe's avatar
Henning Glawe committed
143
    for (k, v) in list(xc_data.items()):
144
        if abs(v['XC_functional_weight']) < 0.01:
Henning Glawe's avatar
Henning Glawe committed
145
            del xc_data[k]
146
147
148
        else:
            if abs(v['XC_functional_weight'] - 1.0) < 0.01:
                del v['XC_functional_weight']
Henning Glawe's avatar
Henning Glawe committed
149
            v.pop('exx_compute_weight', None)
Henning Glawe's avatar
Henning Glawe committed
150
151


152
def xc_functional_str(xc_data, separator='+'):
153
154
155
156
    result = ''
    for k in sorted(xc_data.keys()):
        v = xc_data[k]
        if len(result) > 0 and v.get('XC_functional_weight', 1.0) > 0:
157
            result += separator
158
159
160
161
162
163
        if v.get('XC_functional_weight', None) is not None:
            result += '%.3f*' % (v['XC_functional_weight'])
        result += v['XC_functional_name']
    return result


164
165
166
167
168
169
170
171
172









173
# origin: espresso-5.4.0/Modules/funct.f90
174
175
176
177
# update:
# . New exchange-correlation functionals exist in
# .     espresso-6.5.0/Modules/funct.f90
#   short comments mark the corresponding new metainfo
178
179
180
EXCHANGE = [
    None,
    {
181
        'xc_terms': [{
182
183
            'XC_functional_name': 'LDA_X',
        }],
184
185
186
187
188
        'xc_section_method': {
            'x_qe_xc_iexch_name':       'sla',
            'x_qe_xc_iexch_comment':    'Slater (alpha=2/3)',
            'x_qe_xc_iexch':      1,
        },
189
190
    },
    {
191
        'xc_terms': [{
192
            'XC_functional_name': 'LDA_X',
193
            'XC_functional_parameters': {'alpha': 1.0},
194
        }],
195
196
197
198
199
        'xc_section_method': {
            'x_qe_xc_iexch_name':       'sl1',
            'x_qe_xc_iexch_comment':    'Slater (alpha=1.0)',
            'x_qe_xc_iexch':      2,
        },
200
201
    },
    {
202
        'xc_terms': [{
203
204
            'XC_functional_name': 'x_qe_LDA_X_RELATIVISTIC',
        }],
205
206
207
208
209
        'xc_section_method': {
            'x_qe_xc_iexch_name':       'rxc',
            'x_qe_xc_iexch_comment':    'Relativistic Slater',
            'x_qe_xc_iexch':      3,
        },
210
211
    },
    {
212
        'xc_terms': [{
213
            'XC_functional_name': 'OEP_EXX',
214
        }],
215
216
217
218
219
        'xc_section_method': {
            'x_qe_xc_iexch_name':       'oep',
            'x_qe_xc_iexch_comment':    'Optimized Effective Potential',
            'x_qe_xc_iexch':      4,
        },
220
221
    },
    {
222
        'xc_terms': [{
223
224
            'XC_functional_name': 'HF_X',
        }],
225
226
227
228
229
        'xc_section_method': {
            'x_qe_xc_iexch_name':       'hf',
            'x_qe_xc_iexch_comment':    'Hartree-Fock',
            'x_qe_xc_iexch':      5,
        },
230
231
    },
    {
232
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
233
            'XC_functional_name': 'HF_X',
234
            'exx_compute_weight': lambda exx: exx,
Henning Glawe's avatar
Henning Glawe committed
235
236
237
            'XC_functional_weight': 0.25,
        }, {
            'XC_functional_name': 'LDA_X',
238
            'exx_compute_weight': lambda exx: (1.0 - exx),
Henning Glawe's avatar
Henning Glawe committed
239
240
            'XC_functional_weight': 0.75,
        }],
241
242
243
244
245
        'xc_section_method': {
            'x_qe_xc_iexch_name':       "pb0x",
            'x_qe_xc_iexch_comment':    'PBE0 (Slater*0.75+HF*0.25)',
            'x_qe_xc_iexch':      6,
        },
246
247
    },
    {
248
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
249
            'XC_functional_name': 'HF_X',
250
            'exx_compute_weight': lambda exx: exx,
Henning Glawe's avatar
Henning Glawe committed
251
252
253
            'XC_functional_weight': 0.20,
        }, {
            'XC_functional_name': 'LDA_X',
254
            'exx_compute_weight': lambda exx: (1.0 - exx),
Henning Glawe's avatar
Henning Glawe committed
255
256
            'XC_functional_weight': 0.8,
        }],
257
258
259
260
261
        'xc_section_method': {
            'x_qe_xc_iexch_name':       "b3lp",
            'x_qe_xc_iexch_comment':    "B3LYP(Slater*0.80+HF*0.20)",
            'x_qe_xc_iexch':      7,
        },
262
    },
263
264
    # LDA_X_KZK is not part of libXC. Look up it at
    # 'https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-meta-info/wikis/metainfo/XC-functional'
265
    {
266
        'xc_terms': [{
267
            'XC_functional_name': "LDA_X_KZK",
268
        }],
269
270
271
272
273
        'xc_section_method': {
            'x_qe_xc_iexch_name':       "kzk",
            'x_qe_xc_iexch_comment':    "Finite-size corrections",
            'x_qe_xc_iexch':      8,
        },
274
275
    },
    {
276
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
277
            'XC_functional_name': 'HF_X',
278
            'exx_compute_weight': lambda exx: exx,
Henning Glawe's avatar
Henning Glawe committed
279
280
281
            'XC_functional_weight': 0.218,
        }, {
            'XC_functional_name': 'LDA_X',
282
            'exx_compute_weight': lambda exx: (1.0 - exx),
Henning Glawe's avatar
Henning Glawe committed
283
284
            'XC_functional_weight': 0.782,
        }],
285
286
287
288
289
        'xc_section_method': {
            'x_qe_xc_iexch_name':       "x3lp",
            'x_qe_xc_iexch_comment':    "X3LYP(Slater*0.782+HF*0.218)",
            'x_qe_xc_iexch':      9,
        },
290
    },
291
292
293
294
295
296
297
298
299
300
301
    # update for espresso-6.5.0: KLI
        {
        'xc_terms': [{
            'XC_functional_name': "LDA_X_KLI",
        }],
        'xc_section_method': {
            'x_qe_xc_iexch_name': "kli",
            'x_qe_xc_iexch_comment': "KLI aproximation for exx",
            'x_qe_xc_iexch': 10,
        },
    },
302
303
]

304
# Correlation functionals UNchanged between espresso v5.4 & v6.5
305
306
307
CORRELATION = [
    None,
    {
308
        'xc_terms': [{
309
310
            'XC_functional_name': 'LDA_C_PZ',
        }],
311
312
313
314
315
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "pz",
            'x_qe_xc_icorr_comment':    "Perdew-Zunger",
            'x_qe_xc_icorr':      1,
        },
316
317
    },
    {
318
        'xc_terms': [{
319
320
            'XC_functional_name': 'LDA_C_VWN',
        }],
321
322
323
324
325
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "vwn",
            'x_qe_xc_icorr_comment':    "Vosko-Wilk-Nusair",
            'x_qe_xc_icorr':      2,
        },
326
327
    },
    {
328
        'xc_terms': [{
329
330
            'XC_functional_name': 'LDA_C_LYP',
        }],
331
332
333
334
335
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "lyp",
            'x_qe_xc_icorr_comment':    "Lee-Yang-Parr",
            'x_qe_xc_icorr':      3,
        },
336
337
    },
    {
338
        'xc_terms': [{
339
340
            'XC_functional_name': "LDA_C_PW",
        }],
341
342
343
344
345
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "pw",
            'x_qe_xc_icorr_comment':    "Perdew-Wang",
            'x_qe_xc_icorr':      4,
        },
346
347
    },
    {
348
        'xc_terms': [{
349
350
            'XC_functional_name': 'LDA_C_WIGNER',
        }],
351
352
353
354
355
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "wig",
            'x_qe_xc_icorr_comment':    "Wigner",
            'x_qe_xc_icorr':      5,
        },
356
357
    },
    {
358
        'xc_terms': [{
359
360
            'XC_functional_name': 'LDA_C_HL',
        }],
361
362
363
364
365
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "hl",
            'x_qe_xc_icorr_comment':    "Hedin-Lunqvist",
            'x_qe_xc_icorr':      6,
        },
366
367
    },
    {
368
        'xc_terms': [{
369
370
            'XC_functional_name': 'LDA_C_OB_PZ',
        }],
371
372
373
374
375
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "obz",
            'x_qe_xc_icorr_comment':    "Ortiz-Ballone form for PZ",
            'x_qe_xc_icorr':      7,
        },
376
377
    },
    {
378
        'xc_terms': [{
379
380
            'XC_functional_name': 'LDA_C_OB_PW',
        }],
381
382
383
384
385
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "obw",
            'x_qe_xc_icorr_comment':    "Ortiz-Ballone form for PW",
            'x_qe_xc_icorr':      8,
        },
386
387
    },
    {
388
        'xc_terms': [{
389
390
            'XC_functional_name': 'LDA_C_GL',
        }],
391
392
393
394
395
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "gl",
            'x_qe_xc_icorr_comment':    "Gunnarson-Lunqvist",
            'x_qe_xc_icorr':      9,
        },
396
397
    },
    {
398
        'xc_terms': [{
399
            'XC_functional_name': "LDA_C_KZK",
400
        }],
401
402
403
404
405
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "kzk",
            'x_qe_xc_icorr_comment':    "Finite-size corrections",
            'x_qe_xc_icorr':      10,
        },
406
407
    },
    {
408
        'xc_terms': [{
409
410
            'XC_functional_name': 'LDA_C_VWN_RPA',
        }],
411
412
413
414
415
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "vwn-rpa",
            'x_qe_xc_icorr_comment':    "Vosko-Wilk-Nusair, alt param",
            'x_qe_xc_icorr':      11,
        },
416
417
    },
    {
418
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
419
420
421
422
423
424
            'XC_functional_name': 'LDA_C_VWN',
            'XC_functional_weight': 0.19,
        }, {
            'XC_functional_name': 'LDA_C_LYP',
            'XC_functional_weight': 0.81,
        }],
425
426
427
428
429
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "b3lp",
            'x_qe_xc_icorr_comment':    "B3LYP (0.19*vwn+0.81*lyp)",
            'x_qe_xc_icorr':      12,
        },
430
431
    },
    {
432
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
433
            'XC_functional_name': 'LDA_C_VWN_RPA',
Henning Glawe's avatar
Henning Glawe committed
434
435
436
437
438
            'XC_functional_weight': 0.19,
        }, {
            'XC_functional_name': 'LDA_C_LYP',
            'XC_functional_weight': 0.81,
        }],
439
        'xc_section_method': {
440
441
442
            'x_qe_xc_icorr_name':    "b3lpv1r",
            'x_qe_xc_icorr_comment': "B3LYP-VWN-1-RPA (0.19*vwn_rpa+0.81*lyp)",
            'x_qe_xc_icorr':         13,
443
        },
444
445
    },
    {
446
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
447
            'XC_functional_name': 'LDA_C_VWN_RPA',
Henning Glawe's avatar
Henning Glawe committed
448
449
450
451
452
            'XC_functional_weight': 0.129,
        }, {
            'XC_functional_name': 'LDA_C_LYP',
            'XC_functional_weight': 0.871,
        }],
453
454
455
456
457
        'xc_section_method': {
            'x_qe_xc_icorr_name':       "x3lp",
            'x_qe_xc_icorr_comment':    "X3LYP (0.129*vwn_rpa+0.871*lyp)",
            'x_qe_xc_icorr':      14,
        },
458
459
460
    },
]

461
462
463
464
# New "exchange_gradient_correction" functionals for q-espresso (qe) v6.5
#    igcx=[1..28] unchanged between qe-v5.4 & v6.5
# New additions:  igcx=[29..42]

465
466
467
EXCHANGE_GRADIENT_CORRECTION = [
    None,
    {
468
        'xc_terms': [{
469
470
            'XC_functional_name': "GGA_X_B88",
        }],
471
        'xc_terms_remove': [{
472
473
            'XC_functional_name': 'LDA_X',
        }],
474
475
476
477
478
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "b88",
            'x_qe_xc_igcx_comment':    "Becke88 (beta=0.0042)",
            'x_qe_xc_igcx':      1,
        },
479
480
    },
    {
481
        'xc_terms': [{
482
483
            'XC_functional_name': "GGA_X_PW91",
        }],
484
        'xc_terms_remove': [{
485
486
            'XC_functional_name': 'LDA_X',
        }],
487
488
489
490
491
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "ggx",
            'x_qe_xc_igcx_comment':    "Perdew-Wang 91",
            'x_qe_xc_igcx':      2,
        },
492
493
    },
    {
494
        'xc_terms': [{
495
496
            'XC_functional_name': "GGA_X_PBE",
        }],
497
        'xc_terms_remove': [{
498
499
            'XC_functional_name': 'LDA_X',
        }],
500
501
502
503
504
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "pbx",
            'x_qe_xc_igcx_comment':    "Perdew-Burke-Ernzenhof exch",
            'x_qe_xc_igcx':      3,
        },
505
506
    },
    {
507
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
508
            'XC_functional_name': "GGA_X_PBE_R",
509
        }],
510
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
511
512
            'XC_functional_name': 'LDA_X',
        }],
513
514
515
516
517
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "rpb",
            'x_qe_xc_igcx_comment':    "revised PBE by Zhang-Yang",
            'x_qe_xc_igcx':      4,
        },
518
519
    },
    {
520
        'xc_terms': [{
521
522
            'XC_functional_name': "GGA_XC_HCTH_120",
        }],
523
524
525
526
527
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "hcth",
            'x_qe_xc_igcx_comment':    "Cambridge exch, Handy et al, HCTH/120",
            'x_qe_xc_igcx':      5,
        },
528
529
    },
    {
530
        'xc_terms': [{
531
532
            'XC_functional_name': "GGA_X_OPTX",
        }],
533
534
535
536
537
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "optx",
            'x_qe_xc_igcx_comment':    "Handy's exchange functional",
            'x_qe_xc_igcx':      6,
        },
538
    },
539
540
541
    {
        # igcx=7 is not defined in 5.4's funct.f90
        #        definition taken from 5.0, which did not have separate imeta
542
        'xc_terms': [{
543
544
            'XC_functional_name': "MGGA_X_TPSS",
        }],
545
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
546
547
            'XC_functional_name': 'LDA_X',
        }],
548
        'xc_section_method': {
549
550
551
            'x_qe_xc_igcx_name':    "tpss",
            'x_qe_xc_igcx_comment': "TPSS Meta-GGA (Espresso-version < 5.1)",
            'x_qe_xc_igcx':         7,
552
        },
553
    },
554
    {
555
        'xc_terms': [{
556
            'XC_functional_name': "GGA_X_PBE",
557
            'XC_functional_weight': 0.75,
558
            'exx_compute_weight': lambda exx: (1.0 - exx),
559
        }],
560
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
561
562
            'XC_functional_name': 'LDA_X',
            'XC_functional_weight': 0.75,
563
            'exx_compute_weight': lambda exx: (1.0 - exx),
Henning Glawe's avatar
Henning Glawe committed
564
        }],
565
566
567
568
569
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "pb0x",
            'x_qe_xc_igcx_comment':    "PBE0 (PBE exchange*0.75)",
            'x_qe_xc_igcx':      8,
        },
570
571
    },
    {
572
        'xc_terms': [{
573
            'XC_functional_name': "GGA_X_B88",
574
            'XC_functional_weight': 0.72,
Henning Glawe's avatar
Henning Glawe committed
575
            'exx_compute_weight': lambda exx: 0.72 if abs(exx) > 0.01 else 1.0
576
        }],
577
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
578
579
580
            'XC_functional_name': 'LDA_X',
            'XC_functional_weight': 0.8,
            'exx_compute_weight': lambda exx: (1.0 - exx),
Henning Glawe's avatar
Henning Glawe committed
581
        }],
582
583
584
585
586
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "b3lp",
            'x_qe_xc_igcx_comment':    "B3LYP (Becke88*0.72)",
            'x_qe_xc_igcx':      9,
        },
587
588
    },
    {
589
        'xc_terms': [{
590
591
            'XC_functional_name': "GGA_X_PBE_SOL",
        }],
592
        'xc_terms_remove': [{
593
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
594
        }],
595
596
597
598
599
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "psx",
            'x_qe_xc_igcx_comment':    "PBEsol exchange",
            'x_qe_xc_igcx':      10,
        },
600
601
    },
    {
602
        'xc_terms': [{
603
604
            'XC_functional_name': "GGA_X_WC",
        }],
605
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
606
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
607
        }],
608
609
610
611
612
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "wcx",
            'x_qe_xc_igcx_comment':    "Wu-Cohen",
            'x_qe_xc_igcx':      11,
        },
613
614
    },
    {
615
        'xc_terms': [{
616
            'XC_functional_name': "HYB_GGA_XC_HSE06",
617
618
619
620
            'exx_compute_weight': lambda exx: 1.0 if (abs(exx) > 0.01) else 0.0
        }, {
            'XC_functional_name': "GGA_X_PBE",
            'exx_compute_weight': lambda exx: 0.0 if (abs(exx) > 0.01) else 1.0
621
        }],
622
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
623
            'XC_functional_name': 'LDA_X',
624
625
626
627
        }, {
            'XC_functional_name': 'GGA_C_PBE',
            'exx_compute_weight': lambda exx: 1.0 if (abs(exx) > 0.01) else 0.0
        }],
628
629
630
631
632
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "hse",
            'x_qe_xc_igcx_comment':    "HSE screened exchange",
            'x_qe_xc_igcx':      12,
        },
633
634
    },
    {
635
        'xc_terms': [{
636
637
            'XC_functional_name': "GGA_X_RPW86",
        }],
638
        'xc_terms_remove': [{
639
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
640
        }],
641
642
643
644
645
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "rw86",
            'x_qe_xc_igcx_comment':    "revised PW86",
            'x_qe_xc_igcx':      13,
        },
646
647
    },
    {
648
        'xc_terms': [{
649
650
            'XC_functional_name': "GGA_X_PBE",
        }],
651
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
652
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
653
        }],
654
655
656
657
658
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "pbe",
            'x_qe_xc_igcx_comment':    "same as PBX, back-comp.",
            'x_qe_xc_igcx':      14,
        },
659
    },
660
661
662
    {
        # igcx=15 is not defined in 5.4's funct.f90
        #        definition taken from 5.0, which did not have separate imeta
663
        'xc_terms': [{
664
665
            'XC_functional_name': "MGGA_X_TB09",
        }],
666
        'xc_terms_remove': [{
667
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
668
        }],
669
        'xc_section_method': {
670
671
672
            'x_qe_xc_igcx_name':    "tb09",
            'x_qe_xc_igcx_comment': "TB09 Meta-GGA (Espresso-version < 5.1)",
            'x_qe_xc_igcx':         15,
673
        },
674
    },
675
    {
676
        'xc_terms': [{
677
678
            'XC_functional_name': "GGA_X_C09X",
        }],
679
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
680
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
681
        }],
682
683
684
685
686
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "c09x",
            'x_qe_xc_igcx_comment':    "Cooper 09",
            'x_qe_xc_igcx':      16,
        },
687
688
    },
    {
689
        'xc_terms': [{
690
691
            'XC_functional_name': "GGA_X_SOGGA",
        }],
692
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
693
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
694
        }],
695
696
697
698
699
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "sox",
            'x_qe_xc_igcx_comment':    "sogga",
            'x_qe_xc_igcx':      17,
        },
700
    },
701
702
703
    {
        # igcx=18 is not defined in 5.4's funct.f90
        #        definition taken from 5.0, which did not have separate imeta
704
        'xc_terms': [{
705
706
            'XC_functional_name': "MGGA_X_M06_L",
        }],
707
        'xc_section_method': {
708
709
710
            'x_qe_xc_igcx_name':    "m6lx",
            'x_qe_xc_igcx_comment': "M06L Meta-GGA (Espresso-version < 5.1)",
            'x_qe_xc_igcx':         18,
711
        },
712
    },
713
    {
714
        'xc_terms': [{
715
716
            'XC_functional_name': "GGA_X_Q2D",
        }],
717
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
718
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
719
        }],
720
721
722
723
724
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "q2dx",
            'x_qe_xc_igcx_comment':    "Q2D exchange grad corr",
            'x_qe_xc_igcx':      19,
        },
725
726
    },
    {
727
        'xc_terms': [{
728
            'XC_functional_name': "HYB_GGA_XC_GAU_PBE",
729
730
731
732
            'exx_compute_weight': lambda exx: 1.0 if (abs(exx) > 0.01) else 0.0
        }, {
            'XC_functional_name': "GGA_X_PBE",
            'exx_compute_weight': lambda exx: 0.0 if (abs(exx) > 0.01) else 1.0
733
        }],
734
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
735
            'XC_functional_name': 'LDA_X',
Henning Glawe's avatar
Henning Glawe committed
736
        }, {
Henning Glawe's avatar
Henning Glawe committed
737
738
            'XC_functional_name': 'GGA_C_PBE',
            'exx_compute_weight': lambda exx: 1.0 if (abs(exx) > 0.01) else 0.0
Henning Glawe's avatar
Henning Glawe committed
739
        }],
740
741
742
743
744
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "gaup",
            'x_qe_xc_igcx_comment':    "Gau-PBE hybrid exchange",
            'x_qe_xc_igcx':      20,
        },
745
746
    },
    {
747
        'xc_terms': [{
748
749
            'XC_functional_name': "GGA_X_PW86",
        }],
750
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
751
752
            'XC_functional_name': 'LDA_X',
        }],
753
754
755
756
757
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "pw86",
            'x_qe_xc_igcx_comment':    "Perdew-Wang (1986) exchange",
            'x_qe_xc_igcx':      21,
        },
758
759
    },
    {
760
        'xc_terms': [{
761
762
            'XC_functional_name': "GGA_X_B86_MGC",
        }],
763
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
764
765
            'XC_functional_name': 'LDA_X',
        }],
766
767
768
769
770
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "b86b",
            'x_qe_xc_igcx_comment':    "Becke (1986) exchange",
            'x_qe_xc_igcx':      22,
        },
771
772
    },
    {
773
        'xc_terms': [{
774
775
            'XC_functional_name': "GGA_X_OPTB88_VDW",
        }],
776
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
777
778
            'XC_functional_name': 'LDA_X',
        }],
779
780
781
782
783
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "obk8",
            'x_qe_xc_igcx_comment':    "optB88  exchange",
            'x_qe_xc_igcx':      23,
        },
784
785
    },
    {
786
        'xc_terms': [{
787
            'XC_functional_name': "GGA_X_OPTB86_VDW",
788
        }],
789
        'xc_terms_remove': [{
790
791
            'XC_functional_name': 'LDA_X',
        }],
792
793
794
795
796
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "ob86",
            'x_qe_xc_igcx_comment':    "optB86b exchange",
            'x_qe_xc_igcx':      24,
        },
797
798
    },
    {
799
        'xc_terms': [{
800
801
            'XC_functional_name': "GGA_X_EV93",
        }],
802
        'xc_terms_remove': [{
803
804
            'XC_functional_name': 'LDA_X',
        }],
805
806
807
808
809
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "evx",
            'x_qe_xc_igcx_comment':    "Engel-Vosko exchange",
            'x_qe_xc_igcx':      25,
        },
810
811
    },
    {
812
        'xc_terms': [{
813
814
            'XC_functional_name': "GGA_X_B86_R",
        }],
815
        'xc_terms_remove': [{
816
817
            'XC_functional_name': 'LDA_X',
        }],
818
819
820
821
822
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "b86r",
            'x_qe_xc_igcx_comment':    "revised Becke (b86b)",
            'x_qe_xc_igcx':      26,
        },
823
824
    },
    {
825
        'xc_terms': [{
826
827
            'XC_functional_name': "GGA_X_LV_RPW86",
        }],
828
        'xc_terms_remove': [{
Henning Glawe's avatar
Henning Glawe committed
829
830
            'XC_functional_name': 'LDA_X',
        }],
831
832
833
834
835
        'xc_section_method': {
            'x_qe_xc_igcx_name':       "cx13",
            'x_qe_xc_igcx_comment':    "consistent exchange",
            'x_qe_xc_igcx':      27,
        },
836
837
    },
    {
838
        'xc_terms': [{
Henning Glawe's avatar
Henning Glawe committed
839
840
            'XC_functional_name': "GGA_X_B88",
            'XC_functional_weight': 0.542,
841
842
            'exx_compute_weight':
                lambda exx: 0.542 if (abs(exx) > 0.01) else 1.0
Henning Glawe's avatar
Henning Glawe committed
843
844
845
        }, {
            'XC_functional_name': "GGA_X_PW91",
            'XC_functional_weight': 0.167,
846
847
            'exx_compute_weight':
                lambda exx: 0.167 if (abs(exx) > 0.01) else 0.0
Henning Glawe's avatar
Henning Glawe committed
848
        }],
849
        'xc_terms_remove': [{
850
851
852
853
            'XC_functional_name': 'LDA_X',
            'exx_compute_weight':
                lambda exx: 0.709 if (abs(exx) > 0.01) else 1.0
        }],
854
        'xc_section_method': {
855
856
857
858
            'x_qe_xc_igcx_name':    "x3lp",
            'x_qe_xc_igcx_comment': "X3LYP (Becke88*0.542 "
                                    " + Perdew-Wang91*0.167)",
            'x_qe_xc_igcx':         28,
859
        },
860
    },
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
# New additions for qe-v6.5.0:  igcx=[29..42]
# - - - - - -
# igcx: 29. The ingredient 'vdW-DF-cx' is documented in the nomad-meta-info, where it
# has the name 'vdw_c_df_cx'
# 'https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-meta-info/-/wikis/metainfo/XC-functional':
# 'vdW-DF-cx' implies igcx=27 => 'cx13', hence LDA_X is implicit. Full weight.
    {
        'xc_terms': [{
            'XC_functional_name': "vdw_c_df_cx",
        }, {
        'XC_functional_name': 'HF_X',
        'exx_compute_weight': lambda exx: exx,
        'XC_functional_weight': 0.25,
        }],
        'xc_terms_remove': [{
            'XC_functional_name': 'LDA_X',
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name':    "cx0",
            'x_qe_xc_igcx_comment': "vdW-DF-cx+HF/4 (cx13-0)",
            'x_qe_xc_igcx':         29,
        },
    },
# - - - - - -
# igcx:30. Needs full LDA_X removal, due to 'GGA_X_RPW86' (see igcx:27)
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RPW86",
        },{
            'XC_functional_name': 'HF_X',
            'exx_compute_weight': lambda exx: exx,
            'XC_functional_weight': 0.25,
        }],
        'xc_terms_remove': [{
            'XC_functional_name': 'LDA_X',
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "r860",
            'x_qe_xc_igcx_comment': "rPW86+HF/4 (rw86-0); (for DF0)",
            'x_qe_xc_igcx': 30,
        },
    },
# - - - - - -
# igcx:31. Similar comments as in 'igcx:29'
    {
        'xc_terms': [{
            'XC_functional_name': "vdw_c_df_cx",
        }, {
            'XC_functional_name': 'HF_X',
            'exx_compute_weight': lambda exx: exx,
            'XC_functional_weight': 0.20,
        }],
        'xc_terms_remove': [{
            'XC_functional_name': 'LDA_X',
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name':    "cx0p",
            'x_qe_xc_igcx_comment': "vdW-DF-cx+HF/5 (cx13-0p)",
            'x_qe_xc_igcx':         31,
        },
    },
922
# - - - - - -
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "ahcx",
            'x_qe_xc_igcx_comment': "vdW-DF-cx based; not yet in use (reserved PH)",
            'x_qe_xc_igcx': 32,
        },
    },
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "ahf2",
            'x_qe_xc_igcx_comment': "vdW-DF2 based; not yet in use (reserved PH)",
            'x_qe_xc_igcx': 33,
        },
    },
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "ahpb",
            'x_qe_xc_igcx_comment': "PBE based; not yet in use (reserved PH)",
            'x_qe_xc_igcx': 34,
        },
    },
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "ahps",
            'x_qe_xc_igcx_comment': "PBE-sol based; not in use (reserved PH)",
            'x_qe_xc_igcx': 35,
        },
    },
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "cx14",
            'x_qe_xc_igcx_comment': "Exporations (typo?: explorations), (reserved PH)",
            'x_qe_xc_igcx': 36,
        },
    },
    {
        'xc_terms': [{
            'XC_functional_name': "GGA_X_RESERVED",
        }],
        'xc_section_method': {
            'x_qe_xc_igcx_name': "cx15",
            'x_qe_xc_igcx_comment': "Exporations (typo? explorations?)(reserved PH)",
            'x_qe_xc_igcx': 37,
        },
    },
#
# igcx': 38. Ingredients:
#   'b86r' -> 'igcx:26' -> 'GGA_X_B86_R'
#   'vdW-DF2' -> 'vdw_c_df2' . See nomad's gitlab:
#   'https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-meta-info/-/wikis/metainfo/XC-functional':

    {
     'xc_terms': [{
            'XC_functional_name': "vdw_c_df2",
        }, {
            'XC_functional_name': "GGA_X_B86_R",
        }, {
            'XC_functional_name': 'HF_X',
            'exx_compute_weight': lambda exx: exx,
            'XC_functional_weight': 0.25,
        }],
        'xc_terms_remove': [{
            'XC_functional_name': 'LDA_X',
For faster browsing, not all history is shown. View entire blame