Skip to content

Commit c5fa88e

Browse files
njzjz-botJinzhe Zeng
authored andcommitted
docs: add formulas to atomic model classes
Add mathematical formulas to atomic model class docstrings: - DPAtomicModel: descriptor + fitting pipeline - LinearEnergyAtomicModel: linear combination of models - PairTabAtomicModel: pairwise tabulated energy Follow numpydoc convention: parameters in class docstring.
1 parent 352a2b5 commit c5fa88e

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

deepmd/dpmodel/atomic_model/dp_atomic_model.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828
class DPAtomicModel(BaseAtomicModel):
2929
"""Model give atomic prediction of some physical property.
3030
31+
The atomic model computes atomic properties by first extracting a descriptor
32+
from the atomic environment, then passing it through a fitting network:
33+
34+
.. math::
35+
\mathcal{D}^i = \mathrm{Descriptor}(\mathbf{R}^i, \mathbf{R}_j, \mathrm{types}),
36+
37+
.. math::
38+
\mathbf{y}^i = \mathrm{Fitting}(\mathcal{D}^i),
39+
40+
where :math:`\mathcal{D}^i` is the descriptor for atom :math:`i`, and
41+
:math:`\mathbf{y}^i` is the predicted atomic property (energy, dipole, etc.).
42+
3143
Parameters
3244
----------
3345
descriptor

deepmd/dpmodel/atomic_model/linear_atomic_model.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
class LinearEnergyAtomicModel(BaseAtomicModel):
4141
"""Linear model make linear combinations of several existing models.
4242
43+
The linear model combines predictions from multiple atomic models:
44+
45+
.. math::
46+
E^i = \sum_{k=1}^{K} w_k \cdot E_k^i,
47+
48+
where :math:`E_k^i` is the energy predicted by the :math:`k`-th sub-model
49+
for atom :math:`i`, and :math:`w_k` is the corresponding weight. The weights
50+
can be learned or manually specified.
51+
52+
This is useful for combining different interaction types, e.g., DP + ZBL
53+
for short-range repulsion, or DP + D3 for dispersion corrections.
54+
4355
Parameters
4456
----------
4557
models : list[DPAtomicModel or PairTabAtomicModel]

deepmd/dpmodel/atomic_model/pairtab_atomic_model.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ class PairTabAtomicModel(BaseAtomicModel):
4545
At this moment, the model does not smooth the energy at the cutoff radius, so
4646
one needs to make sure the energy has been smoothed to zero.
4747
48+
The pairwise energy is computed by table lookup and interpolation:
49+
50+
.. math::
51+
E^i = \sum_{j \in \mathcal{N}(i)} E_{t_i, t_j}(r_{ij}),
52+
53+
where :math:`E_{t_i, t_j}(r)` is the tabulated pairwise energy between atom types
54+
:math:`t_i` and :math:`t_j` at distance :math:`r`, obtained via cubic spline
55+
interpolation from the table data.
56+
4857
Parameters
4958
----------
5059
tab_file : str

0 commit comments

Comments
 (0)