Skip to content

Commit

Permalink
Fixed errors in overview.rst and reduced redundant code in atomicdist…
Browse files Browse the repository at this point in the history
…ances.py
  • Loading branch information
ljwoods2 committed Dec 15, 2023
1 parent 10553fe commit 366f402
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
30 changes: 3 additions & 27 deletions package/MDAnalysis/analysis/atomicdistances.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,14 @@
We will calculate the distances between an atom group of atoms 101-105
and an atom group of atoms 4001-4005 with periodic boundary conditions.
To select these atoms:
.. testsetup::
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import GRO, XTC
import MDAnalysis.analysis.atomicdistances as ad
To select these atoms: ::
>>> u = mda.Universe(GRO, XTC)
>>> ag1 = u.atoms[100:105]
>>> ag2 = u.atoms[4000:4005]
We can run the calculations using any variable of choice such as
``my_dists`` and access our results using ``my_dists.results``:
.. testsetup::
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import GRO, XTC
import MDAnalysis.analysis.atomicdistances as ad
u = mda.Universe(GRO, XTC)
ag1 = u.atoms[100:105]
ag2 = u.atoms[4000:4005]
``my_dists`` and access our results using ``my_dists.results``: ::
>>> my_dists = ad.AtomicDistances(ag1, ag2).run()
>>> my_dists.results
Expand All @@ -106,16 +91,7 @@
To do the computation without periodic boundary conditions, we can enter
the keyword argument ``pbc=False`` after ``ag2``. The result is different
in this case:
.. testsetup::
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import GRO, XTC
import MDAnalysis.analysis.atomicdistances as ad
u = mda.Universe(GRO, XTC)
ag1 = u.atoms[100:105]
ag2 = u.atoms[4000:4005]
in this case: ::
>>> my_dists_nopbc = ad.AtomicDistances(ag1, ag2, pbc=False).run()
>>> my_dists_nopbc.results
Expand Down
2 changes: 1 addition & 1 deletion package/doc/sphinx/source/documentation_pages/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ over time::
< DCDReader '/..../MDAnalysis/tests/data/adk_dims.dcd' with 98 frames of 3341 atoms (0 fixed) >

Finally, the :meth:`MDAnalysis.Universe.select_atoms` method generates a new
:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion
:class:`~MDAnalysis.core.groups.AtomGroup` according to a selection criterion::

>>> calphas = u.select_atoms("name CA")
>>> print(calphas)
Expand Down

0 comments on commit 366f402

Please sign in to comment.