You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

457 lines
46 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>grogupy.io &mdash; grogupy 1.0.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="../../_static/sphinx-design.min.css?v=95c83b7e" />
<script src="../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../_static/documentation_options.js?v=8d563738"></script>
<script src="../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../_static/design-tabs.js?v=f930bc37"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../index.html" class="icon icon-home">
grogupy
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Getting started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../introduction.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cite.html">Citing grogupy</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">User Guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../tutorials/index.html">Tutorials</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Advanced usage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../implementation/modules.html">src</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../implementation/grogupy.html">grogupy package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../implementation/environment.html">Environment variables</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Development</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../dev/index.html">Contributing to grogupy</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Extras</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../changelog/index.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../bibliography.html">Bibliography</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">grogupy</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li>
<li class="breadcrumb-item active">grogupy.io</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>Source code for grogupy.io</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright (c) [2024] []</span>
<span class="c1">#</span>
<span class="c1"># Permission is hereby granted, free of charge, to any person obtaining a copy</span>
<span class="c1"># of this software and associated documentation files (the &quot;Software&quot;), to deal</span>
<span class="c1"># in the Software without restriction, including without limitation the rights</span>
<span class="c1"># to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span>
<span class="c1"># copies of the Software, and to permit persons to whom the Software is</span>
<span class="c1"># furnished to do so, subject to the following conditions:</span>
<span class="c1">#</span>
<span class="c1"># The above copyright notice and this permission notice shall be included in all</span>
<span class="c1"># copies or substantial portions of the Software.</span>
<span class="c1">#</span>
<span class="c1"># THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span>
<span class="c1"># IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span>
<span class="c1"># FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span>
<span class="c1"># AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span>
<span class="c1"># LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span>
<span class="c1"># OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span>
<span class="c1"># SOFTWARE.</span>
<span class="kn">from</span> <span class="nn">argparse</span> <span class="kn">import</span> <span class="n">ArgumentParser</span>
<span class="kn">from</span> <span class="nn">pickle</span> <span class="kn">import</span> <span class="n">dump</span><span class="p">,</span> <span class="n">load</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="n">default_args</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
<span class="n">infile</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">outfile</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">scf_xcf_orientation</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</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">1</span><span class="p">]),</span>
<span class="n">ref_xcf_orientations</span><span class="o">=</span><span class="p">[</span>
<span class="nb">dict</span><span class="p">(</span><span class="n">o</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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">vw</span><span class="o">=</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]),</span> <span class="n">np</span><span class="o">.</span><span class="n">array</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">1</span><span class="p">])]),</span>
<span class="nb">dict</span><span class="p">(</span><span class="n">o</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]),</span> <span class="n">vw</span><span class="o">=</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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">np</span><span class="o">.</span><span class="n">array</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">1</span><span class="p">])]),</span>
<span class="nb">dict</span><span class="p">(</span><span class="n">o</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</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">1</span><span class="p">]),</span> <span class="n">vw</span><span class="o">=</span><span class="p">[</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">])]),</span>
<span class="p">],</span>
<span class="n">kset</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
<span class="n">kdirs</span><span class="o">=</span><span class="s2">&quot;xyz&quot;</span><span class="p">,</span>
<span class="n">ebot</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">eset</span><span class="o">=</span><span class="mi">42</span><span class="p">,</span>
<span class="n">esetp</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span>
<span class="n">parallel_solver_for_Gk</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
<span class="n">padawan_mode</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span>
<span class="c1"># parser = ArgumentParser()</span>
<span class="c1"># parser.add_argument(&#39;--input&#39; , dest = &#39;infile&#39; , default=None , help = &#39;Input file name&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--output&#39; , dest = &#39;outfile&#39;, default=None , help = &#39;Output file name&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--kset&#39; , dest = &#39;kset&#39; , default = 2 , type=int , help = &#39;k-space resolution of Jij calculation&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--kdirs&#39; , dest = &#39;kdirs&#39; , default = &#39;xyz&#39; , help = &#39;Definition of k-space dimensionality&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--ebot&#39; , dest = &#39;ebot&#39; , default = None , type=float, help = &#39;Bottom energy of the contour&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--eset&#39; , dest = &#39;eset&#39; , default = 42 , type=int , help = &#39;Number of energy points on the contour&#39;)</span>
<span class="c1"># parser.add_argument(&#39;--eset-p&#39; , dest = &#39;esetp&#39; , default = 1000 , type=int , help = &#39;Parameter tuning the distribution on the contour&#39;)</span>
<span class="c1"># cmd_line_args = parser.parse_args()</span>
<div class="viewcode-block" id="save_pickle">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.save_pickle">[docs]</a>
<span class="k">def</span> <span class="nf">save_pickle</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Saves the data in the outfile with pickle.</span>
<span class="sd"> Args:</span>
<span class="sd"> outfile : str</span>
<span class="sd"> Path to outfile</span>
<span class="sd"> data : dict</span>
<span class="sd"> Contains the data</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># save dictionary</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">outfile</span><span class="p">,</span> <span class="s2">&quot;wb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">output_file</span><span class="p">:</span>
<span class="n">dump</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">output_file</span><span class="p">)</span></div>
<div class="viewcode-block" id="load_pickle">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.load_pickle">[docs]</a>
<span class="k">def</span> <span class="nf">load_pickle</span><span class="p">(</span><span class="n">infile</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Loads the data from the infile with pickle.</span>
<span class="sd"> Args:</span>
<span class="sd"> infile : str</span>
<span class="sd"> Path to infile</span>
<span class="sd"> Returns:</span>
<span class="sd"> data : dict</span>
<span class="sd"> A dictionary of data</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="c1"># open and read file</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">infile</span><span class="p">,</span> <span class="s2">&quot;wb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">input_file</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">input_file</span><span class="p">)</span>
<span class="k">return</span> <span class="n">data</span></div>
<div class="viewcode-block" id="print_parameters">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.print_parameters">[docs]</a>
<span class="k">def</span> <span class="nf">print_parameters</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;It prints the simulation parameters for the grogu out.</span>
<span class="sd"> Args:</span>
<span class="sd"> simulation_parameters : dict</span>
<span class="sd"> It contains the simulations parameters</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Input file: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;infile&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Output file: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;outfile&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;Number of nodes in the parallel cluster: &quot;</span><span class="p">,</span>
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;parallel_size&quot;</span><span class="p">],</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Cell [Ang]: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;cell&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;DFT axis: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;scf_xcf_orientation&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Quantization axis and perpendicular rotation directions:&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">ref</span> <span class="ow">in</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;ref_xcf_orientations&quot;</span><span class="p">]:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ref</span><span class="p">[</span><span class="s2">&quot;o&quot;</span><span class="p">],</span> <span class="s2">&quot; --» &quot;</span><span class="p">,</span> <span class="n">ref</span><span class="p">[</span><span class="s2">&quot;vw&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Parameters for the contour integral:&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Number of k points: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;kset&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;k point directions: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;kdirs&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Ebot: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;ebot&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Eset: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;eset&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Esetp: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;esetp&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span></div>
<div class="viewcode-block" id="print_atoms_and_pairs">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.print_atoms_and_pairs">[docs]</a>
<span class="k">def</span> <span class="nf">print_atoms_and_pairs</span><span class="p">(</span><span class="n">magnetic_entities</span><span class="p">,</span> <span class="n">pairs</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;It prints the pair and magnetic entity information for the grogu out.</span>
<span class="sd"> Args:</span>
<span class="sd"> magnetic_entities : dict</span>
<span class="sd"> It contains the data on the magnetic entities</span>
<span class="sd"> pairs : dict</span>
<span class="sd"> It contains the data on the pairs</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Atomic information: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;[atom index]Element(orbitals) x [Ang] y [Ang] z [Ang] Sx Sy Sz Q Lx Ly Lz Jx Jy Jz&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="c1"># iterate over magnetic entities</span>
<span class="k">for</span> <span class="n">mag_ent</span> <span class="ow">in</span> <span class="n">magnetic_entities</span><span class="p">:</span>
<span class="c1"># iterate over atoms</span>
<span class="k">for</span> <span class="n">tag</span><span class="p">,</span> <span class="n">xyz</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;tags&quot;</span><span class="p">],</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;xyz&quot;</span><span class="p">]):</span>
<span class="c1"># coordinates and tag</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">tag</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Anisotropy [meV]&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Magnetic entity x [Ang] y [Ang] z [Ang]&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="c1"># iterate over magnetic entities</span>
<span class="k">for</span> <span class="n">mag_ent</span> <span class="ow">in</span> <span class="n">magnetic_entities</span><span class="p">:</span>
<span class="c1"># iterate over atoms</span>
<span class="k">for</span> <span class="n">tag</span><span class="p">,</span> <span class="n">xyz</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;tags&quot;</span><span class="p">],</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;xyz&quot;</span><span class="p">]):</span>
<span class="c1"># coordinates and tag</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">tag</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">xyz</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Consistency check: &quot;</span><span class="p">,</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;K_consistency&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Anisotropy diag: &quot;</span><span class="p">,</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">&quot;K&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Exchange [meV]&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Magnetic entity1 Magnetic entity2 [i j k] d [Ang]&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="c1"># iterate over pairs</span>
<span class="k">for</span> <span class="n">pair</span> <span class="ow">in</span> <span class="n">pairs</span><span class="p">:</span>
<span class="c1"># print pair parameters</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">pair</span><span class="p">[</span><span class="s1">&#39;tags&#39;</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">pair</span><span class="p">[</span><span class="s1">&#39;tags&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="si">}</span><span class="s2"> </span><span class="si">{</span><span class="n">pair</span><span class="p">[</span><span class="s1">&#39;Ruc&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2"> d [Ang] </span><span class="si">{</span><span class="n">pair</span><span class="p">[</span><span class="s1">&#39;dist&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">)</span>
<span class="c1"># print magnetic parameters</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Isotropic: &quot;</span><span class="p">,</span> <span class="n">pair</span><span class="p">[</span><span class="s2">&quot;J_iso&quot;</span><span class="p">],</span> <span class="s2">&quot; # Tr[J] / 3&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;DMI: &quot;</span><span class="p">,</span> <span class="n">pair</span><span class="p">[</span><span class="s2">&quot;D&quot;</span><span class="p">],</span> <span class="s2">&quot; # Dx, Dy, Dz&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;Symmetric-anisotropy: &quot;</span><span class="p">,</span>
<span class="n">pair</span><span class="p">[</span><span class="s2">&quot;J_S&quot;</span><span class="p">],</span>
<span class="s2">&quot; # J_S = J - J_iso * I &gt; Jxx, Jyy, Jxy, Jxz, Jyz&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;J: # Jxx, Jxy, Jxz, Jyx, Jyy, Jyz, Jzx, Jzy, Jzz&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">pair</span><span class="p">[</span><span class="s2">&quot;J&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span></div>
<div class="viewcode-block" id="print_runtime_information">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.print_runtime_information">[docs]</a>
<span class="k">def</span> <span class="nf">print_runtime_information</span><span class="p">(</span><span class="n">times</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;It prints the runtime information for the grogu out.</span>
<span class="sd"> Args:</span>
<span class="sd"> times : dict</span>
<span class="sd"> It contains the runtime data</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Runtime information: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Total runtime: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;end_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;start_time&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2"> s&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;----------------------------------------------------------------------------------------------------------------------------------------------------------------&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Initial setup: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;setup_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;start_time&#39;</span><span class="p">]</span><span class="si">}</span><span class="s2"> s&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Hamiltonian conversion and XC field extraction: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;H_and_XCF_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;setup_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Pair and site datastructure creatrions: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;site_and_pair_dictionaries_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;H_and_XCF_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;k set cration and distribution: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;k_set_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;site_and_pair_dictionaries_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Rotating XC potential: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;reference_rotations_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;k_set_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Greens function inversion: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;green_function_inversion_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;reference_rotations_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Calculate energies and magnetic components: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;end_time&#39;</span><span class="p">]</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">times</span><span class="p">[</span><span class="s1">&#39;green_function_inversion_time&#39;</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s&quot;</span>
<span class="p">)</span></div>
<div class="viewcode-block" id="print_job_description">
<a class="viewcode-back" href="../../implementation/grogupy.io.html#grogupy.io.print_job_description">[docs]</a>
<span class="k">def</span> <span class="nf">print_job_description</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;It prints the parameters and the description of the job.</span>
<span class="sd"> Args:</span>
<span class="sd"> simulation_parameters : dict</span>
<span class="sd"> It contains the simulations parameters</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Input file: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;infile&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Output file: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;outfile&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;Number of nodes in the parallel cluster: &quot;</span><span class="p">,</span>
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;parallel_size&quot;</span><span class="p">],</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;parallel_solver_for_Gk&quot;</span><span class="p">]:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;solver used for Greens function calculation: parallel&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;solver used for Greens function calculation: sequential&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Cell [Ang]: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;cell&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;DFT axis: &quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;scf_xcf_orientation&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Quantization axis and perpendicular rotation directions:&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">ref</span> <span class="ow">in</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;ref_xcf_orientations&quot;</span><span class="p">]:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ref</span><span class="p">[</span><span class="s2">&quot;o&quot;</span><span class="p">],</span> <span class="s2">&quot; --» &quot;</span><span class="p">,</span> <span class="n">ref</span><span class="p">[</span><span class="s2">&quot;vw&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Parameters for the contour integral:&quot;</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Number of k points: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;kset&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;k point directions: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;kdirs&quot;</span><span class="p">])</span>
<span class="k">if</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;automatic_ebot&quot;</span><span class="p">]:</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;Ebot: &quot;</span><span class="p">,</span>
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;ebot&quot;</span><span class="p">],</span>
<span class="s2">&quot; WARNING: This was automatically determined!&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Ebot: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;ebot&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Eset: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;eset&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Esetp: &quot;</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">&quot;esetp&quot;</span><span class="p">])</span>
<span class="nb">print</span><span class="p">(</span>
<span class="s2">&quot;================================================================================================================================================================&quot;</span>
<span class="p">)</span></div>
</pre></div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, grogupy.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>