Skip to content

Use libxc's parsing routines instead of hardcoded lists #48

@susilehtola

Description

@susilehtola

Hi,

I just had a look at https://github.com/sunqm/pyscf/blob/master/dft/libxc.py and noticed that you're using hardcoded functional lists.

However, libxc has had the functionality to parse functional keywords and id numbers for a long time:
int XC(functional_get_number)(const char *name);
char *XC(functional_get_name)(int number);

which implement the necessary functionality. I would recommend removing XC_CODES, XC_KEYS, LDA_IDS, GGA_IDS, etc from dft/libxc.py, and replacing them with the two above functionals.

The functions is_lda, is_gga and so on can be reimplemented by checking the functional family with
int XC(family_from_id)(int id, int *family, int *number);
or by checking the func.info->family entry of
xc_func_type func;
that has been initialized to the used functional. The character of the functional (x, c, or xc) can be similarly checked from func.info->kind.

It doesn't really make sense to replicate this information, since that entails more maintenance. The stuff is already maintained within libxc, where it is always up to date.

Also, I don't see how you handle range separated hybrids. Are they not supported in pyscf?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions