Skip to content

Commit

Permalink
deploy: 6b2f4af
Browse files Browse the repository at this point in the history
  • Loading branch information
simongravelle committed Aug 28, 2024
1 parent 51a9821 commit cf25153
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
29 changes: 15 additions & 14 deletions _sources/chapters/chapter5.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ Add the same lines at the top of the *MinimizeEnergy.py* file:
Test the code
-------------

One can use the same test as previously, and ask the code to print information
every 10 steps in the dump files, as well as in the log:
One can use a test similar as the previous ones. Let us ask out code to print
information in the dump and the log files, and then let us assert the
files were indeed created without the *Outputs/* folder:

.. label:: start_test_5a_class

Expand All @@ -208,8 +209,8 @@ every 10 steps in the dump files, as well as in the log:
from MinimizeEnergy import MinimizeEnergy
min = MinimizeEnergy(maximum_steps=100,
thermo_period=10,
dumping_period=10,
thermo_period=25,
dumping_period=25,
thermo_outputs = "Epot-MaxF",
number_atoms=[2, 3],
epsilon=[0.1, 1.0], # kcal/mol
Expand All @@ -220,19 +221,19 @@ every 10 steps in the dump files, as well as in the log:
)
min.run()
assert os.path.exists("Outputs/dump.min.lammpstrj")
assert os.path.exists("Outputs/dump.min.lammpstrj"), f"Test failed: dump file was not created"
assert os.path.exists("Outputs/simulation.log"), f"Test failed: log file was not created"
.. label:: end_test_5a_class

When running the simulation, information must be printed in the terminal:
I addition to the files getting created, information must be printed in the terminal
during the similation:

.. code-block:: bw
step Epot (kcal/mol) MaxF (kcal/A/mol)
0, -1.40, 14.19
10, -1.80, 17.98
20, -2.37, 2.65
30, -2.50, 4.00
(...)
and a file named *dump.min.lammpstrj* must have appeared in the *Outputs/* folder.
step Epot MaxF
0 -0.17 1.93
25 -1.08 1.81
50 -1.11 1.42
75 -1.22 3.77
100 -2.10 1.28
28 changes: 15 additions & 13 deletions chapters/chapter5.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,15 @@ <h2>Import the functions<a class="headerlink" href="#import-the-functions" title
</section>
<section id="test-the-code">
<h2>Test the code<a class="headerlink" href="#test-the-code" title="Link to this heading"></a></h2>
<p>One can use the same test as previously, and ask the code to print information
every 10 steps in the dump files, as well as in the log:</p>
<p>One can use a test similar as the previous ones. Let us ask out code to print
information in the dump and the log files, and then let us assert the
files were indeed created without the <em>Outputs/</em> folder:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">from</span> <span class="nn">MinimizeEnergy</span> <span class="kn">import</span> <span class="n">MinimizeEnergy</span>

<span class="nb">min</span> <span class="o">=</span> <span class="n">MinimizeEnergy</span><span class="p">(</span><span class="n">maximum_steps</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span>
<span class="n">thermo_period</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span>
<span class="n">dumping_period</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span>
<span class="n">thermo_period</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span>
<span class="n">dumping_period</span><span class="o">=</span><span class="mi">25</span><span class="p">,</span>
<span class="n">thermo_outputs</span> <span class="o">=</span> <span class="s2">&quot;Epot-MaxF&quot;</span><span class="p">,</span>
<span class="n">number_atoms</span><span class="o">=</span><span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span>
<span class="n">epsilon</span><span class="o">=</span><span class="p">[</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">],</span> <span class="c1"># kcal/mol</span>
Expand All @@ -440,19 +441,20 @@ <h2>Test the code<a class="headerlink" href="#test-the-code" title="Link to this
<span class="p">)</span>
<span class="nb">min</span><span class="o">.</span><span class="n">run</span><span class="p">()</span>

<span class="k">assert</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">&quot;Outputs/dump.min.lammpstrj&quot;</span><span class="p">)</span>
<span class="k">assert</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">&quot;Outputs/dump.min.lammpstrj&quot;</span><span class="p">),</span> <span class="sa">f</span><span class="s2">&quot;Test failed: dump file was not created&quot;</span>
<span class="k">assert</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="s2">&quot;Outputs/simulation.log&quot;</span><span class="p">),</span> <span class="sa">f</span><span class="s2">&quot;Test failed: log file was not created&quot;</span>
</pre></div>
</div>
<p>When running the simulation, information must be printed in the terminal:</p>
<div class="highlight-bw notranslate"><div class="highlight"><pre><span></span>step Epot (kcal/mol) MaxF (kcal/A/mol)
0, -1.40, 14.19
10, -1.80, 17.98
20, -2.37, 2.65
30, -2.50, 4.00
(...)
<p>I addition to the files getting created, information must be printed in the terminal
during the similation:</p>
<div class="highlight-bw notranslate"><div class="highlight"><pre><span></span>step Epot MaxF
0 -0.17 1.93
25 -1.08 1.81
50 -1.11 1.42
75 -1.22 3.77
100 -2.10 1.28
</pre></div>
</div>
<p>and a file named <em>dump.min.lammpstrj</em> must have appeared in the <em>Outputs/</em> folder.</p>
</section>
</section>

Expand Down
Loading

0 comments on commit cf25153

Please sign in to comment.