Skip to content

Commit 366f402

Browse files
committed
Fixed errors in overview.rst and reduced redundant code in atomicdistances.py
1 parent 10553fe commit 366f402

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

package/MDAnalysis/analysis/atomicdistances.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,29 +67,14 @@
6767
6868
We will calculate the distances between an atom group of atoms 101-105
6969
and an atom group of atoms 4001-4005 with periodic boundary conditions.
70-
To select these atoms:
71-
72-
.. testsetup::
73-
74-
import MDAnalysis as mda
75-
from MDAnalysis.tests.datafiles import GRO, XTC
76-
import MDAnalysis.analysis.atomicdistances as ad
70+
To select these atoms: ::
7771
7872
>>> u = mda.Universe(GRO, XTC)
7973
>>> ag1 = u.atoms[100:105]
8074
>>> ag2 = u.atoms[4000:4005]
8175
8276
We can run the calculations using any variable of choice such as
83-
``my_dists`` and access our results using ``my_dists.results``:
84-
85-
.. testsetup::
86-
87-
import MDAnalysis as mda
88-
from MDAnalysis.tests.datafiles import GRO, XTC
89-
import MDAnalysis.analysis.atomicdistances as ad
90-
u = mda.Universe(GRO, XTC)
91-
ag1 = u.atoms[100:105]
92-
ag2 = u.atoms[4000:4005]
77+
``my_dists`` and access our results using ``my_dists.results``: ::
9378
9479
>>> my_dists = ad.AtomicDistances(ag1, ag2).run()
9580
>>> my_dists.results
@@ -106,16 +91,7 @@
10691
10792
To do the computation without periodic boundary conditions, we can enter
10893
the keyword argument ``pbc=False`` after ``ag2``. The result is different
109-
in this case:
110-
111-
.. testsetup::
112-
113-
import MDAnalysis as mda
114-
from MDAnalysis.tests.datafiles import GRO, XTC
115-
import MDAnalysis.analysis.atomicdistances as ad
116-
u = mda.Universe(GRO, XTC)
117-
ag1 = u.atoms[100:105]
118-
ag2 = u.atoms[4000:4005]
94+
in this case: ::
11995
12096
>>> my_dists_nopbc = ad.AtomicDistances(ag1, ag2, pbc=False).run()
12197
>>> my_dists_nopbc.results

package/doc/sphinx/source/documentation_pages/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ over time::
120120
< DCDReader '/..../MDAnalysis/tests/data/adk_dims.dcd' with 98 frames of 3341 atoms (0 fixed) >
121121

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

125125
>>> calphas = u.select_atoms("name CA")
126126
>>> print(calphas)

0 commit comments

Comments
 (0)