Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CI workflow committed Jun 26, 2024
1 parent 263f465 commit 55ab634
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 58 deletions.
17 changes: 15 additions & 2 deletions _sources/oxpy/index.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,20 @@ with oxpy.Context():
# and the interaction energy between the first two particles
print("Interaction energy between particle 0 and particle 1:", manager.config_info().interaction.pair_interaction(particles[0], particles[1]))
```


:::{warning}
There is a known issue that makes the code segfault whenever multiple `with oxpy.Context()` are used in a single script. In these cases a simple workaround is to add a `del manager` instruction at the end of the `with` code block, like this:

```python
for _ in range(N_sims):
with oxpy.Context():
manager = oxpy.OxpyManager("input")
manager.run(N_steps)
del manager # <-- if you comment this line the script will segfault
```

:::

If you want, you can initialise the input file yourself and change some of the options before initialising the manager:

```python
Expand Down Expand Up @@ -67,7 +80,7 @@ conf_file = init_conf.dat
trajectory_file = trajectory.dat
energy_file = energy.dat
```

## An example of a simple analysis

Here we loop over all the configurations stored in an oxDNA trajectory file, printing the position of the first particle.
Expand Down
54 changes: 27 additions & 27 deletions oat/api.html

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions oat/utils.html

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions oxpy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ <h2>An example of a simple simulation<a class="headerlink" href="#an-example-of-
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Interaction energy between particle 0 and particle 1:&quot;</span><span class="p">,</span> <span class="n">manager</span><span class="o">.</span><span class="n">config_info</span><span class="p">()</span><span class="o">.</span><span class="n">interaction</span><span class="o">.</span><span class="n">pair_interaction</span><span class="p">(</span><span class="n">particles</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">particles</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
</pre></div>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>There is a known issue that makes the code segfault whenever multiple <code class="docutils literal notranslate"><span class="pre">with</span> <span class="pre">oxpy.Context()</span></code> are used in a single script. In these cases a simple workaround is to add a <code class="docutils literal notranslate"><span class="pre">del</span> <span class="pre">manager</span></code> instruction at the end of the <code class="docutils literal notranslate"><span class="pre">with</span></code> code block, like this:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">N_sims</span><span class="p">):</span>
<span class="k">with</span> <span class="n">oxpy</span><span class="o">.</span><span class="n">Context</span><span class="p">():</span>
<span class="n">manager</span> <span class="o">=</span> <span class="n">oxpy</span><span class="o">.</span><span class="n">OxpyManager</span><span class="p">(</span><span class="s2">&quot;input&quot;</span><span class="p">)</span>
<span class="n">manager</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">N_steps</span><span class="p">)</span>
<span class="k">del</span> <span class="n">manager</span> <span class="c1"># &lt;-- if you comment this line the script will segfault</span>
</pre></div>
</div>
</div>
<p>If you want, you can initialise the input file yourself and change some of the options before initialising the manager:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">my_input</span> <span class="o">=</span> <span class="n">oxpy</span><span class="o">.</span><span class="n">InputFile</span><span class="p">()</span>
<span class="n">my_input</span><span class="o">.</span><span class="n">init_from_filename</span><span class="p">(</span><span class="s2">&quot;input&quot;</span><span class="p">)</span>
Expand Down
26 changes: 13 additions & 13 deletions oxpy/modules/core/core.html
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -520,7 +520,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -534,7 +534,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -556,7 +556,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -570,7 +570,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -584,7 +584,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -598,7 +598,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -612,7 +612,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -626,7 +626,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand All @@ -640,7 +640,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-odd"><p>The position of the site.</p>
</dd>
<dt class="field-even">Return type<span class="colon">:</span></dt>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-even"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -763,7 +763,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd><p>Set the distance vector used by the <cite>pair_interaction_*</cite> methods when they are called with <cite>compute_r = False</cite> (see <a class="reference internal" href="#oxpy.core.BaseInteraction.pair_interaction" title="oxpy.core.BaseInteraction.pair_interaction"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pair_interaction()</span></code></a> for additional details).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>r</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)"><em>numpy.ndarray</em></a>) – The distance vector to be stored.</p>
<dd class="field-odd"><p><strong>r</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)"><em>numpy.ndarray</em></a>) – The distance vector to be stored.</p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -1005,7 +1005,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-even"><p>The absolute (unwrapped) position of the given particle.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand Down Expand Up @@ -1042,7 +1042,7 @@ <h1>The core module<a class="headerlink" href="#the-core-module" title="Permalin
<dd class="field-even"><p>The distance vector connecting <cite>p</cite> to <cite>q</cite>.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand Down
6 changes: 3 additions & 3 deletions oxpy/modules/core/forces.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ <h1>The core.forces module<a class="headerlink" href="#the-core-forces-module" t
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>step</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><em>int</em></a>) – The current time step.</p></li>
<li><p><strong>pos</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)"><em>numpy.ndarray</em></a>) – The position where the force should be computed.</p></li>
<li><p><strong>pos</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)"><em>numpy.ndarray</em></a>) – The position where the force should be computed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
Expand Down Expand Up @@ -241,14 +241,14 @@ <h1>The core.forces module<a class="headerlink" href="#the-core-forces-module" t
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>step</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><em>int</em></a>) – The current time step.</p></li>
<li><p><strong>pos</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)"><em>numpy.ndarray</em></a>) – The position where the force should be computed.</p></li>
<li><p><strong>pos</strong> (<a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)"><em>numpy.ndarray</em></a>) – The position where the force should be computed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The computed force vector.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v1.26)">numpy.ndarray</a></p>
<dd class="field-odd"><p><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.0)">numpy.ndarray</a></p>
</dd>
</dl>
</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 55ab634

Please sign in to comment.