deepmd.tf.calculator

Module Contents

Classes

DP

Implementation of ASE deepmd calculator.

class deepmd.tf.calculator.DP(model: str | pathlib.Path, label: str = 'DP', type_dict: Dict[str, int] | None = None, neighbor_list=None, **kwargs)[source]

Bases: ase.calculators.calculator.Calculator

Implementation of ASE deepmd calculator.

Implemented propertie are energy, forces and stress

Parameters:
modelUnion[str, Path]

path to the model

labelstr, optional

calculator label, by default “DP”

type_dictDict[str, int], optional

mapping of element types and their numbers, best left None and the calculator will infer this information from model, by default None

neighbor_listase.neighborlist.NeighborList, optional

The neighbor list object. If None, then build the native neighbor list.

Examples

Compute potential energy

>>> from ase import Atoms
>>> from deepmd.tf.calculator import DP
>>> water = Atoms('H2O',
>>>             positions=[(0.7601, 1.9270, 1),
>>>                        (1.9575, 1, 1),
>>>                        (1., 1., 1.)],
>>>             cell=[100, 100, 100],
>>>             calculator=DP(model="frozen_model.pb"))
>>> print(water.get_potential_energy())
>>> print(water.get_forces())

Run BFGS structure optimization

>>> from ase.optimize import BFGS
>>> dyn = BFGS(water)
>>> dyn.run(fmax=1e-6)
>>> print(water.get_positions())
name = 'DP'
implemented_properties: ClassVar[List[str]] = ['energy', 'free_energy', 'forces', 'virial', 'stress']
calculate(atoms: ase.Atoms | None = None, properties: List[str] = ['energy', 'forces', 'virial'], system_changes: List[str] = all_changes)[source]

Run calculation with deepmd model.

Parameters:
atomsOptional[Atoms], optional

atoms object to run the calculation on, by default None

propertiesList[str], optional

unused, only for function signature compatibility, by default [“energy”, “forces”, “stress”]

system_changesList[str], optional

unused, only for function signature compatibility, by default all_changes