deepmd.tf.modifier#

Submodules#

Classes#

BaseModifier

Potential energy model.

DipoleChargeModifier

Package Contents#

class deepmd.tf.modifier.BaseModifier(*args, **kwargs)[source]#

Bases: deepmd.tf.infer.DeepPot, make_base_modifier()

Potential energy model.

Parameters:
model_filePath

The name of the frozen model file.

*argslist

Positional arguments.

auto_batch_sizebool or int or AutoBatchSize, default: True

If True, automatic batch size will be used. If int, it will be used as the initial batch size.

neighbor_listase.neighborlist.NewPrimitiveNeighborList, optional

The ASE neighbor list class to produce the neighbor list. If None, the neighbor list will be built natively in the model.

**kwargsdict

Keyword arguments.

Examples

>>> from deepmd.infer import DeepPot
>>> import numpy as np
>>> dp = DeepPot("graph.pb")
>>> coord = np.array([[1, 0, 0], [0, 0, 1.5], [1, 0, 3]]).reshape([1, -1])
>>> cell = np.diag(10 * np.ones(3)).reshape([1, -1])
>>> atype = [1, 0, 1]
>>> e, f, v = dp.eval(coord, cell, atype)

where e, f and v are predicted energy, force and virial of the system, respectively.

class deepmd.tf.modifier.DipoleChargeModifier(model_name: str, model_charge_map: list[float], sys_charge_map: list[float], ewald_h: float = 1, ewald_beta: float = 1)[source]#

Bases: deepmd.tf.infer.deep_dipole.DeepDipoleOld, deepmd.tf.modifier.base_modifier.BaseModifier

Parameters:
model_name

The model file for the DeepDipole model

model_charge_map

Gives the amount of charge for the wfcc

sys_charge_map

Gives the amount of charge for the real atoms

ewald_h

Grid spacing of the reciprocal part of Ewald sum. Unit: A

ewald_beta

Splitting parameter of the Ewald sum. Unit: A^{-1}

modifier_prefix = 'dipole_charge'#
model_name#
model_charge_map#
sys_charge_map#
sel_type#
ewald_h = 1#
ewald_beta = 1#
er#
ext_dim = 3#
t_ndesc#
t_sela#
sel_r#
nnei_a#
nnei_r#
nnei#
ndescrpt_a#
ndescrpt_r#
force = None#
ntypes#
serialize() dict[source]#

Serialize the modifier.

Returns:
dict

The serialized data

classmethod deserialize(data: dict) deepmd.tf.modifier.base_modifier.BaseModifier[source]#

Deserialize the modifier.

Parameters:
datadict

The serialized data

Returns:
BaseModel

The deserialized modifier

build_fv_graph() deepmd.tf.env.tf.Tensor[source]#

Build the computational graph for the force and virial inference.

_build_fv_graph_inner()[source]#
_enrich(dipole, dof=3)[source]#
_slice_descrpt_deriv(deriv)[source]#
eval(coord: numpy.ndarray, box: numpy.ndarray, atype: numpy.ndarray, eval_fv: bool = True) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#

Evaluate the modification.

Parameters:
coord

The coordinates of atoms

box

The simulation region. PBC is assumed

atype

The atom types

eval_fv

Evaluate force and virial

Returns:
tot_e

The energy modification

tot_f

The force modification

tot_v

The virial modification

_eval_fv(coords, cells, atom_types, ext_f)[source]#
_extend_system(coord, box, atype, charge)[source]#
modify_data(data: dict, data_sys: deepmd.tf.utils.data.DeepmdData) None[source]#

Modify data.

Parameters:
data

Internal data of DeepmdData. Be a dict, has the following keys - coord coordinates - box simulation box - type atom types - find_energy tells if data has energy - find_force tells if data has force - find_virial tells if data has virial - energy energy - force force - virial virial

data_sysDeepmdData

The data system.