diff --git a/_posts/2024-12-12-wannier_elf.md b/_posts/2024-12-12-wannier_elf.md index ec78395c..f4869355 100644 --- a/_posts/2024-12-12-wannier_elf.md +++ b/_posts/2024-12-12-wannier_elf.md @@ -188,7 +188,7 @@ In terms of implementation, the electron density and its gradient can be constru {% highlight python linenos %} -# Process the wannier function +"""Process the wannier function""" for i, wf in enumerate(self.wannier_data): self.logger.info( @@ -213,14 +213,14 @@ for i, wf in enumerate(self.wannier_data): # Accumulate density gradient (e/Å⁴) grad_density += 2 * wf[..., np.newaxis] * grad_wf -# Double density for non-spin-polarized system +"""Double density for non-spin-polarized system""" density *= 2.0 {% endhighlight %} --- -### Symmetrization of scalar fields$$ +### Symmetrization of scalar fields **Strong** emphasis needs to be laid on the importance of symmetrization of the charge density and kinetic energy scalar fields derived from wannier functions. Since the wannier functions are not **symmetry-adapted**, but **maximally-localized**, it matters quite a bit. @@ -238,7 +238,7 @@ The following symmetrizations are therefore essential. {% highlight python linenos %} -# Symmetrize fields +"""Symmetrize fields""" density = self.symmetrize_field(density, "density") tau = self.symmetrize_field(tau, "kinetic energy density") @@ -446,7 +446,7 @@ So, {% highlight python linenos %} -# Validate symmetry with spatial analysis +"""Validate symmetry with spatial analysis""" self.validate_symmetry(density, "density") self.validate_symmetry(tau, "kinetic energy density") @@ -587,38 +587,38 @@ Finally, calculating ELF, which is straightforward: {% highlight python linenos %} self.logger.info("Computing ELF...") -# Apply density threshold to avoid numerical issues +"""Apply density threshold to avoid numerical issues""" density_threshold = 1e-6 # e/ų mask = density > density_threshold -# Calculate uniform electron gas kinetic energy density +"""Calculate uniform electron gas kinetic energy density""" -# Following VASP's approach with same prefactors +"""Following VASP's approach with same prefactors""" D_h = np.zeros_like(density) D_h[mask] = density[mask] ** (5.0 / 3.0) -# Calculate Pauli kinetic energy term +"""Calculate Pauli kinetic energy term""" grad_density_norm = np.sum(grad_density**2, axis=-1) tau_w = np.zeros_like(density) tau_w[mask] = grad_density_norm[mask] / (8.0 * density[mask]) -# Calculate D = τ - τ_w +"""Calculate D = τ - τ_w""" D = np.maximum(tau - tau_w, 0.0) -# Initialize ELF array (starting from 0.0, not 0.5) +"""Initialize ELF array (starting from 0.0, not 0.5)""" elf = np.zeros_like(density) -# Compute dimensionless χ = D/D_h +"""Compute dimensionless χ = D/D_h""" chi = np.zeros_like(density) chi[mask] = D[mask] / D_h[mask] -# Compute ELF +"""Compute ELF""" elf[mask] = 1.0 / (1.0 + chi[mask] ** 2) {% endhighlight %} @@ -660,7 +660,9 @@ def write_field_xsf(self, filename: str, field: np.ndarray) -> None: A good example is $$\mathrm{CeO_2}$$ where Cerium is supposed to have +4 and not +3 formal oxidation state. So the $$ELF(r)$$ field value near Cerium across all cross sections should be minimal. +
+
diff --git a/_sass/_base.scss b/_sass/_base.scss index 8762e1d9..d291673c 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -1007,29 +1007,36 @@ figure.highlight { margin: 0 0 1rem; width: 100%; max-width: 100%; - - pre { - white-space: pre; - overflow-x: auto; - overflow-y: hidden; - tab-size: 2; - -moz-tab-size: 2; - display: flex; - } - - code { - flex: 1; - min-width: 100%; - padding: 1rem !important; - } - - // Line number styling - .gutter { - padding: 1rem 0.5rem; - border-right: 1px solid rgba(0,0,0,0.1); - background: rgba(0,0,0,0.04); - color: rgba(0,0,0,0.4); - user-select: none; + border-radius: 6px; + overflow: hidden; + + table { + margin: 0; + border: none; + width: 100%; + + td { + padding: 0; + } + + pre { + margin: 0; + white-space: pre; + } + + .gutter { + width: 50px; + background: rgba(0,0,0,0.04); + border-right: 1px solid rgba(0,0,0,0.1); + color: rgba(0,0,0,0.4); + text-align: right; + padding-right: 10px; + user-select: none; + } + + .code { + padding-left: 10px; + } } } @@ -1039,7 +1046,7 @@ pre { border-radius: 6px; padding: 6px 12px; overflow-x: auto; - + pre, code { background-color: transparent; @@ -1059,9 +1066,8 @@ code { // For code blocks without line numbers .highlight { pre { - white-space: pre; - overflow-x: auto; - word-wrap: normal; + margin: 0; + padding: 10px; } }