Skip to content

Commit

Permalink
Fix formula in docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
padix-key committed Nov 2, 2022
1 parent 3db9c5e commit 6ca31da
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 42 deletions.
41 changes: 22 additions & 19 deletions src/springcraft/anm.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,32 +326,16 @@ def bfactor(self, mode_subset=None, tem=None,
)

def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
"""
r"""
Computes the normalized *dynamic cross-correlation* between
nodes of the ANM. The DCC for a nodepair :math:`ij` is computed as:
.. math::
DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
with :math:`\lambda` and :math:`\vec{u}` as
Eigenvalues and Eigenvectors corresponding to mode :math:`k` of
the modeset :math:`L`.
DCCs can be normalized to MSFs exhibited by two compared nodes
following:
.. math::
nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}}
nodes of the ANM.
The DCC is a measure for the correlation in fluctuations
exhibited by a given pair of nodes. If normalized, pairs with
correlated fluctuations (same phase and period),
anticorrelated fluctuations (opposite phase, same period)
and non-correlated fluctuations are assigned (normalized)
DCC values of 1, -1 and 0 respectively.
For results consistent with MSFs, temperature-weighted
absolute values can be computed (only relevant if results
are not normalized).
Expand All @@ -374,12 +358,31 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
If tem is None, no temperature scaling is conducted.
tem_factors : int, float, optional
Factors included in temperature weighting
(with K_B as preset).
(with :math:`k_B` as preset).
Returns
-------
dcc : ndarray, shape=(n, n), dtype=float
DCC values for ENM nodes.
Notes
-----
The DCC for a nodepair :math:`ij` is computed as:
.. math::
DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
with :math:`\lambda` and :math:`\vec{u}` as
Eigenvalues and Eigenvectors corresponding to mode :math:`k` of
the modeset :math:`L`.
DCCs can be normalized to MSFs exhibited by two compared nodes
following:
.. math::
nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}}
"""
return nma.dcc(
self, mode_subset, norm, tem, tem_factors
Expand Down
41 changes: 22 additions & 19 deletions src/springcraft/gnm.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,32 +245,16 @@ def bfactor(self, mode_subset=None, tem=None,
)

def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
"""
r"""
Computes the normalized *dynamic cross-correlation* between
nodes of the GNM. The DCC for a nodepair :math:`ij` is computed as:
.. math::
DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
with :math:`\lambda`. and :math:`\vec{u}`. as
Eigenvalues and Eigenvectors corresponding to mode :math:`k`. of
the modeset :math:`L`.
DCCs can be normalized to MSFs exhibited by two compared nodes
following:
.. math::
nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}}
nodes of the GNM.
The DCC is a measure for the correlation in fluctuations
exhibited by a given pair of nodes. If normalized, pairs with
correlated fluctuations (same phase and period),
anticorrelated fluctuations (opposite phase, same period)
and non-correlated fluctuations are assigned (normalized)
DCC values of 1, -1 and 0 respectively.
For results consistent with MSFs, temperature-weighted
absolute values can be computed (only relevant if results
are not normalized).
Expand All @@ -293,12 +277,31 @@ def dcc(self, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
If tem is None, no temperature scaling is conducted.
tem_factors : int, float, optional
Factors included in temperature weighting
(with K_B as preset).
(with :math:`k_B` as preset).
Returns
-------
dcc : ndarray, shape=(n, n), dtype=float
DCC values for ENM nodes.
Notes
-----
The DCC for a nodepair :math:`ij` is computed as:
.. math::
DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
with :math:`\lambda` and :math:`\vec{u}` as
Eigenvalues and Eigenvectors corresponding to mode :math:`k` of
the modeset :math:`L`.
DCCs can be normalized to MSFs exhibited by two compared nodes
following:
.. math::
nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}}
"""
return nma.dcc(
self, mode_subset, norm, tem, tem_factors
Expand Down
8 changes: 4 additions & 4 deletions src/springcraft/nma.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def bfactor(enm, mode_subset=None, tem=None,
return b_factors

def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
"""
r"""
Computes the normalized *dynamic cross-correlation* between
nodes of the GNM/ANM.
Expand All @@ -254,7 +254,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
If tem is None, no temperature scaling is conducted.
tem_factors : int, float, optional
Factors included in temperature weighting
(with K_B as preset).
(with :math:`k_B` as preset).
Returns
-------
Expand All @@ -268,7 +268,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
.. math::
DCC_{ij} = \frac{3 k_B T}{\gamme} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
DCC_{ij} = \frac{3 k_B T}{\gamma} \sum_k^L \left[ \frac{\vec{u}_k \cdot \vec{u}_k^T}{\lambda_k} \right]_{ij}
with :math:`\lambda` and :math:`\vec{u}` as
Eigenvalues and Eigenvectors corresponding to mode :math:`k` of
Expand All @@ -279,7 +279,7 @@ def dcc(enm, mode_subset=None, norm=True, tem=None, tem_factors=K_B):
.. math::
nDCC_{ij} = \frac{DCC_{ij}}{[\DCC_{ii} DCC_{jj}]^{1/2}}
nDCC_{ij} = \frac{DCC_{ij}}{[DCC_{ii} DCC_{jj}]^{1/2}}
"""
from .gnm import GNM
from .anm import ANM
Expand Down

0 comments on commit 6ca31da

Please sign in to comment.