Skip to content

Commit

Permalink
deploy: e7c49b9
Browse files Browse the repository at this point in the history
  • Loading branch information
alchem0x2A committed Nov 28, 2024
1 parent 2e3d2bc commit ddf961c
Show file tree
Hide file tree
Showing 34 changed files with 3,559 additions and 3,334 deletions.
84 changes: 64 additions & 20 deletions _modules/sparc/calculator.html

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions _modules/sparc/io.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ <h1>Source code for sparc.io</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">ase.atoms</span> <span class="kn">import</span> <span class="n">Atoms</span>
<span class="kn">from</span> <span class="nn">ase.calculators.singlepoint</span> <span class="kn">import</span> <span class="n">SinglePointDFTCalculator</span>
<span class="kn">from</span> <span class="nn">ase.config</span> <span class="kn">import</span> <span class="n">cfg</span> <span class="k">as</span> <span class="n">_cfg</span>

<span class="c1"># various io formatters</span>
<span class="kn">from</span> <span class="nn">.api</span> <span class="kn">import</span> <span class="n">SparcAPI</span>
Expand All @@ -103,10 +104,10 @@ <h1>Source code for sparc.io</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">.sparc_parsers.out</span> <span class="kn">import</span> <span class="n">_read_out</span>
<span class="kn">from</span> <span class="nn">.sparc_parsers.pseudopotential</span> <span class="kn">import</span> <span class="n">copy_psp_file</span><span class="p">,</span> <span class="n">parse_psp8_header</span>
<span class="kn">from</span> <span class="nn">.sparc_parsers.static</span> <span class="kn">import</span> <span class="n">_add_cell_info</span><span class="p">,</span> <span class="n">_read_static</span>
<span class="kn">from</span> <span class="nn">.utils</span> <span class="kn">import</span> <span class="n">deprecated</span><span class="p">,</span> <span class="n">locate_api</span><span class="p">,</span> <span class="n">string2index</span>
<span class="kn">from</span> <span class="nn">.utils</span> <span class="kn">import</span> <span class="n">deprecated</span><span class="p">,</span> <span class="n">locate_api</span><span class="p">,</span> <span class="n">sanitize_path</span><span class="p">,</span> <span class="n">string2index</span>

<span class="c1"># from .sparc_parsers.ion import read_ion, write_ion</span>
<span class="n">defaultAPI</span> <span class="o">=</span> <span class="n">locate_api</span><span class="p">()</span>
<span class="n">defaultAPI</span> <span class="o">=</span> <span class="n">locate_api</span><span class="p">(</span><span class="n">cfg</span><span class="o">=</span><span class="n">_cfg</span><span class="p">)</span>


<div class="viewcode-block" id="SparcBundle">
Expand Down Expand Up @@ -169,6 +170,7 @@ <h1>Source code for sparc.io</h1><div class="highlight"><pre>
<span class="n">label</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">psp_dir</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">validator</span><span class="o">=</span><span class="n">defaultAPI</span><span class="p">,</span>
<span class="n">cfg</span><span class="o">=</span><span class="n">_cfg</span><span class="p">,</span>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Initializes a SparcBundle for accessing SPARC calculation data.</span>
Expand Down Expand Up @@ -198,6 +200,7 @@ <h1>Source code for sparc.io</h1><div class="highlight"><pre>
<span class="bp">self</span><span class="o">.</span><span class="n">init_inputs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">psp_data</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">raw_results</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cfg</span> <span class="o">=</span> <span class="n">cfg</span>
<span class="bp">self</span><span class="o">.</span><span class="n">psp_dir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__find_psp_dir</span><span class="p">(</span><span class="n">psp_dir</span><span class="p">)</span>
<span class="c1"># Sorting should be consistent across the whole bundle!</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sorting</span> <span class="o">=</span> <span class="kc">None</span>
Expand Down Expand Up @@ -272,9 +275,14 @@ <h1>Source code for sparc.io</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="n">Path</span><span class="p">(</span><span class="n">psp_dir</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">for</span> <span class="n">var</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">psp_env</span><span class="p">:</span>
<span class="n">env_psp_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">var</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="n">env_psp_dir</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cfg</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">var</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">env_psp_dir</span><span class="p">:</span>
<span class="k">return</span> <span class="n">Path</span><span class="p">(</span><span class="n">env_psp_dir</span><span class="p">)</span>
<span class="c1"># Use pp_path field in cfg</span>
<span class="n">parser</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">cfg</span><span class="o">.</span><span class="n">parser</span><span class="p">[</span><span class="s2">&quot;sparc&quot;</span><span class="p">]</span> <span class="k">if</span> <span class="s2">&quot;sparc&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">cfg</span><span class="o">.</span><span class="n">parser</span> <span class="k">else</span> <span class="p">{}</span>
<span class="n">psp_dir_ini</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;pp_path&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">psp_dir_ini</span><span class="p">:</span>
<span class="k">return</span> <span class="n">sanitize_path</span><span class="p">(</span><span class="n">psp_dir_ini</span><span class="p">)</span>
<span class="c1"># At this point, we try to use the psp files bundled with sparc</span>
<span class="k">if</span> <span class="n">is_psp_download_complete</span><span class="p">(</span><span class="n">default_psp_dir</span><span class="p">):</span>
<span class="k">return</span> <span class="n">default_psp_dir</span>
Expand Down
Loading

0 comments on commit ddf961c

Please sign in to comment.