deepmd.utils.tabulate#

Attributes#

Classes#

BaseTabulate

A base class for pt and tf tabulation.

Module Contents#

deepmd.utils.tabulate.log[source]#
class deepmd.utils.tabulate.BaseTabulate(descrpt, neuron, type_one_side, exclude_types, is_pt)[source]#

Bases: abc.ABC

A base class for pt and tf tabulation.

descrpt[source]#
neuron[source]#
type_one_side[source]#
exclude_types[source]#
is_pt[source]#

Need to be initialized in the subclass.

descrpt_type = 'Base'[source]#
sel_a = [][source]#
rcut = 0.0[source]#
rcut_smth = 0.0[source]#
davg[source]#
dstd[source]#
ntypes = 0[source]#
layer_size = 0[source]#
table_size = 0[source]#
bias[source]#
matrix[source]#
data_type = None[source]#
last_layer_size = 0[source]#

Save the tabulation result.

data[source]#
upper[source]#
lower[source]#
build(min_nbor_dist: float, extrapolate: float, stride0: float, stride1: float) tuple[dict[str, int], dict[str, int]][source]#

Build the tables for model compression.

Parameters:
min_nbor_dist

The nearest distance between neighbor atoms

extrapolate

The scale of model extrapolation

stride0

The uniform stride of the first table

stride1

The uniform stride of the second table

Returns:
lowerdict[str, int]

The lower boundary of environment matrix by net

upperdict[str, int]

The upper boundary of environment matrix by net

_build_lower(net, xx, idx, upper, lower, stride0, stride1, extrapolate, nspline) None[source]#
abstract _make_data(xx, idx) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#

Generate tabulation data for the given input.

Parameters:
xxnp.ndarray

Input values to tabulate

idxint

Index for accessing the correct network parameters

Returns:
tuple[np.ndarray, np.ndarray, np.ndarray]

Values, first derivatives, and second derivatives

_all_excluded(ii: int) bool[source]#

Check if type ii excluds all types.

Parameters:
iiint

type index

Returns:
bool

if type ii excluds all types

abstract _get_descrpt_type()[source]#

Get the descrpt type.

abstract _get_layer_size()[source]#

Get the number of embedding layer.

_get_table_size()[source]#
_get_data_type()[source]#
_get_last_layer_size()[source]#
abstract _get_bias()[source]#

Get bias of embedding net.

abstract _get_matrix()[source]#

Get weight matrx of embedding net.

abstract _convert_numpy_to_tensor()[source]#

Convert self.data from np.ndarray to torch.Tensor.

_convert_numpy_float_to_int() None[source]#

Convert self.lower and self.upper from np.float32 or np.float64 to int.

_get_env_mat_range(min_nbor_dist)[source]#

Change the embedding net range to sw / min_nbor_dist.

_spline5_switch(xx, rmin, rmax)[source]#