Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion deepmd/dpmodel/fitting/dipole_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,24 @@
@BaseFitting.register("dipole")
@fitting_check_output
class DipoleFitting(GeneralFitting):
r"""Fitting rotationally equivariant diploe of the system.
r"""Fitting rotationally equivariant dipole of the system.

The dipole :math:`\boldsymbol{\mu}` is computed from the fitting network output
and the rotation matrix:

.. math::
\boldsymbol{\mu}^i = \mathbf{M}^i \cdot \mathbf{R}^i,

where :math:`\mathbf{M}^i \in \mathbb{R}^{1 \times m_1}` is the output of the fitting
network for atom :math:`i`, :math:`\mathbf{R}^i \in \mathbb{R}^{m_1 \times 3}` is
the rotation matrix from the descriptor, and :math:`m_1` is the embedding width
(the dimension of the rotation matrix). The fitting network is:

.. math::
\mathbf{M}^i = \mathcal{L}^{(n)} \circ \mathcal{L}^{(n-1)} \circ \cdots \circ \mathcal{L}^{(0)}(\mathcal{D}^i),

where :math:`\mathcal{D}^i` is the descriptor and each layer :math:`\mathcal{L}^{(k)}`
is a fully connected layer with an activation function.

Parameters
----------
Expand Down
29 changes: 29 additions & 0 deletions deepmd/dpmodel/fitting/polarizability_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@
class PolarFitting(GeneralFitting):
r"""Fitting rotationally equivariant polarizability of the system.

The polarizability tensor :math:`\boldsymbol{\alpha} \in \mathbb{R}^{3 \times 3}` is
computed from the fitting network output and the rotation matrix
:math:`\mathbf{R}^i \in \mathbb{R}^{m_1 \times 3}` from the descriptor,
where :math:`m_1` is the embedding width (the dimension of the rotation matrix):

**Diagonal fitting** (when `fit_diag=True`):

.. math::
\boldsymbol{\alpha}^i = \mathbf{R}^{i,T} \cdot \mathrm{diag}(\mathbf{p}^i) \cdot \mathbf{R}^i,

where :math:`\mathbf{p}^i \in \mathbb{R}^{m_1}` is the diagonal elements of the
local-frame polarizability predicted by the fitting network.

**Full matrix fitting** (when `fit_diag=False`):

.. math::
\boldsymbol{\alpha}^i = \mathbf{R}^{i,T} \cdot \mathbf{P}^i \cdot \mathbf{R}^i,

where :math:`\hat{\mathbf{P}}^i \in \mathbb{R}^{m_1 \times m_1}` is the raw output of
the fitting network, and :math:`\mathbf{P}^i = \frac{1}{2}(\hat{\mathbf{P}}^i + \hat{\mathbf{P}}^{i,T})`
is the symmetrized version. Since :math:`\mathbf{P}^i` is symmetric, the resulting
:math:`\boldsymbol{\alpha}^i` is guaranteed to be a symmetric tensor (matrix products
of the form :math:`A^T S A` preserve symmetry).

The fitting network is:

.. math::
\mathbf{p}^i \text{ (or } \mathbf{P}^i) = \mathcal{L}^{(n)} \circ \cdots \circ \mathcal{L}^{(0)}(\mathcal{D}^i).

Parameters
----------
ntypes
Expand Down