|
|
|
|
|
|
|
|
<!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 — 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 "Software"), 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 "AS IS", 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">"xyz"</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('--input' , dest = 'infile' , default=None , help = 'Input file name')</span>
|
|
|
<span class="c1"># parser.add_argument('--output' , dest = 'outfile', default=None , help = 'Output file name')</span>
|
|
|
|
|
|
<span class="c1"># parser.add_argument('--kset' , dest = 'kset' , default = 2 , type=int , help = 'k-space resolution of Jij calculation')</span>
|
|
|
<span class="c1"># parser.add_argument('--kdirs' , dest = 'kdirs' , default = 'xyz' , help = 'Definition of k-space dimensionality')</span>
|
|
|
<span class="c1"># parser.add_argument('--ebot' , dest = 'ebot' , default = None , type=float, help = 'Bottom energy of the contour')</span>
|
|
|
<span class="c1"># parser.add_argument('--eset' , dest = 'eset' , default = 42 , type=int , help = 'Number of energy points on the contour')</span>
|
|
|
<span class="c1"># parser.add_argument('--eset-p' , dest = 'esetp' , default = 1000 , type=int , help = 'Parameter tuning the distribution on the contour')</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">"""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"> """</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">"wb"</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">"""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"> """</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">"wb"</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">"""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"> """</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Input file: "</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">"infile"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Output file: "</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">"outfile"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"Number of nodes in the parallel cluster: "</span><span class="p">,</span>
|
|
|
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"parallel_size"</span><span class="p">],</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Cell [Ang]: "</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">"cell"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"DFT axis: "</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">"scf_xcf_orientation"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Quantization axis and perpendicular rotation directions:"</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">"ref_xcf_orientations"</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">"o"</span><span class="p">],</span> <span class="s2">" --» "</span><span class="p">,</span> <span class="n">ref</span><span class="p">[</span><span class="s2">"vw"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Parameters for the contour integral:"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Number of k points: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"kset"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"k point directions: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"kdirs"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Ebot: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"ebot"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Eset: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"eset"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Esetp: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"esetp"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</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">"""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"> """</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Atomic information: "</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"[atom index]Element(orbitals) x [Ang] y [Ang] z [Ang] Sx Sy Sz Q Lx Ly Lz Jx Jy Jz"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</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">"tags"</span><span class="p">],</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">"xyz"</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">"</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">"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Anisotropy [meV]"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Magnetic entity x [Ang] y [Ang] z [Ang]"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</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">"tags"</span><span class="p">],</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">"xyz"</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">"</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">"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Consistency check: "</span><span class="p">,</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">"K_consistency"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Anisotropy diag: "</span><span class="p">,</span> <span class="n">mag_ent</span><span class="p">[</span><span class="s2">"K"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Exchange [meV]"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Magnetic entity1 Magnetic entity2 [i j k] d [Ang]"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</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">"</span><span class="si">{</span><span class="n">pair</span><span class="p">[</span><span class="s1">'tags'</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">'tags'</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">'Ruc'</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">'dist'</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="c1"># print magnetic parameters</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Isotropic: "</span><span class="p">,</span> <span class="n">pair</span><span class="p">[</span><span class="s2">"J_iso"</span><span class="p">],</span> <span class="s2">" # Tr[J] / 3"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"DMI: "</span><span class="p">,</span> <span class="n">pair</span><span class="p">[</span><span class="s2">"D"</span><span class="p">],</span> <span class="s2">" # Dx, Dy, Dz"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"Symmetric-anisotropy: "</span><span class="p">,</span>
|
|
|
<span class="n">pair</span><span class="p">[</span><span class="s2">"J_S"</span><span class="p">],</span>
|
|
|
<span class="s2">" # J_S = J - J_iso * I ––> Jxx, Jyy, Jxy, Jxz, Jyz"</span><span class="p">,</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">""</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"J: # Jxx, Jxy, Jxz, Jyx, Jyy, Jyz, Jzx, Jzy, Jzz"</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">"J"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</span>
|
|
|
<span class="p">)</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</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">"""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"> """</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Runtime information: "</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Total runtime: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'end_time'</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">'start_time'</span><span class="p">]</span><span class="si">}</span><span class="s2"> s"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"----------------------------------------------------------------------------------------------------------------------------------------------------------------"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Initial setup: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'setup_time'</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">'start_time'</span><span class="p">]</span><span class="si">}</span><span class="s2"> s"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"Hamiltonian conversion and XC field extraction: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'H_and_XCF_time'</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">'setup_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"Pair and site datastructure creatrions: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'site_and_pair_dictionaries_time'</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">'H_and_XCF_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"k set cration and distribution: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'k_set_time'</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">'site_and_pair_dictionaries_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"Rotating XC potential: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'reference_rotations_time'</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">'k_set_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"Greens function inversion: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'green_function_inversion_time'</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">'reference_rotations_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="sa">f</span><span class="s2">"Calculate energies and magnetic components: </span><span class="si">{</span><span class="n">times</span><span class="p">[</span><span class="s1">'end_time'</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">'green_function_inversion_time'</span><span class="p">]</span><span class="si">:</span><span class="s2">.3f</span><span class="si">}</span><span class="s2"> s"</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">"""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"> """</span>
|
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Input file: "</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">"infile"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Output file: "</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">"outfile"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"Number of nodes in the parallel cluster: "</span><span class="p">,</span>
|
|
|
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"parallel_size"</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">"parallel_solver_for_Gk"</span><span class="p">]:</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"solver used for Greens function calculation: parallel"</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">"solver used for Greens function calculation: sequential"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Cell [Ang]: "</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">"cell"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"DFT axis: "</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">"scf_xcf_orientation"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Quantization axis and perpendicular rotation directions:"</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">"ref_xcf_orientations"</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">"o"</span><span class="p">],</span> <span class="s2">" --» "</span><span class="p">,</span> <span class="n">ref</span><span class="p">[</span><span class="s2">"vw"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Parameters for the contour integral:"</span><span class="p">)</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Number of k points: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"kset"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"k point directions: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"kdirs"</span><span class="p">])</span>
|
|
|
<span class="k">if</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"automatic_ebot"</span><span class="p">]:</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"Ebot: "</span><span class="p">,</span>
|
|
|
<span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"ebot"</span><span class="p">],</span>
|
|
|
<span class="s2">" WARNING: This was automatically determined!"</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">"Ebot: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"ebot"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Eset: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"eset"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"Esetp: "</span><span class="p">,</span> <span class="n">simulation_parameters</span><span class="p">[</span><span class="s2">"esetp"</span><span class="p">])</span>
|
|
|
<span class="nb">print</span><span class="p">(</span>
|
|
|
<span class="s2">"================================================================================================================================================================"</span>
|
|
|
<span class="p">)</span></div>
|
|
|
|
|
|
</pre></div>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
<footer>
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
<div role="contentinfo">
|
|
|
<p>© 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> |