deepmd.tf.calculator
====================

.. py:module:: deepmd.tf.calculator


Classes
-------

.. autoapisummary::

   deepmd.tf.calculator.DP


Module Contents
---------------

.. py:class:: DP(model: Union[str, pathlib.Path], label: str = 'DP', type_dict: Optional[dict[str, int]] = None, neighbor_list: Optional[ase.neighborlist.NeighborList] = None, head: Optional[str] = None, **kwargs: Any)

   Bases: :py:obj:`ase.calculators.calculator.Calculator`


   
   Implementation of ASE deepmd calculator.

   Implemented properties are `energy`, `forces` and `stress`

   :Parameters:

       **model** : :obj:`Union <typing.Union>`\[:class:`python:str`, :obj:`Path`]
           path to the model

       **label** : :class:`python:str`, :obj:`optional`
           calculator label, by default "DP"

       **type_dict** : :class:`python:dict`\[:class:`python:str`, :class:`python:int`], :obj:`optional`
           mapping of element types and their numbers, best left None and the calculator
           will infer this information from model, by default None

       **neighbor_list** : :obj:`ase.neighborlist.NeighborList`, :obj:`optional`
           The neighbor list object. If None, then build the native neighbor list.

       **head** : :obj:`Union <typing.Union>`\[:class:`python:str`, :data:`python:None`], :obj:`optional`
           a specific model branch choosing from pretrained model, by default None













   .. rubric:: 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())

   ..
       !! processed by numpydoc !!

   .. py:attribute:: name
      :value: 'DP'



   .. py:attribute:: implemented_properties
      :type:  ClassVar[list[str]]
      :value: ['energy', 'free_energy', 'forces', 'virial', 'stress']


      
      Properties calculator can handle (energy, forces, ...)
















      ..
          !! processed by numpydoc !!


   .. py:attribute:: dp


   .. py:method:: calculate(atoms: Optional[ase.Atoms] = None, properties: list[str] = ['energy', 'forces', 'virial'], system_changes: list[str] = all_changes) -> None

      
      Run calculation with deepmd model.


      :Parameters:

          **atoms** : :obj:`Optional <typing.Optional>`\[:obj:`Atoms`], :obj:`optional`
              atoms object to run the calculation on, by default None

          **properties** : :class:`python:list`\[:class:`python:str`], :obj:`optional`
              unused, only for function signature compatibility,
              by default ["energy", "forces", "stress"]

          **system_changes** : :class:`python:list`\[:class:`python:str`], :obj:`optional`
              unused, only for function signature compatibility, by default all_changes














      ..
          !! processed by numpydoc !!


