Skip to content

Commit

Permalink
deploy: 1193a85
Browse files Browse the repository at this point in the history
  • Loading branch information
bernstei committed Jan 31, 2024
1 parent d3d83ca commit 82adc2c
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 196 deletions.
54 changes: 22 additions & 32 deletions _sources/examples.daisy_chain_mlip_fitting.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -22,7 +21,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -88,19 +86,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"nbsphinx": "hidden"
},
"metadata": {},
"outputs": [],
"source": [
"# set random seed, so that MD runs, etc are reproducible and we can check for RMSEs. \n",
"# this cell is hidden from tutorials. \n",
"random_seed = 20230301\n",
"np.random.seed(random_seed)"
"rng = np.random.default_rng(20230301)"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -127,7 +120,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -157,7 +149,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -196,15 +187,16 @@
"metadata": {},
"outputs": [],
"source": [
"# regenerate smiles_confgis with a random seed set for testing purposes\n",
"# regenerate smiles_configs with a random seed set for testing purposes\n",
"# this cell is hidden from docs. \n",
"\n",
"outputs = OutputSpec(\"1.ch.rdkit.xyz\", overwrite=True)\n",
"smiles_configs = smiles.smiles(all_smiles, outputs=outputs, randomSeed=random_seed)"
"# set seed for smiles generation to a value from our (reproducible) random number generator\n",
"smiles_configs = smiles.smiles(all_smiles, outputs=outputs, randomSeed=int(rng.integers(np.iinfo(np.int32).max,\n",
" dtype=np.int32)))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -252,7 +244,7 @@
"# add random seet for testing purposes\n",
"# this cell is hidden from tutorials. \n",
"\n",
"md_params[\"autopara_rng_seed\"] = random_seed"
"md_params[\"rng\"] = rng"
]
},
{
Expand All @@ -272,7 +264,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -301,7 +292,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -353,7 +343,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -373,7 +362,7 @@
" inputs=md_soap_global,\n",
" outputs=outputs,\n",
" num=100, # target number of structures to pick\n",
" at_descs_info_key=\"SOAP\")\n",
" at_descs_info_key=\"SOAP\", rng=rng)\n",
" \n",
"\n",
"train_fname = \"6.1.train.xyz\"\n",
Expand Down Expand Up @@ -402,7 +391,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -482,7 +470,9 @@
"# set to None for github testing purposes\n",
"# This cell is hidden from being rendered in the docs. \n",
"# remote_info = None\n",
"gap_params[\"rnd_seed\"] = random_seed "
"\n",
"# set seed for gap fitting to a value from our (reproducible) random number generator\n",
"gap_params[\"rnd_seed\"] = rng.integers(2 ** 31) "
]
},
{
Expand All @@ -501,7 +491,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -528,11 +517,14 @@
" num_cores = 2,\n",
" partitions = \"standard\")\n",
"\n",
"# note - set OMP_NUM_THREADS to prevent GAP evaluation from using OpenMP, \n",
"# as it clashes with multiprocessing.pool, which wfl uses\n",
"remote_info = RemoteInfo(\n",
" sys_name = \"github\",\n",
" job_name = \"gap-eval\",\n",
" resources = resources,\n",
" check_interval = 10, \n",
" env_vars = [\"OMP_NUM_THREADS=1\"],\n",
" input_files = [\"gap.xml*\"])\n",
"\n",
"gap_calc_autopara_info = AutoparaInfo(\n",
Expand All @@ -549,7 +541,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -629,13 +620,13 @@
"\n",
"ref_errors = {\n",
" 'atomization_energy/atom': {\n",
" 'train': {'RMSE': 0.01784008096943666, 'MAE': 0.014956982529185385, 'count': 50}, \n",
" '_ALL_': {'RMSE': 0.01810274269833562, 'MAE': 0.015205129586306461, 'count': 100}, \n",
" 'test': {'RMSE': 0.018361647458989924, 'MAE': 0.015453276643427535, 'count': 50}}, \n",
" 'train': {'RMSE': 0.026086070005729697, 'MAE': 0.02188233965637977, 'count': 50},\n",
" '_ALL_': {'RMSE': 0.02631013293566519, 'MAE': 0.02217457525203221, 'count': 100},\n",
" 'test': {'RMSE': 0.026532303741682858, 'MAE': 0.02246681084768465, 'count': 50}},\n",
" 'forces/comp': {\n",
" 'train': {'RMSE': 0.6064186755127647, 'MAE': 0.440771517768513, 'count': 5037}, \n",
" '_ALL_': {'RMSE': 0.6150461768441347, 'MAE': 0.44579797424459006, 'count': 10074}, \n",
" 'test': {'RMSE': 0.6235543194385854, 'MAE': 0.450824430720667, 'count': 5037}}\n",
" 'train': {'RMSE': 0.6700484048236104, 'MAE': 0.48912067870708253, 'count': 5097},\n",
" '_ALL_': {'RMSE': 0.674843619212047, 'MAE': 0.49305958821652923, 'count': 10188},\n",
" 'test': {'RMSE': 0.6796105918104188, 'MAE': 0.49700313992928696, 'count': 5091}}\n",
"}\n",
"\n",
"print(errors)\n",
Expand All @@ -659,7 +650,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "dev",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -673,9 +664,8 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.9.16"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "793ab331f77558158f2e16fabf356357fde3f61b8f3bb6d95e9b59dbfcb88650"
Expand Down
6 changes: 4 additions & 2 deletions _sources/examples.select_fps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
"metadata": {},
"outputs": [],
"source": [
"import wfl, pathlib\n",
"import numpy as np\n",
"import yaml\n",
"import pathlib\n",
"import wfl\n",
"from wfl.configset import ConfigSet, OutputSpec\n",
"from wfl.descriptors.quippy import calculate as calc_descriptors\n",
"from wfl.select.by_descriptor import greedy_fps_conf_global\n",
Expand All @@ -53,7 +55,7 @@
"# Step 2: Sampling\n",
"fps_out = OutputSpec(files=work_dir/\"out_fps.xyz\")\n",
"nsamples = 8\n",
"selected_configs = greedy_fps_conf_global(inputs=md_desc, outputs=fps_out, num=nsamples, at_descs_info_key='desc', keep_descriptor_info=False)"
"selected_configs = greedy_fps_conf_global(inputs=md_desc, outputs=fps_out, num=nsamples, at_descs_info_key='desc', keep_descriptor_info=False, rng=np.random.default_rng())"
]
},
{
Expand Down
8 changes: 0 additions & 8 deletions _sources/wfl.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ wfl.utils.round\_sig\_figs module
:undoc-members:
:show-inheritance:

wfl.utils.vector\_utils module
------------------------------

.. automodule:: wfl.utils.vector_utils
:members:
:undoc-members:
:show-inheritance:

wfl.utils.version module
------------------------

Expand Down
2 changes: 1 addition & 1 deletion command_line.automatic_docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ <h3>cur<a class="headerlink" href="#wfl-select-cur" title="Permalink to this hea
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-wfl-select-cur-stochastic-seed">
<span class="sig-name descname"><span class="pre">--stochastic-seed</span></span><span class="sig-prename descclassname"> <span class="pre">&lt;stochastic_seed&gt;</span></span><a class="headerlink" href="#cmdoption-wfl-select-cur-stochastic-seed" title="Permalink to this definition">#</a></dt>
<dd><p>seed for <cite>np.random.seed()</cite> in stochastic CUR.</p>
<dd><p>seed for <cite>np.random.default_rng()</cite> in stochastic CUR.</p>
</dd></dl>

<dl class="std option">
Expand Down
20 changes: 17 additions & 3 deletions examples.daisy_chain_mlip_fitting.html
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,15 @@ <h2>Imports<a class="headerlink" href="#Imports" title="Permalink to this headin
</pre></div>
</div>
</div>
<div class="nbinput nblast docutils container">
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># set random seed, so that MD runs, etc are reproducible and we can check for RMSEs.</span>
<span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">(</span><span class="mi">20230301</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="Reference-calculator">
<h2>Reference calculator<a class="headerlink" href="#Reference-calculator" title="Permalink to this heading">#</a></h2>
Expand Down Expand Up @@ -540,11 +549,13 @@ <h2>Generate initial structures<a class="headerlink" href="#Generate-initial-str
<div class="prompt highlight-none notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># regenerate smiles_confgis with a random seed set for testing purposes</span>
<div class="input_area highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># regenerate smiles_configs with a random seed set for testing purposes</span>
<span class="c1"># this cell is hidden from docs.</span>

<span class="n">outputs</span> <span class="o">=</span> <span class="n">OutputSpec</span><span class="p">(</span><span class="s2">&quot;1.ch.rdkit.xyz&quot;</span><span class="p">,</span> <span class="n">overwrite</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">smiles_configs</span> <span class="o">=</span> <span class="n">smiles</span><span class="o">.</span><span class="n">smiles</span><span class="p">(</span><span class="n">all_smiles</span><span class="p">,</span> <span class="n">outputs</span><span class="o">=</span><span class="n">outputs</span><span class="p">,</span> <span class="n">randomSeed</span><span class="o">=</span><span class="n">random_seed</span><span class="p">)</span>
<span class="c1"># set seed for smiles generation to a value from our (reproducible) random number generator</span>
<span class="n">smiles_configs</span> <span class="o">=</span> <span class="n">smiles</span><span class="o">.</span><span class="n">smiles</span><span class="p">(</span><span class="n">all_smiles</span><span class="p">,</span> <span class="n">outputs</span><span class="o">=</span><span class="n">outputs</span><span class="p">,</span> <span class="n">randomSeed</span><span class="o">=</span><span class="nb">int</span><span class="p">(</span><span class="n">rng</span><span class="o">.</span><span class="n">integers</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">iinfo</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">int32</span><span class="p">)</span><span class="o">.</span><span class="n">max</span><span class="p">,</span>
<span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int32</span><span class="p">)))</span>
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -675,7 +686,7 @@ <h2>Sub-select with CUR<a class="headerlink" href="#Sub-select-with-CUR" title="
<span class="n">inputs</span><span class="o">=</span><span class="n">md_soap_global</span><span class="p">,</span>
<span class="n">outputs</span><span class="o">=</span><span class="n">outputs</span><span class="p">,</span>
<span class="n">num</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="c1"># target number of structures to pick</span>
<span class="n">at_descs_info_key</span><span class="o">=</span><span class="s2">&quot;SOAP&quot;</span><span class="p">)</span>
<span class="n">at_descs_info_key</span><span class="o">=</span><span class="s2">&quot;SOAP&quot;</span><span class="p">,</span> <span class="n">rng</span><span class="o">=</span><span class="n">rng</span><span class="p">)</span>


<span class="n">train_fname</span> <span class="o">=</span> <span class="s2">&quot;6.1.train.xyz&quot;</span>
Expand Down Expand Up @@ -801,11 +812,14 @@ <h2>Evaluate structures with GAP<a class="headerlink" href="#Evaluate-structures
<span class="n">num_cores</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span>
<span class="n">partitions</span> <span class="o">=</span> <span class="s2">&quot;standard&quot;</span><span class="p">)</span>

<span class="c1"># note - set OMP_NUM_THREADS to prevent GAP evaluation from using OpenMP,</span>
<span class="c1"># as it clashes with multiprocessing.pool, which wfl uses</span>
<span class="n">remote_info</span> <span class="o">=</span> <span class="n">RemoteInfo</span><span class="p">(</span>
<span class="n">sys_name</span> <span class="o">=</span> <span class="s2">&quot;github&quot;</span><span class="p">,</span>
<span class="n">job_name</span> <span class="o">=</span> <span class="s2">&quot;gap-eval&quot;</span><span class="p">,</span>
<span class="n">resources</span> <span class="o">=</span> <span class="n">resources</span><span class="p">,</span>
<span class="n">check_interval</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span>
<span class="n">env_vars</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;OMP_NUM_THREADS=1&quot;</span><span class="p">],</span>
<span class="n">input_files</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;gap.xml*&quot;</span><span class="p">])</span>

<span class="n">gap_calc_autopara_info</span> <span class="o">=</span> <span class="n">AutoparaInfo</span><span class="p">(</span>
Expand Down
Loading

0 comments on commit 82adc2c

Please sign in to comment.