Skip to content

Commit

Permalink
deploy: 1120602
Browse files Browse the repository at this point in the history
  • Loading branch information
robinzyb committed Apr 8, 2024
1 parent c6f51f1 commit 4da82c6
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 39 deletions.
7 changes: 6 additions & 1 deletion _api/cp2kdata.block_parser.header_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,13 @@ <h1>cp2kdata.block_parser.header_info module</h1>
<span id="cp2kdata-block-parser-header-info-module"></span><h1>cp2kdata.block_parser.header_info module<a class="headerlink" href="#module-cp2kdata.block_parser.header_info" title="Permalink to this heading">#</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="cp2kdata.block_parser.header_info.Cp2kInfo">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cp2kdata.block_parser.header_info.</span></span><span class="sig-name descname"><span class="pre">Cp2kInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">version</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/block_parser/header_info.html#Cp2kInfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.block_parser.header_info.Cp2kInfo" title="Permalink to this definition">#</a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cp2kdata.block_parser.header_info.</span></span><span class="sig-name descname"><span class="pre">Cp2kInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">version</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">restart</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/block_parser/header_info.html#Cp2kInfo"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.block_parser.header_info.Cp2kInfo" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<dl class="py attribute">
<dt class="sig sig-object py" id="cp2kdata.block_parser.header_info.Cp2kInfo.restart">
<span class="sig-name descname"><span class="pre">restart</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">bool</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#cp2kdata.block_parser.header_info.Cp2kInfo.restart" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="cp2kdata.block_parser.header_info.Cp2kInfo.version">
<span class="sig-name descname"><span class="pre">version</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#cp2kdata.block_parser.header_info.Cp2kInfo.version" title="Permalink to this definition">#</a></dt>
Expand Down
2 changes: 1 addition & 1 deletion _api/cp2kdata.output.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ <h1>cp2kdata.output module</h1>
<span id="cp2kdata-output-module"></span><h1>cp2kdata.output module<a class="headerlink" href="#module-cp2kdata.output" title="Permalink to this heading">#</a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="cp2kdata.output.Cp2kOutput">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cp2kdata.output.</span></span><span class="sig-name descname"><span class="pre">Cp2kOutput</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_file</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">run_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'.'</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/output.html#Cp2kOutput"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.output.Cp2kOutput" title="Permalink to this definition">#</a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">cp2kdata.output.</span></span><span class="sig-name descname"><span class="pre">Cp2kOutput</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">run_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_prefix</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'.'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">restart</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/output.html#Cp2kOutput"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.output.Cp2kOutput" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Class for parsing cp2k output</p>
<dl class="py method">
Expand Down
4 changes: 2 additions & 2 deletions _api/cp2kdata.utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ <h1>cp2kdata.utils module</h1>
<dd></dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="cp2kdata.utils.get_opt_cell_stc">
<span class="sig-prename descclassname"><span class="pre">cp2kdata.utils.</span></span><span class="sig-name descname"><span class="pre">get_opt_cell_stc</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_file</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pos_file</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/utils.html#get_opt_cell_stc"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.utils.get_opt_cell_stc" title="Permalink to this definition">#</a></dt>
<dt class="sig sig-object py" id="cp2kdata.utils.format_logger">
<span class="sig-prename descclassname"><span class="pre">cp2kdata.utils.</span></span><span class="sig-name descname"><span class="pre">format_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">info</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/cp2kdata/utils.html#format_logger"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cp2kdata.utils.format_logger" title="Permalink to this definition">#</a></dt>
<dd></dd></dl>

<dl class="py function">
Expand Down
2 changes: 1 addition & 1 deletion _modules/cp2kdata/block_parser/cells.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h1>Source code for cp2kdata.block_parser.cells</h1><div class="highlight"><pre>
<span class="c1"># notice that the cell of step 0 is excluded from MD| block</span>

<span class="c1"># choose parser according to cp2k_info.version</span>
<span class="k">if</span> <span class="n">cp2k_info</span><span class="o">.</span><span class="n">version</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;2022.2&#39;</span><span class="p">,</span> <span class="s1">&#39;2023.1&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">cp2k_info</span><span class="o">.</span><span class="n">version</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;2022.2&#39;</span><span class="p">,</span> <span class="s1">&#39;2023.1&#39;</span><span class="p">,</span> <span class="s1">&#39;2023.2&#39;</span><span class="p">,</span> <span class="s1">&#39;2024.1&#39;</span><span class="p">]:</span>
<span class="n">ALL_MD_CELL_RE</span> <span class="o">=</span> <span class="n">ALL_MD_CELL_RE_V2023</span>
<span class="k">elif</span> <span class="n">cp2k_info</span><span class="o">.</span><span class="n">version</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;7.1&#39;</span><span class="p">]:</span>
<span class="n">ALL_MD_CELL_RE</span> <span class="o">=</span> <span class="n">ALL_MD_CELL_RE_V7</span>
Expand Down
26 changes: 22 additions & 4 deletions _modules/cp2kdata/block_parser/header_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ <h1>Source code for cp2kdata.block_parser.header_info</h1><div class="highlight"

<div class="viewcode-block" id="Cp2kInfo"><a class="viewcode-back" href="../../../_api/cp2kdata.block_parser.header_info.html#cp2kdata.block_parser.header_info.Cp2kInfo">[docs]</a><span class="nd">@dataclass</span>
<span class="k">class</span> <span class="nc">Cp2kInfo</span><span class="p">:</span>
<span class="n">version</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="kc">None</span></div>
<span class="n">version</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">restart</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">None</span></div>


<span class="n">CP2K_INFO_VERSION_PATTERN</span> <span class="o">=</span> \
Expand All @@ -394,17 +395,34 @@ <h1>Source code for cp2kdata.block_parser.header_info</h1><div class="highlight"
<span class="sd"> CP2K\sversion\s(?P&lt;version&gt;\d{1,4}\.\d)(?:\s\(Development\sVersion\))?$</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="n">CP2K_INFO_RESTART_PATTERN</span> <span class="o">=</span> \
<span class="w"> </span><span class="sa">r</span><span class="sd">&quot;&quot;&quot;(?xm)</span>
<span class="sd"> ^\s\*\s{28}RESTART\sINFORMATION\s{30}\*$</span>
<span class="sd"> &quot;&quot;&quot;</span>

<div class="viewcode-block" id="parse_cp2k_info"><a class="viewcode-back" href="../../../_api/cp2kdata.block_parser.header_info.html#cp2kdata.block_parser.header_info.parse_cp2k_info">[docs]</a><span class="k">def</span> <span class="nf">parse_cp2k_info</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Cp2kInfo</span><span class="p">:</span>

<span class="n">cp2k_info</span> <span class="o">=</span> <span class="n">regrep</span><span class="p">(</span>
<span class="n">filename</span><span class="o">=</span><span class="n">filename</span><span class="p">,</span>
<span class="n">patterns</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;version&quot;</span><span class="p">:</span> <span class="n">CP2K_INFO_VERSION_PATTERN</span><span class="p">},</span>
<span class="n">patterns</span><span class="o">=</span><span class="p">{</span>
<span class="s2">&quot;version&quot;</span><span class="p">:</span> <span class="n">CP2K_INFO_VERSION_PATTERN</span><span class="p">,</span>
<span class="s2">&quot;restart&quot;</span><span class="p">:</span> <span class="n">CP2K_INFO_RESTART_PATTERN</span>
<span class="p">},</span>
<span class="n">terminate_on_match</span><span class="o">=</span><span class="kc">True</span>
<span class="p">)</span>

<span class="k">return</span> <span class="n">Cp2kInfo</span><span class="p">(</span><span class="n">version</span><span class="o">=</span><span class="n">cp2k_info</span><span class="p">[</span><span class="s2">&quot;version&quot;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">])</span></div>

<span class="n">num_match_restart</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">cp2k_info</span><span class="p">[</span><span class="s1">&#39;restart&#39;</span><span class="p">])</span>
<span class="k">if</span> <span class="n">num_match_restart</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;More than one restart information found in </span><span class="si">{</span><span class="n">filename</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">num_match_restart</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">cp2k_restart</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">elif</span> <span class="n">num_match_restart</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">cp2k_restart</span> <span class="o">=</span> <span class="kc">False</span>

<span class="k">return</span> <span class="n">Cp2kInfo</span><span class="p">(</span>
<span class="n">version</span><span class="o">=</span><span class="n">cp2k_info</span><span class="p">[</span><span class="s2">&quot;version&quot;</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">],</span>
<span class="n">restart</span><span class="o">=</span><span class="n">cp2k_restart</span>
<span class="p">)</span></div>

<div class="viewcode-block" id="GlobalInfo"><a class="viewcode-back" href="../../../_api/cp2kdata.block_parser.header_info.html#cp2kdata.block_parser.header_info.GlobalInfo">[docs]</a><span class="nd">@dataclass</span>
<span class="k">class</span> <span class="nc">GlobalInfo</span><span class="p">:</span>
Expand Down
Loading

0 comments on commit 4da82c6

Please sign in to comment.