Skip to content

Commit

Permalink
[skip ci] Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gbarbalinardo committed Dec 4, 2024
1 parent 421ce9e commit 81c248c
Show file tree
Hide file tree
Showing 15 changed files with 402 additions and 88 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions _modules/kaldo/conductivity.html
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<span class="sd"> Conductivity(phonons=phonons, method='inverse', storage='memory').conductivity.sum(axis=0))</span>
<span class="sd"> ```</span>
<span class="sd"> """</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">phonons</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">'phonons'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">method</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">'method'</span><span class="p">,</span> <span class="s1">'rta'</span><span class="p">)</span>
Expand Down Expand Up @@ -584,7 +583,8 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<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>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> Calculate the thermal conductivity per mode in W/m/K</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down Expand Up @@ -622,7 +622,8 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<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>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> Calculate the mean_free_path per mode in A</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down Expand Up @@ -652,7 +653,8 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit

<span class="nd">@property</span>
<span class="k">def</span> <span class="nf">diffusivity</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""Calculate the diffusivity, for each k point in k_points and each mode.</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> Calculate the diffusivity, for each k point in k_points and each mode.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down Expand Up @@ -784,7 +786,8 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<span class="k">return</span> <span class="n">conductivity_per_mode</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">n_phonons</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="o">*</span> <span class="mf">1e22</span><span class="p">,</span> <span class="n">diffusivity</span>

<div class="viewcode-block" id="Conductivity.calculate_mfp_inverse"><a class="viewcode-back" href="../../docsource/api_conductivity.html#kaldo.conductivity.Conductivity.calculate_mfp_inverse">[docs]</a> <span class="k">def</span> <span class="nf">calculate_mfp_inverse</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""This method calculates the inverse of the mean free path for each phonon.</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> This method calculates the inverse of the mean free path for each phonon.</span>
<span class="sd"> The matrix returns k vectors for each mode and has units of inverse Angstroms.</span>

<span class="sd"> Returns</span>
Expand Down Expand Up @@ -879,7 +882,8 @@ <h1 id="modules-kaldo-conductivity--page-root">Source code for kaldo.conductivit
<span class="n">np</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">psi_inv_filename</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_psi_inv</span><span class="p">)</span>

<div class="viewcode-block" id="Conductivity.calculate_conductivity_full"><a class="viewcode-back" href="../../docsource/api_conductivity.html#kaldo.conductivity.Conductivity.calculate_conductivity_full">[docs]</a> <span class="k">def</span> <span class="nf">calculate_conductivity_full</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">is_using_gamma_tensor_evects</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""This calculates the conductivity using the full solution of the space-dependent Boltzmann Transport Equation.</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> This calculates the conductivity using the full solution of the space-dependent Boltzmann Transport Equation.</span>

<span class="sd"> Returns</span>
<span class="sd"> -------</span>
Expand Down
19 changes: 8 additions & 11 deletions _modules/kaldo/forceconstants.html
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>

<span class="sd"> atoms: Tabulated xyz files or ASE Atoms object</span>
<span class="sd"> The atoms to work on.</span>
<span class="sd"> supercell: (3) tuple, optional</span>
Expand All @@ -490,9 +489,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons

<span class="sd"> Attributes</span>
<span class="sd"> ----------</span>

<span class="sd"> """</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span>
<span class="n">atoms</span><span class="p">,</span>
<span class="n">supercell</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span>
Expand Down Expand Up @@ -569,7 +566,6 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="sd"> If true, the acoustic sum rule is applied to the dynamical matrix.</span>
<span class="sd"> Default is False</span>


<span class="sd"> Returns</span>
<span class="sd"> -------</span>
<span class="sd"> ForceConstants object</span>
Expand Down Expand Up @@ -597,14 +593,13 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="n">forceconstants</span><span class="o">.</span><span class="n">distance_threshold</span> <span class="o">=</span> <span class="n">distance_threshold</span>
<span class="k">return</span> <span class="n">forceconstants</span></div>

<span class="k">def</span> <span class="nf">unfold_third_order</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reduced_third</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">distance_threshold</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<div class="viewcode-block" id="ForceConstants.unfold_third_order"><a class="viewcode-back" href="../../docsource/api_forceconstants.html#kaldo.forceconstants.ForceConstants.unfold_third_order">[docs]</a> <span class="k">def</span> <span class="nf">unfold_third_order</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">reduced_third</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">distance_threshold</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> This method extrapolates a third order force constant matrix from a unit</span>
<span class="sd"> cell into a matrix for a larger supercell.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>

<span class="sd"> reduced_third : array, optional</span>
<span class="sd"> The third order force constant matrix.</span>
<span class="sd"> Default is `self.third`</span>
Expand Down Expand Up @@ -661,10 +656,10 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="n">expanded_third</span> <span class="o">=</span> <span class="n">COO</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="n">coords</span><span class="p">)</span><span class="o">.</span><span class="n">T</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="n">values</span><span class="p">),</span> <span class="n">shape</span><span class="p">)</span>
<span class="n">expanded_third</span> <span class="o">=</span> <span class="n">expanded_third</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span>
<span class="p">(</span><span class="n">n_unit_atoms</span> <span class="o">*</span> <span class="mi">3</span><span class="p">,</span> <span class="n">n_replicas</span> <span class="o">*</span> <span class="n">n_unit_atoms</span> <span class="o">*</span> <span class="mi">3</span><span class="p">,</span> <span class="n">n_replicas</span> <span class="o">*</span> <span class="n">n_unit_atoms</span> <span class="o">*</span> <span class="mi">3</span><span class="p">))</span>
<span class="k">return</span> <span class="n">expanded_third</span>
<span class="k">return</span> <span class="n">expanded_third</span></div>


<span class="k">def</span> <span class="nf">elastic_prop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<div class="viewcode-block" id="ForceConstants.elastic_prop"><a class="viewcode-back" href="../../docsource/api_forceconstants.html#kaldo.forceconstants.ForceConstants.elastic_prop">[docs]</a> <span class="k">def</span> <span class="nf">elastic_prop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""</span>
<span class="sd"> Return the stiffness tensor (aka elastic modulus tensor) of the system in GPa. This describes the stress-strain</span>
<span class="sd"> relationship of the material and can sometimes be used as a loose predictor for thermal conductivity. Requires</span>
Expand All @@ -678,6 +673,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="sd"> -------</span>
<span class="sd"> C_ijkl : np.array(3, 3, 3, 3)</span>
<span class="sd"> Elasticity tensor in GPa</span>

<span class="sd"> """</span>
<span class="c1"># Intake key parameters</span>
<span class="n">atoms</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">atoms</span>
Expand Down Expand Up @@ -718,7 +714,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="n">cijkl</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">l</span><span class="p">]</span> <span class="o">=</span> <span class="n">b</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">l</span><span class="p">]</span> <span class="o">+</span> <span class="n">b</span><span class="p">[</span><span class="n">j</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">i</span><span class="p">,</span> <span class="n">l</span><span class="p">]</span> <span class="o">-</span> <span class="n">b</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">l</span><span class="p">]</span> <span class="o">+</span> <span class="n">r</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">l</span><span class="p">]</span>

<span class="c1"># Denote parameter for irreducible Cij in the unit of GPa</span>
<span class="k">return</span> <span class="n">evperang3togpa</span> <span class="o">*</span> <span class="n">cijkl</span> <span class="o">/</span> <span class="n">evtotenjovermol</span>
<span class="k">return</span> <span class="n">evperang3togpa</span> <span class="o">*</span> <span class="n">cijkl</span> <span class="o">/</span> <span class="n">evtotenjovermol</span></div>


<span class="nd">@staticmethod</span>
Expand All @@ -738,7 +734,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">mean_squared_error</span><span class="p">(</span><span class="n">md_forces</span><span class="p">,</span> <span class="n">harmonic_forces</span><span class="p">))</span> <span class="o">/</span> <span class="n">np</span><span class="o">.</span><span class="n">std</span><span class="p">(</span><span class="n">md_forces</span><span class="p">)</span>


<span class="nd">@staticmethod</span>
<div class="viewcode-block" id="ForceConstants.sigma2_tdep_MD"><a class="viewcode-back" href="../../docsource/api_forceconstants.html#kaldo.forceconstants.ForceConstants.sigma2_tdep_MD">[docs]</a> <span class="nd">@staticmethod</span>
<span class="k">def</span> <span class="nf">sigma2_tdep_MD</span><span class="p">(</span><span class="n">fc_file</span><span class="o">=</span><span class="s1">'infile.forceconstant'</span><span class="p">,</span> <span class="n">primitive_file</span><span class="o">=</span><span class="s1">'infile.ucposcar'</span><span class="p">,</span>
<span class="n">supercell_file</span><span class="o">=</span><span class="s1">'infile.ssposcar'</span><span class="p">,</span> <span class="n">md_run</span><span class="o">=</span><span class="s1">'dump.xyz'</span><span class="p">):</span>
<span class="w"> </span><span class="sd">"""</span>
Expand All @@ -759,6 +755,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="sd"> -------</span>
<span class="sd"> float</span>
<span class="sd"> The average sigma2 value.</span>

<span class="sd"> """</span>
<span class="n">initial_structure</span> <span class="o">=</span> <span class="n">read</span><span class="p">(</span><span class="n">supercell_file</span><span class="p">,</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"vasp"</span><span class="p">)</span>
<span class="n">second_order_fc</span> <span class="o">=</span> <span class="n">parse_tdep_forceconstant</span><span class="p">(</span>
Expand All @@ -774,7 +771,7 @@ <h1 id="modules-kaldo-forceconstants--page-root">Source code for kaldo.forcecons
<span class="n">sigma_values</span> <span class="o">=</span> <span class="p">[</span><span class="n">ForceConstants</span><span class="o">.</span><span class="n">_calculate_sigma</span><span class="p">(</span><span class="n">atoms</span><span class="o">.</span><span class="n">get_forces</span><span class="p">(),</span> <span class="n">harm_force</span><span class="p">)</span>
<span class="k">for</span> <span class="n">atoms</span><span class="p">,</span> <span class="n">harm_force</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">full_MD_traj</span><span class="p">,</span> <span class="n">force_harmonic</span><span class="p">)]</span>

<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">sigma_values</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">sigma_values</span><span class="p">)</span></div></div>

</pre></div>

Expand Down
Loading

0 comments on commit 81c248c

Please sign in to comment.