Skip to content

Commit 9359bd9

Browse files
committed
fix ipython blocks
1 parent a44e6cd commit 9359bd9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

doc/source/guessing.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Whereas most attributes are guessed at the atom, residue, or segment level, gues
9595

9696
Specifically, if these connectivity attributes are guessed, they are by default guessed *additively*. Therefore, if bonds and other objects are guessed twice, the bonds of the second guess are added on. Below, we see the number of bonds increase when guessed again with a looser criteria.
9797

98-
.. ipython::
98+
.. ipython:: python
9999
100100
from MDAnalysis.tests.datafiles import CONECT
101101
@@ -104,27 +104,31 @@ Specifically, if these connectivity attributes are guessed, they are by default
104104
u.guess_TopologyAttrs(to_guess=["bonds"], fudge_factor=1.2) # looser
105105
print(len(u.bonds))
106106
107+
107108
However, the number of bonds doesn't change when the bonds are guessed again with a stricter criteria -- no new bonds are found.
108109

109-
.. ipython::
110+
.. ipython:: python
110111
111112
u.guess_TopologyAttrs(to_guess=["bonds"], fudge_factor=0.5) # stricter
112113
print(len(u.bonds))
113114
115+
114116
Moreover, bonds are unique, so if the bonds are guessed again with a same criteria, the guessed bonds doesn't change.
115117

116-
.. ipython::
118+
.. ipython:: python
117119
118120
u.guess_TopologyAttrs(to_guess=["bonds"], fudge_factor=0.5) # same
119121
print(len(u.bonds))
120122
123+
121124
However, if you want to forcibly overwrite all existing bonds, angles, dihedrals or impropers, you can pass the object to the ``force_guess`` keyword. This will remove all existing objects of that type before guessing. Below, we see the number of bonds has shrunk when guessed with stricter criteria.
122125

123-
.. ipython::
124-
126+
.. ipython:: python
127+
125128
u.guess_TopologyAttrs(to_guess=["bonds"], force_guess=["bonds"], fudge_factor=0.5)
126129
print(len(u.bonds))
127130
131+
128132
-----------------
129133
Order of guessing
130134
-----------------
@@ -147,5 +151,3 @@ However, the snippet below will re-guess the types, and now bond-guessing can wo
147151
148152
u.guess_TopologyAttrs(to_guess=["types", "bonds"], force_guess=["types"])
149153
print(u.atoms.types)
150-
151-

0 commit comments

Comments
 (0)