Skip to content

Commit

Permalink
[skip ci] Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarbalinardo committed May 10, 2024
1 parent ca26eac commit 6b86823
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 15 deletions.
5 changes: 3 additions & 2 deletions _modules/kaldo/conductivity.html
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,10 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<span class="bp">self</span><span class="o">.</span><span class="n">diffusivity_threshold</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'diffusivity_threshold'</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_diffusivity_including_antiresonant</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'is_diffusivity_including_antiresonant'</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">diffusivity_shape</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'diffusivity_shape'</span><span class="p">,</span> <span class="s1">'lorentz'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">include_isotopes</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">phonons</span><span class="o">.</span><span class="n">include_isotopes</span>


<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;diffusivity_bandwidth&gt;/&lt;diffusivity_threshold&gt;/&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;/&lt;method&gt;/&lt;length&gt;/&lt;finite_length_method&gt;'</span><span class="p">)</span>
<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;diffusivity_bandwidth&gt;/&lt;diffusivity_threshold&gt;/&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;/&lt;include_isotopes&gt;/&lt;method&gt;/&lt;length&gt;/&lt;finite_length_method&gt;'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">conductivity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Calculate the thermal conductivity per mode in W/m/K</span>

Expand Down Expand Up @@ -582,7 +583,7 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">'Conductivity calculated'</span><span class="p">)</span>
<span class="k">return</span> <span class="n">cond</span><span class="o">.</span><span class="n">real</span>

<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;diffusivity_bandwidth&gt;/&lt;diffusivity_threshold&gt;/&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;/&lt;method&gt;/&lt;length&gt;/&lt;finite_length_method&gt;'</span><span class="p">)</span>
<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;diffusivity_bandwidth&gt;/&lt;diffusivity_threshold&gt;/&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;/&lt;include_isotopes&gt;/&lt;method&gt;/&lt;length&gt;/&lt;finite_length_method&gt;'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">mean_free_path</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Calculate the mean_free_path per mode in A</span>

Expand Down
2 changes: 1 addition & 1 deletion _modules/kaldo/forceconstants.html
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="sd"> supercell : (int, int, int), optional</span>
<span class="sd"> Number of unit cells in each cartesian direction replicated to form the input structure.</span>
<span class="sd"> Default is (1, 1, 1)</span>
<span class="sd"> format : 'numpy', 'eskm', 'lammps', 'shengbte', 'shengbte-qe', 'hiphive'</span>
<span class="sd"> format : 'numpy', 'eskm', 'lammps', 'shengbte', 'shengbte-qe','shengbte-d3q', 'hiphive'</span>
<span class="sd"> Format of force constant information being loaded into ForceConstants object.</span>
<span class="sd"> Default is 'numpy'</span>
<span class="sd"> third_energy_threshold : float, optional</span>
Expand Down
57 changes: 55 additions & 2 deletions _modules/kaldo/phonons.html
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="kn">from</span> <span class="nn">kaldo.observables.harmonic_with_q</span> <span class="kn">import</span> <span class="n">HarmonicWithQ</span>
<span class="kn">from</span> <span class="nn">kaldo.observables.harmonic_with_q_temp</span> <span class="kn">import</span> <span class="n">HarmonicWithQTemp</span>
<span class="kn">import</span> <span class="nn">kaldo.controllers.anharmonic</span> <span class="k">as</span> <span class="nn">aha</span>
<span class="kn">import</span> <span class="nn">kaldo.controllers.isotopic</span> <span class="k">as</span> <span class="nn">isotopic</span>
<span class="kn">from</span> <span class="nn">scipy</span> <span class="kn">import</span> <span class="n">stats</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">ase.units</span> <span class="k">as</span> <span class="nn">units</span>
Expand Down Expand Up @@ -460,7 +461,7 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="sd"> Units: THz.</span>
<span class="sd"> broadening_shape : string, optional</span>
<span class="sd"> Defines the algorithm to use for the broadening of the conservation</span>
<span class="sd"> of the energy for third irder interactions. Available broadenings</span>
<span class="sd"> of the energy for third order interactions. Available broadenings</span>
<span class="sd"> are `gauss`, `lorentz` and `triangle`.</span>
<span class="sd"> Default is `gauss`.</span>
<span class="sd"> folder : string, optional</span>
Expand All @@ -475,6 +476,14 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="sd"> Default 'C'</span>
<span class="sd"> is_balanced : Enforce detailed balance when calculating anharmonic properties,</span>
<span class="sd"> Default: False</span>
<span class="sd"> g_factor : (n_atoms) array , optional</span>
<span class="sd"> It contains the isotopic g factor for each atom of the unit cell</span>
<span class="sd"> Default: None</span>
<span class="sd"> include_isotopes: bool, optional.</span>
<span class="sd"> Defines if you want to include isotopic scattering bandwidths. Default is False.</span>
<span class="sd"> iso_speed_up: bool, optional.</span>
<span class="sd"> Defines if you want to truncate the energy-conservation delta</span>
<span class="sd"> in the isotopic scattering computation. Default is True.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down Expand Up @@ -512,6 +521,9 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="bp">self</span><span class="o">.</span><span class="n">hbar</span> <span class="o">=</span> <span class="n">units</span><span class="o">.</span><span class="n">_hbar</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_classic</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">hbar</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">hbar</span> <span class="o">*</span> <span class="mf">1e-6</span>
<span class="bp">self</span><span class="o">.</span><span class="n">g_factor</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'g_factor'</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">include_isotopes</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'include_isotopes'</span><span class="p">,</span> <span class="kc">False</span><span class="p">))</span>
<span class="bp">self</span><span class="o">.</span><span class="n">iso_speed_up</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">'iso_speed_up'</span><span class="p">,</span> <span class="kc">True</span><span class="p">))</span>



Expand Down Expand Up @@ -743,10 +755,50 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="k">return</span> <span class="n">population</span>


<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;'</span><span class="p">)</span>
<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;/&lt;include_isotopes&gt;'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">bandwidth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Calculate the phonons bandwidth, the inverse of the lifetime, for each k point in k_points and each mode.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> bandwidth : np.array(n_k_points, n_modes)</span>
<span class="sd"> bandwidth for each k point and each mode</span>
<span class="sd"> """</span>
<span class="n">gamma</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">anharmonic_bandwidth</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">include_isotopes</span><span class="p">:</span>
<span class="n">gamma</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">isotopic_bandwidth</span>
<span class="k">return</span> <span class="n">gamma</span>


<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;third_bandwidth&gt;'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">isotopic_bandwidth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">""" Calculate the isotopic bandwidth with Tamura perturbative formula.</span>
<span class="sd"> Defined by equations in DOI:https://doi.org/10.1103/PhysRevB.27.858</span>
<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> isotopic_bw : np array</span>
<span class="sd"> (n_k_points, n_modes) atomic participation</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_is_amorphous</span><span class="p">:</span>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s1">'isotopic scattering not implemented for amorphous systems'</span><span class="p">)</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">n_k_points</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">n_modes</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">g_factor</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">isotopic_bw</span><span class="o">=</span><span class="n">isotopic</span><span class="o">.</span><span class="n">compute_isotopic_bw</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">atoms</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">atoms</span>
<span class="n">logging</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s1">'input isotopic gfactors are missing, using isotopic concentrations from ase database (NIST)'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">g_factor</span><span class="o">=</span><span class="n">isotopic</span><span class="o">.</span><span class="n">compute_gfactor</span><span class="p">(</span><span class="n">atoms</span><span class="o">.</span><span class="n">get_atomic_numbers</span><span class="p">()</span> <span class="p">)</span>
<span class="n">logging</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s1">'g factors='</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">g_factor</span><span class="p">))</span>
<span class="n">isotopic_bw</span> <span class="o">=</span> <span class="n">isotopic</span><span class="o">.</span><span class="n">compute_isotopic_bw</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="k">return</span> <span class="n">isotopic_bw</span>


<span class="nd">@lazy_property</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s1">'&lt;temperature&gt;/&lt;statistics&gt;/&lt;third_bandwidth&gt;'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">anharmonic_bandwidth</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Calculate the phonons bandwidth, the inverse of the lifetime, for each k point in k_points and each mode.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> bandwidth : np.array(n_k_points, n_modes)</span>
Expand Down Expand Up @@ -812,6 +864,7 @@ <h1 id="modules-kaldo-phonons--page-root">Source code for kaldo.phonons</h1><div
<span class="n">ps_gamma_and_gamma_tensor</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_select_algorithm_for_phase_space_and_gamma</span><span class="p">(</span><span class="n">is_gamma_tensor_enabled</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ps_gamma_and_gamma_tensor</span>


<span class="c1"># Helpers properties</span>

<span class="nd">@property</span>
Expand Down
2 changes: 1 addition & 1 deletion docsource/api_forceconstants.html
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ <h2 id="attributes">Attributes<a class="headerlink" href="#attributes" title="Pe
<li><p><strong>folder</strong> (<em>str</em>) – Chosen folder to load in system information.</p></li>
<li><p><strong>supercell</strong> (<em>(</em><em>int</em><em>, </em><em>int</em><em>, </em><em>int</em><em>)</em><em>, </em><em>optional</em>) – Number of unit cells in each cartesian direction replicated to form the input structure.
Default is (1, 1, 1)</p></li>
<li><p><strong>format</strong> (<em>'numpy'</em><em>, </em><em>'eskm'</em><em>, </em><em>'lammps'</em><em>, </em><em>'shengbte'</em><em>, </em><em>'shengbte-qe'</em><em>, </em><em>'hiphive'</em>) – Format of force constant information being loaded into ForceConstants object.
<li><p><strong>format</strong> (<em>'numpy'</em><em>, </em><em>'eskm'</em><em>, </em><em>'lammps'</em><em>, </em><em>'shengbte'</em><em>, </em><em>'shengbte-qe'</em><em>,</em><em>'shengbte-d3q'</em><em>, </em><em>'hiphive'</em>) – Format of force constant information being loaded into ForceConstants object.
Default is ‘numpy’</p></li>
<li><p><strong>third_energy_threshold</strong> (<em>float</em><em>, </em><em>optional</em>) – <p>When importing sparse third order force constant matrices, energies below
the threshold value in magnitude are ignored. Units: ev/A^3</p>
Expand Down
Loading

0 comments on commit 6b86823

Please sign in to comment.