Feature Settings

Settings objects are the serialized declarations of a model’s raw electronic features. Their parameter order, spin convention, scaling powers, and uniform electron gas limits define the inputs expected by the normalizers and mapped evaluator. Calculation interfaces read these objects from the model; model construction and descriptor workflows can create them explicitly.

Composite settings

class ciderpress.dft.settings.BaseSettings

This is a base class for storing the settings for different types of density/density matrix feature in CiderPress. Settings objects indicate which features must be evaluated, and with which hyperparameters, to use as input to an ML functional.

abstractmethod get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property is_empty

Return true of this settings object specifies zero features.

abstract property nfeat

Returns: Number of features in this feature set.

abstractmethod ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.FeatureSettings(sl_settings=None, nldf_settings=None, nlof_settings=None, sdmx_settings=None, hyb_settings=None, normalizers=None)

The FeatureSettings object is a container for the settings of each type of feature in the model.

Initialize FeatureSettings.

Parameters:
  • sl_settings (SemilocalSettings or EmptySettings) – Semilocal feature settings

  • nldf_settings (NLDFSettings or EmptySettings) – Nonlocal density feature settings

  • nlof_settings (FracLaplSettings or EmptySettings) – Nonlocal orbital feature settings

  • sdmx_settings (SDMXBaseSettings or EmptySettings) – Spherically averaged EXX settings

  • hyb_settings (HybridSettings or EmptySettings) – (Local) hybrid DFT settings

  • normalizers (FeatNormalizerList) – List of normalizers for features

get_feat_usps(with_normalizers=False)
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0, with_normalizers=False)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

Semilocal settings

class ciderpress.dft.settings.EmptySettings

The EmptySettings class is a representation of a feature set containing zero features. It is used when a certain type of feature is not present in a model. (For example, if a model does not use SDMX features, that model’s FeatureSettings.sdmx_settings will be an EmptySettings instance.)

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.SemilocalSettings(mode='nst')

Semilocal feature set. Currently only supports meta-GGA. Should not be edited from default in general.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

NLDF settings

class ciderpress.dft.settings.NLDFSettings(sl_level, theta_params, rho_mult)

NLDFSettings contains the settings for the nonlocal density features, which form the core of the CIDER framework. This is an abstract class since the feature settings depend on the version. Subclasses are available for versions i, j, ij, and k features.

Initialize NLDFSettings.

Parameters:
  • sl_level (str) – “GGA” or “MGGA”, the level of semilocal ingredients used to construct the length-scale exponent.

  • theta_params (np.ndarray(2 or 3)) – Settings for the squared-exponential kernel exponent for the r’ (integrated) coordinate of the features. For version ‘k’, this ‘exponent’ is not used in the squared-exponential but rather within the density damping scheme (see rho_damp). Should be an array of 3 floats [a0, grad_mul, tau_mul]. tau_mul is ignored if sl_level=”GGA” and may therefore be excluded.

  • rho_mult (str) – Multiply the density that gets integrated by a prefactor. Options: See ALLOWED_RHO_MULTS.

abstract property feat_spec_list

Return a list containing feature specs in appropriate order.

abstractmethod get_feat_usps()

Returns a list containing the usp of each contracted feature.

abstractmethod get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Number of contracted, scale-invariant features.

property nldf_type

Same as version, represents type of NLDFs being computed.

abstract property num_feat_param_sets

Number of unique feature parameter sets

Type:

Returns

abstract property num_vi_feats

Return the number of version i-type features.

class ciderpress.dft.settings.NLDFSettingsVI(sl_level, theta_params, rho_mult, l0_feat_specs, l1_feat_specs, l1_feat_dots)

Initialize NLDFSettingsVI object

Parameters:
  • sl_level (str) – “GGA” or “MGGA”, the level of semilocal ingredients used to construct the length-scale exponent.

  • theta_params (np.ndarray) – Settings for the squared-exponential kernel exponent for the r’ (integrated) coordinate of the features. For version ‘k’, this ‘exponent’ is not used in the squared-exponential but rather within the density damping scheme (see rho_damp).

  • rho_mult (str) – Multiply the density that gets integrated by a prefactor. Options: See ALLOWED_RHO_MULTS.

  • l0_feat_specs (list of str) – Each item in the list is a str specifying the formula to be used for the scalar (l=0) features. See ALLOWED_I_SPECS_L0 for allowed values.

  • l1_feat_specs (list of str) – Each item in the list is a str specifying the formula for the vector (l=1) features. See ALLOWED_I_SPECS_L1 for allowed values.

  • l1_feat_dots (list of (int, int)) – The vector features must be contracted with each other (via dot product) to form scalar features for the ML model. Each item i in the list is a 2-tuple with indexes j,k for features to contract. -1 refers to the semilocal density gradient. l1feat_ig = einsum(‘xg,xg->g’, l1ints_jg, l1ints_kg)

property feat_spec_list

Return a list containing feature specs in appropriate order.

get_feat_usps()

Returns a list containing the usp of each contracted feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property num_feat_param_sets

Number of unique feature parameter sets

Type:

Returns

property num_vi_feats

Return the number of version i-type features.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.NLDFSettingsVJ(sl_level, theta_params, rho_mult, feat_specs, feat_params, vdw_param=False)

Initialize NLDFSettingsVJ

Parameters:
  • sl_level (str) – “GGA” or “MGGA”, the level of semilocal ingredients used to construct the length-scale exponent.

  • theta_params (np.ndarray) – Settings for the squared-exponential kernel exponent for the r’ (integrated) coordinate of the features. For version ‘k’, this ‘exponent’ is not used in the squared-exponential but rather within the density damping scheme (see rho_damp).

  • rho_mult (str) – Multiply the density that gets integrated by a prefactor. Options: See ALLOWED_RHO_MULTS.

  • feat_specs (list of str) – Each item in the list is a string specifying the formula to be used for a feature (see ALLOWED_J_SPECS for options). feat_specs[i] uses the parameterization of feat_params[i]. feat_specs and feat_params must be the same length.

  • feat_params (list of np.ndarray) – Each item in the list is an array with the parameters for the feature corresponding to the feat_specs above. Typically, each array has three numbers [a0, grad_mul, tau_mul], except erf_rinv which has an additional parameter erf_mul for the ratio of the erf / rinv exponent to the squared-exponential exponent. tau_mul is ignored if sl_level=”GGA” and may therefore be excluded.

  • vdw_param (bool) – Enable the experimental rational-kernel feature specs in EXPERIMENTAL_VDW_J_SPECS.

property feat_spec_list

Return a list containing feature specs in appropriate order.

get_feat_usps()

Returns a list containing the usp of each contracted feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property num_feat_param_sets

Number of unique feature parameter sets

Type:

Returns

property num_vi_feats

Return the number of version i-type features.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.NLDFSettingsVIJ(sl_level, theta_params, rho_mult, l0_feat_specs_i, l1_feat_specs_i, l1_feat_dots_i, feat_specs_j, feat_params_j)

Note

When storing features in array, j should go first, followed by i.

Initialize NLDFSettingsVIJ object

Parameters:
  • sl_level (str) – “GGA” or “MGGA”, the level of semilocal ingredients used to construct the length-scale exponent.

  • theta_params (np.ndarray) – Settings for the squared-exponential kernel exponent for the r’ (integrated) coordinate of the features. For version ‘k’, this ‘exponent’ is not used in the squared-exponential but rather within the density damping scheme (see rho_damp).

  • rho_mult (str) – Multiply the density that gets integrated by a prefactor. Options: See ALLOWED_RHO_MULTS.

  • l0_feat_specs_i (list of str) – Each item in the list is a str specifying the formula to be used for the scalar (l=0) features. See ALLOWED_I_SPECS_L0 for allowed values.

  • l1_feat_specs_i (list of str) – Each item in the list is a str specifying the formula for the vector (l=1) features. See ALLOWED_I_SPECS_L1 for allowed values.

  • l1_feat_dots_i (list of (int, int)) – The vector features must be contracted with each other (via dot product) to form scalar features for the ML model. Each item i in the list is a 2-tuple with indexes j,k for features to contract. -1 refers to the semilocal density gradient. l1feat_ig = einsum(‘xg,xg->g’, l1ints_jg, l1ints_kg)

  • feat_specs_j (list of str) – Each item in the list is a string specifying the formula to be used for a feature (see ALLOWED_J_SPECS for options). feat_specs[i] uses the parameterization of feat_params[i]. feat_specs and feat_params must be the same length.

  • feat_params_j (list of np.ndarray) – Each item in the list is an array with the parameters for the feature corresponding to the feat_specs above. Typically, each array has three numbers [a0, grad_mul, tau_mul], except erf_rinv which has an additional parameter erf_mul for the ratio of the erf / rinv exponent to the squared-exponential exponent. tau_mul is ignored if sl_level=”GGA” and may therefore be excluded.

property feat_spec_list

Return a list containing feature specs in appropriate order.

get_feat_usps()

Returns a list containing the usp of each contracted feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property num_feat_param_sets

Number of unique feature parameter sets

Type:

Returns

property num_vi_feats

Return the number of version i-type features.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.NLDFSettingsVK(sl_level, theta_params, rho_mult, feat_params, rho_damp)

Initialize NLDFSettingsVK

Parameters:
  • sl_level (str) – “GGA” or “MGGA”, the level of semilocal ingredients used to construct the length-scale exponent.

  • theta_params (np.ndarray) – Settings for the squared-exponential kernel exponent for the r’ (integrated) coordinate of the features. For version ‘k’, this ‘exponent’ is not used in the squared-exponential but rather within the density damping scheme (see rho_damp).

  • rho_mult (str) – Multiply the density that gets integrated by a prefactor. Options: See ALLOWED_RHO_MULTS.

  • feat_params (list of np.ndarray) – Each item in the list is an array with the parameters for the feature corresponding to the feat_specs above. Typically, each array has three numbers [a0, grad_mul, tau_mul], except erf_rinv which has an additional parameter erf_mul for the ratio of the erf / rinv exponent to the squared-exponential exponent. tau_mul is ignored if sl_level=”GGA” and may therefore be excluded.

  • rho_damp (str) – Specifies the damping for the density. Options: ‘none’, ‘exponential’, ‘asymptotic_const’

property feat_spec_list

Return a list containing feature specs in appropriate order.

get_feat_usps()

Returns a list containing the usp of each contracted feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property num_feat_param_sets

Number of unique feature parameter sets

Type:

Returns

property num_vi_feats

Return the number of version i-type features.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

SDMX settings

class ciderpress.dft.settings.SDMXSettings(pows)

Initialize SDMX settings.

Parameters:

pows (list of int) – For each \(n\) in pows, \(\int \mathrm{d}R\,R^{2-n}\rho_{\mathrm{smooth}}(R)\) is computed. Technically, \(n\) can be any float, but it should be 0, 1, or 2 for normalizability and ability to compute UEG values. If not 0, 1, or 2, UEG limit cannot be computed, and features might be poorly defined/numerically inaccurate.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.SDMXGSettings(pows, ndt)

Initialize SDMXGSettings

Parameters:
  • pows (list of int) – list of 0, 1, 2, see SDMXSettings docstring.

  • ndt (int) – Number of gradient features \(H_n^d\). Computes features for the first ndt values of \(n\) in pows.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.SDMX1Settings(pows, n1)

Initialize SDMX1Settings

Parameters:
  • pows (list of int) – list of 0, 1, 2, see SDMXSettings docstring.

  • n1 (int) – Number of gradient features \(H_n^1\). Computes features for the first n1 values of \(n\) in pows.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.SDMXG1Settings(pows, nd, n1)

Initialize SDMXG1Settings

Parameters:
  • pows (list of int) – list of 0, 1, 2, see SDMXSettings docstring.

  • nd (int) – Number of gradient features \(H_n^d\). Computes features for the first nd values of \(n\) in pows.

  • n1 (int) – Number of gradient features \(H_n^1\). Computes features for the first n1 values of \(n\) in pows.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

class ciderpress.dft.settings.SDMXFullSettings(settings_dict=None)
Parameters:

settings_dict (dict) – Each key is float. Each value is a 2-tuple. The first item is a list of pows. The second item is a 4-list/tuple with the number of pows for 0, d, 1, and 1d features.

get_feat_usps()
Returns:

A list of floats with the uniform scaling power for each feature.

get_reasonable_normalizer()
Returns:

list of normalizers for these features

Return type:

norms (list[FeatNormalizer])

property nfeat

Returns: Number of features in this feature set.

ueg_vector(rho=1.0)

Return the feature vector for the uniform electron gas as a function of the density rho

Parameters:

rho (float) – Value of the density

Returns:

UEG feature vector

Return type:

np.ndarray(float)

Semilocal helper functions

ciderpress.dft.settings.get_cider_exponent(rho, sigma, tau, a0=1.0, grad_mul=0.0, tau_mul=0.03125, rhocut=1e-10, nspin=1)

Evaluate an NLDF length-scale exponent at the MGGA level.

ciderpress.dft.settings.get_cider_exponent_gga(rho, sigma, a0=1.0, grad_mul=0.03125, rhocut=1e-10, nspin=1)

Evaluate an NLDF length-scale exponent at the GGA level.

ciderpress.dft.settings.get_uniform_tau(rho)
ciderpress.dft.settings.get_single_orbital_tau(rho, mag_grad)
ciderpress.dft.settings.get_s2(rho, sigma)
ciderpress.dft.settings.get_alpha(rho, sigma, tau)