Skip to content

Commit

Permalink
docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
phydev committed Jun 29, 2020
1 parent 1d49050 commit 5c4d006
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions trajpy/trajpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ def msd_time_averaged(trajectory, tau):
.. math::
\\langle \\mathbf{r}_{\\tau}^2 \\rangle = \\frac{1}{T-\\tau} \\sum_{t=1}^{N-\\tau} |\\mathbf{x}_{t+\\tau} - \\mathbf{x}_{\\tau} |^2
where :math:`\\tau` is the time interval (time lag) between the two positions and $T$ is total trajectory time length
where :math:`\\tau` is the time interval (time lag) between the two positions and :math:`T is total trajectory time length.
:param trajectory: trajectory array
:param tau: time lag, it can be a single value or an array
:return msd: return the ensemble averaged mean square displacement
:return msd: time-averaged MSD
"""
if type(tau) == int:
tau = np.asarray([tau])
Expand Down Expand Up @@ -125,9 +126,9 @@ def msd_ensemble_averaged(trajectory):
.. math::
\\langle \\mathbf{r}^2 \\rangle (t) = \\frac{1}{N-1} \\sum_{n=1}^N |\\mathbf{x}_{n}-\\mathbf{x}_0|^2
where :math:`N` is the number of trajectories, :math:`\\mathbf{r}_n(t)` is the position of the trajectory :mathm:`n` at time :math:`t`.
where :math:`N` is the number of trajectories, :math:`\\mathbf{r}_n(t)` is the position of the trajectory :math:`n` at time :math:`t`.
:return msd: time-averaged msd
:return msd: ensemble-averaged msd
"""
msd = np.zeros(len(trajectory))
for n in range(0, len(trajectory)):
Expand Down Expand Up @@ -226,6 +227,7 @@ def gyration_radius_(trajectory):
where :math:`N` is the number of segments of the trajectory, :math:`\\mathbf{r}_i` is the :math:`i`-th position vector along the trajectory,
:math:`m` and :math:`n` assume the values of the corresponding coordinates along the directions :math:`x, y, z`.
:return gyration_radius: tensor
"""

Expand Down Expand Up @@ -271,7 +273,7 @@ def anisotropy_(eigenvalues):
Calculates the trajectory anisotropy using the eigenvalues of the gyration radius tensor.
.. math::
a^2 = 1 - 3 \\frac{\\lambda_x\\lambda_y + \\lambda_y \\lambda_z + \\lambda_z\\lambda_x }{(\\lambda_x+\\lambda_y+\\lambda_z)^2}
a^2 = 1 - 3 \\frac{\\lambda_1\\lambda_2 + \\lambda_2 \\lambda_3 + \\lambda_3\\lambda_1 }{(\\lambda_1+\\lambda_2+\\lambda_3)^2}
"""

Expand Down

0 comments on commit 5c4d006

Please sign in to comment.