GPAW Calculator Interface

The GPAW calculator interfaces modifies GPAW to be compatible with CIDER functionals. There are two key components. The first is the function ciderpress.gpaw.calculator.get_cider_functional(), which generates a CIDER functional for use in GPAW. The second is the ciderpress.gpaw.calculator.CiderGPAW() class, which modifies the GPAW calculator object to be able to read and write calculations that use CIDER functionals.

xc = get_cider_functional(...)
atoms.calc = CiderGPAW(xc=xc, ...)
atoms.get_potential_energy()

For a full example, see examples/gpaw/simple_calc.py and the other examples in examples/gpaw

class ciderpress.gpaw.calculator.CiderGPAW(restart=None, *, label=None, timer=None, communicator=None, txt='?', parallel=None, **kwargs)

This class is equivalent to the GPAW calculator object provded in the gpaw package, except that it is able to load and save CIDER calculations. The GPAW object can run CIDER but not save/load CIDER calculations.

One can also provide CIDER XC functional in dictionary format, but this is not advised since one also has to explicitly provide by the mlfunc_data parameter, which is the str of the yaml file representing the mlfunc object.

Basic calculator implementation.

restart: str

Prefix for restart file. May contain a directory. Default is None: don’t restart.

ignore_bad_restart_file: bool

Deprecated, please do not use. Passing more than one positional argument to Calculator() is deprecated and will stop working in the future. Ignore broken or missing restart file. By default, it is an error if the restart file is missing or broken.

directory: str or PurePath

Working directory in which to read and write files and perform calculations.

label: str

Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.

atoms: Atoms object

Optional Atoms object to which the calculator will be attached. When restarting, atoms will get its positions and unit-cell updated from file.

initialize(atoms=None, reading=False)

Inexpensive initialization.

ciderpress.gpaw.calculator.cider_functional_from_dict(d)

This is a function for reading CIDER functionals (and also standard functionals using the DiffPAW approach) from a dictionary that can be stored in a .gpw file. This is primarily a helper function for internal use, as it just reads the functional type and calls the from_dict() function of the respective class.

Parameters:

d – XC data

Returns:

XC Functional object for use in GPAW.

ciderpress.gpaw.calculator.get_cider_functional(mlfunc, xmix=1.0, xkernel='GGA_X_PBE', ckernel='GGA_C_PBE', mlfunc_format=None, use_paw=True, pasdw_ovlp_fit=True, pasdw_store_funcs=False, Nalpha=None, qmax=300, lambd=1.8, _force_nonlocal=False)

Initialize a CIDER surrogate hybrid XC functional of the form:

E_xc = xkernel * (1 - xmix) + ckernel + xmix * E_x^CIDER

where and E_x^CIDER is the ML exchange energy contained in mlfunc. xkernel and ckernel should be strings corresponding to an exchange and correlation functional in libxc. The above formula applies even if E_x^CIDER is a full XC functional. In this case, one should set xkernel=None, ckernel=None, xmix=1.0.

NOTE: Do not use CIDER with ultrasoft pseudopotentials (PAW only). At your own risk, you can use CIDER with norm-conserving pseudopotentials, but correctness is not guaranteed because the nonlocal features will not be correct due to the lack of core electrons.

NOTE: If the mlfunc is determined to be semilocal, all the internal settings are ignored, and a simpler, more efficient class is returned to evaluate the semilocal functional.

NOTE: The parameters pasdw_ovlp_fit and pasdw_store_funcs are only used if use_paw==True. They control internal behavior of the PASDW algorithm used to evaluate the nonlocal density features in CIDER, but users might want to set them to address numerical stability or memory/performance trade-off issues.

NOTE: The arguments Nalpha, qmax, and lambd can be set but are considered internal parameters and should usually be kept as their defaults, which should be reasonable for most cases. These parameters determine the spline used to interpolate over different values of the nonlocal density feature length-scale. A fourth parameter, qmin, also influences the spline. qmin is the mininum value of q to use for kernel interpolation. Currently, qmin is set automatically based on the minimum regularized value of the kernel exponent.

Parameters:
  • mlfunc (MappedXC, MappedXC2, str) – An ML functional object or a str corresponding to the file name of a yaml or joblib file containing it.

  • xmix (float, 1.00) – Mixing parameter for CIDER exchnange.

  • xkernel (str, GGA_X_PBE) – libxc code str for semi-local X functional

  • ckernel (str, GGA_C_PBE) – libxc code str for semi-local C functional

  • mlfunc_format (str, None) – ‘joblib’ or ‘yaml’, specifies the format of mlfunc if it is a string corresponding to a file name. If unspecified, infer from file extension and raise error if file type cannot be determined.

  • use_paw (bool, True) – Whether to compute PAW corrections. This should be True unless you plan to use norm-conserving pseudopotentials (NCPPs). Note, the use of NCPPs is allowed but not advised, as large errors might arise due to the use of incorrect nonlocal features.

  • pasdw_ovlp_fit (bool, True) – Whether to use overlap fitting to attempt to improve numerical precision of PASDW projections. Default to True. Impact of this parameter should be minor.

  • pasdw_store_funcs (bool, False) – Whether to store projector functions used in the PASDW routine. Defaults to False because this can be memory intensive, but if you have the space, the computational cost of the atomic corrections can be greatly reduced by setting to True.

  • Nalpha (int, None) – Number of interpolation points for the nonlocal feature kernel. If None, set automatically based on lambd, qmax, and qmin.

  • qmax (float, 300) – Maximum value of q to use for kernel interpolation on FFT grid. Default should be fine for most cases.

  • lambd (float, 1.8) – Density of interpolation points. q_alpha=q_0 * lambd**alpha. Smaller lambd is more expensive and more precise.

  • _force_nonlocal (bool, False) – Use nonlocal kernel even if nonlocal features are not required. For debugging use only. Do not adjust except for testing.

Returns:

A _CiderBase object (specific class depends on the parameters provided above, specifically on whether use_paw is True, whether the functional is GGA or MGGA form, and whether the functional is semi-local or nonlocal.)