deepmd.utils.pair_tab

Module Contents

Classes

PairTab

Pairwise tabulated potential.

Attributes

log

deepmd.utils.pair_tab.log[source]
class deepmd.utils.pair_tab.PairTab(filename: str, rcut: float | None = None)[source]

Pairwise tabulated potential.

Parameters:
filename

File name for the short-range tabulated potential. The table is a text data file with (N_t + 1) * N_t / 2 + 1 columes. The first colume is the distance between atoms. The second to the last columes are energies for pairs of certain types. For example we have two atom types, 0 and 1. The columes from 2nd to 4th are for 0-0, 0-1 and 1-1 correspondingly.

reinit(filename: str, rcut: float | None = None) None[source]

Initialize the tabulated interaction.

Parameters:
filename

File name for the short-range tabulated potential. The table is a text data file with (N_t + 1) * N_t / 2 + 1 columes. The first colume is the distance between atoms. The second to the last columes are energies for pairs of certain types. For example we have two atom types, 0 and 1. The columes from 2nd to 4th are for 0-0, 0-1 and 1-1 correspondingly.

serialize() dict[source]
classmethod deserialize(data) PairTab[source]
_check_table_upper_boundary() None[source]

Update User Provided Table Based on rcut.

This function checks the upper boundary provided in the table against rcut. If the table upper boundary values decay to zero before rcut, padding zeros will be added to the table to cover rcut; if the table upper boundary values do not decay to zero before ruct, extrapolation will be performed till rcut.

Examples

table = [[0.005 1. 2. 3. ]

[0.01 0.8 1.6 2.4 ] [0.015 0. 1. 1.5 ]]

rcut = 0.022

new_table = [[0.005 1. 2. 3. ]

[0.01 0.8 1.6 2.4 ] [0.015 0. 1. 1.5 ] [0.02 0. 0. 0. ]


table = [[0.005 1. 2. 3. ]

[0.01 0.8 1.6 2.4 ] [0.015 0.5 1. 1.5 ] [0.02 0.25 0.4 0.75 ] [0.025 0. 0.1 0. ] [0.03 0. 0. 0. ]]

rcut = 0.031

new_table = [[0.005 1. 2. 3. ]

[0.01 0.8 1.6 2.4 ] [0.015 0.5 1. 1.5 ] [0.02 0.25 0.4 0.75 ] [0.025 0. 0.1 0. ] [0.03 0. 0. 0. ] [0.035 0. 0. 0. ]]

get() Tuple[numpy.array, numpy.array][source]

Get the serialized table.

_extrapolate_table(pad_extrapolation: numpy.array) numpy.array[source]

Soomth extrapolation between table upper boundary and rcut.

This method should only be used when the table upper boundary rmax is smaller than rcut, and the table upper boundary values are not zeros. To simplify the problem, we use a single cubic spline between rmax and rcut for each pair of atom types. One can substitute this extrapolation to higher order polynomials if needed.

There are two scenarios:
  1. ruct - rmax >= hh:

    Set values at the grid point right before rcut to 0, and perform exterapolation between the grid point and rmax, this allows smooth decay to 0 at rcut.

  2. rcut - rmax < hh:

    Set values at rmax + hh to 0, and perform extrapolation between rmax and rmax + hh.

Parameters:
pad_extrapolationnp.array

The emepty grid that holds the extrapolation values.

Returns:
np.array

The cubic spline extrapolation.

_make_data()[source]