https://github.com/romerogroup/pyprocar
Raw File
Tip revision: a753094d2008adac2b425b4b0d3c40566e91a108 authored by Uthpala Herath on 08 March 2020, 00:06:00 UTC
Added Abinit Parser class
Tip revision: a753094
unfold.html


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Band unfolding &mdash; PyProcar 3.6 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/language_data.js"></script>
        <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="Concatenating multiple calculations" href="cat.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"> PyProcar
          

          
          </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" />
    <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="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributors.html">Contributors</a></li>
<li class="toctree-l1"><a class="reference internal" href="cite.html">How to cite</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="tutorials.html">Tutorials</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="kpath.html">Generating a k-path</a></li>
<li class="toctree-l2"><a class="reference internal" href="repair.html">Repair</a></li>
<li class="toctree-l2"><a class="reference internal" href="kmesh.html">k-mesh generator</a></li>
<li class="toctree-l2"><a class="reference internal" href="bands.html">Band structure</a></li>
<li class="toctree-l2"><a class="reference internal" href="2Dspin.html">2D spin-texture</a></li>
<li class="toctree-l2"><a class="reference internal" href="3Dspin.html">3D Fermi surface</a></li>
<li class="toctree-l2"><a class="reference internal" href="filter.html">Filtering data</a></li>
<li class="toctree-l2"><a class="reference internal" href="comparebands.html">Compare bands</a></li>
<li class="toctree-l2"><a class="reference internal" href="cat.html">Concatenating multiple calculations</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Band unfolding</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#export-plot-as-a-matplotlib-pyplot-object">Export plot as a matplotlib.pyplot object</a></li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">PyProcar</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="tutorials.html">Tutorials</a> &raquo;</li>
        
      <li>Band unfolding</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/unfold.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="band-unfolding">
<h1>Band unfolding<a class="headerlink" href="#band-unfolding" title="Permalink to this headline">¶</a></h1>
<p>Often times, we need to perform DFT calculations for a supercell geometry rather than the primitive cell. In such cases the band structure becomes quite sophisticated due to the folding of the BZ, and it is difficult to compare the band structure of supercell with that of the primitive cell. The purpose of the band unfolding scheme is to represent the bands within the primitive cell BZ. By calculating the unfolding weight function and plotting the fat bands with the line width proportional to the weight, the unfolded bands can be highlighted.</p>
<p>Note:
The Brillouin zone of a supercell shrinks respect to the primitive cell. For instance, in a hexagonal primitive lattice the point  H=(1/3, 1/3, 1/2). This point, in a 2x2x2 supercell corresponds to (2/3, 2/3, 1). Therefore, all the distances in the reciprocal space must be doubled (or increased by the respective size of the supercell).</p>
<p>Usage:
First, calculate the band structure in the primitive cell BZ. The PROCAR should be produced with the phase factor included, by setting <code class="docutils literal notranslate"><span class="pre">LORBIT=12</span></code> in VASP.</p>
<p>Then the unfold module can be used to plot the unfolded band as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="n">pyprocar</span><span class="o">.</span><span class="n">unfold</span><span class="p">(</span>
        <span class="n">fname</span><span class="o">=</span><span class="s1">&#39;PROCAR&#39;</span><span class="p">,</span>
        <span class="n">poscar</span><span class="o">=</span><span class="s1">&#39;POSCAR&#39;</span><span class="p">,</span>
        <span class="n">outcar</span><span class="o">=</span><span class="s1">&#39;OUTCAR&#39;</span><span class="p">,</span>
        <span class="n">supercell_matrix</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">diag</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">]),</span>
        <span class="n">ispin</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="c1"># None for non-spin polarized calculation. For spin polarized case, ispin=1: up, ispin=2: down</span>
        <span class="n">efermi</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
        <span class="n">shift_efermi</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
        <span class="n">elimit</span><span class="o">=</span><span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">,</span> <span class="mi">15</span><span class="p">),</span>
        <span class="n">kticks</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">36</span><span class="p">,</span> <span class="mi">54</span><span class="p">,</span> <span class="mi">86</span><span class="p">,</span> <span class="mi">110</span><span class="p">,</span> <span class="mi">147</span><span class="p">,</span> <span class="mi">165</span><span class="p">,</span> <span class="mi">199</span><span class="p">],</span>
        <span class="n">knames</span><span class="o">=</span><span class="p">[</span><span class="s1">&#39;$\Gamma$&#39;</span><span class="p">,</span> <span class="s1">&#39;K&#39;</span><span class="p">,</span> <span class="s1">&#39;M&#39;</span><span class="p">,</span> <span class="s1">&#39;$\Gamma$&#39;</span><span class="p">,</span> <span class="s1">&#39;A&#39;</span><span class="p">,</span> <span class="s1">&#39;H&#39;</span><span class="p">,</span> <span class="s1">&#39;L&#39;</span><span class="p">,</span> <span class="s1">&#39;A&#39;</span><span class="p">],</span>
        <span class="n">print_kpts</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
        <span class="n">show_band</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
        <span class="n">width</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span>
        <span class="n">color</span><span class="o">=</span><span class="s1">&#39;blue&#39;</span><span class="p">,</span>
        <span class="n">savetab</span><span class="o">=</span><span class="s1">&#39;unfolding.csv&#39;</span><span class="p">,</span>
        <span class="n">savefig</span><span class="o">=</span><span class="s1">&#39;unfolded_band.png&#39;</span><span class="p">,</span>
        <span class="n">exportplt</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="export-plot-as-a-matplotlib-pyplot-object">
<h2>Export plot as a matplotlib.pyplot object<a class="headerlink" href="#export-plot-as-a-matplotlib-pyplot-object" title="Permalink to this headline">¶</a></h2>
<p>PyProcar allows the plot to be exported as a matplotlib.pyplot object. This allows for further processing of the plot through options available in matplotlib.
This can be enabled by setting <code class="docutils literal notranslate"><span class="pre">exportplt</span> <span class="pre">=</span> <span class="pre">True</span></code>.
Usage:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">pyprocar</span>

<span class="n">plt</span> <span class="o">=</span> <span class="n">pyprocar</span><span class="o">.</span><span class="n">unfold</span><span class="p">(</span><span class="s1">&#39;PROCAR&#39;</span><span class="p">,</span> <span class="n">outcar</span><span class="o">=</span><span class="s1">&#39;OUTCAR&#39;</span><span class="p">,</span> <span class="n">exportplt</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="s1">&#39;Using matplotlib options&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">show</span><span class="p">()</span>
</pre></div>
</div>
<span class="target" id="module-pyprocar.scriptUnfold"></span><dl class="function">
<dt id="pyprocar.scriptUnfold.unfold">
<code class="sig-prename descclassname">pyprocar.scriptUnfold.</code><code class="sig-name descname">unfold</code><span class="sig-paren">(</span><em class="sig-param">fname='PROCAR', poscar='POSCAR', outcar='OUTCAR', supercell_matrix=array([[2, 0, 0],        [0, 2, 0],        [0, 0, 2]]), ispin=None, efermi=None, shift_efermi=True, elimit=(-5, 15), kticks=[0, 36, 54, 86, 110, 147, 165, 199], knames=['$\\Gamma$', 'K', 'M', '$\\Gamma$', 'A', 'H', 'L', 'A'], print_kpts=False, show_band=True, width=4, color='blue', savetab='unfold_result.csv', savefig='unfolded_band.png', exportplt=False</em><span class="sig-paren">)</span><a class="headerlink" href="#pyprocar.scriptUnfold.unfold" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>fname</strong> (<em>PROCAR filename.</em>) – </p></li>
<li><p><strong>poscar</strong> (<em>POSCAR filename</em>) – </p></li>
<li><p><strong>outcar</strong> (<em>OUTCAR filename</em><em>, </em><em>for reading fermi energy. You can also use efermi and set outcar=None</em>) – </p></li>
<li><p><strong>supercell_matrix</strong> (<em>supercell matrix from primitive cell to supercell</em>) – </p></li>
<li><p><strong>ispin</strong> (<em>For non-spin polarized system</em><em>, </em><em>ispin=None.</em>) – For spin polarized system: ispin=1 is spin up, ispin=2 is spin down.</p></li>
<li><p><strong>efermi</strong> (<em>Fermi energy</em>) – </p></li>
<li><p><strong>elimit</strong> (<em>range of energy to be plotted.</em>) – </p></li>
<li><p><strong>kticks</strong> (<em>the indices of K points which has labels given in knames.</em>) – </p></li>
<li><p><strong>knames</strong> (<em>see kticks</em>) – </p></li>
<li><p><strong>print_kpts</strong> (<em>print all the kpoints to screen. This is to help find the kticks and knames.</em>) – </p></li>
<li><p><strong>show_band</strong> (<em>whether to plot the bands before unfolding.</em>) – </p></li>
<li><p><strong>width</strong> (<em>the width of the unfolded band.</em>) – </p></li>
<li><p><strong>color</strong> (<em>color of the unfoled band.</em>) – </p></li>
<li><p><strong>savetab</strong> (<em>the csv file name of which  the table of unfolding result will be written into.</em>) – </p></li>
<li><p><strong>savefig</strong> (<em>the file name of which the figure will be saved.</em>) – </p></li>
<li><p><strong>exportplt</strong> (<em>flag to export plot as matplotlib.pyplot object.</em>) – </p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="cat.html" class="btn btn-neutral float-left" title="Concatenating multiple calculations" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Uthpala Herath

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>
back to top