Vibrational Density of States (VDOS) Tutorial: the VACF and harmonic routes¶
The vibrational density of states (VDOS) $g(\nu)$ is the distribution of vibrational frequencies of a structure. On
the VACF route it comes from the atomic velocities of a microcanonical (NVE) MD run: the VDOS is the mass-weighted
power spectrum of the velocities, which is the Fourier transform of the velocity autocorrelation function (VACF). The
velocities must be the unperturbed time derivatives of the positions, so the production run has no thermostat.
am.vdos_simulation runs the whole route in one call. Step 11 runs the harmonic route on the same glass:
am.harmonic_vdos_simulation computes the VDOS from the normal modes of the minimised structure.
The formulas, all parameters and all returned keys are on the theory page Vibrational DOS (Theory → Simulation Workflows). This notebook covers:
- Running
vdos_simulationon a 300-atom $\mathrm{SiO_2}$ glass - Checking energy conservation in the NVE blocks
- The total VDOS, with and without a window
- Frequency units
- Partial VDOS by element, oxygen class and $\mathrm{Q}^n$ species
- The VACF
- Comparison with the literature
- Reduced VDOS, boson peak and Debye level
- Harmonic thermodynamics
- The analysis functions on your own NVE trajectory
- The harmonic route: quality checks, comparison with the VACF route, participation ratio
import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
from ase.io import read
import amorphouspy as am
Setup¶
A 300-atom $\mathrm{SiO_2}$ glass and the PMMCS potential. The run lengths are kept short so the notebook runs in a few minutes; production calculations should use the defaults (100 ps of NVT, 200 ps of NVE) and a larger box.
glass = read("data/SiO2_glass_300_atoms.xyz")
potential = am.generate_potential(am.get_structure_dict({"SiO2": 100}, target_atoms=9), potential_type="pmmcs")
n_atoms = len(glass)
print(glass)
Atoms(symbols='O200Si100', pbc=True, cell=[[16.48757572410817, 3.0287185254343006e-15, 3.028718525434301e-15], [-2.019145683487156e-15, 16.487575723, 3.0287185252307334e-15], [-2.0191456834871554e-15, -2.019145683487156e-15, 16.487575723]], id=..., indices=..., initial_charges=..., masses=..., mmcharges=..., momenta=..., type=...)
Step 1: Run vdos_simulation¶
am.vdos_simulation runs three MD stages at the constant volume of the input cell:
- Langevin thermalisation at
temperature_simfor 10,000 steps (10 ps at 1 fs). - NVT equilibration (
thermostat="nose_hoover"or"langevin") forequilibration_stepssteps. - NVE production of
production_ps, run as consecutive blocks ofblock_ps, with velocities and thermo output everydump_everysteps.production_psmust be a whole number of blocks; nothing is truncated.
Each block is a new LAMMPS run that starts from the end of the block before it. LAMMPS also writes the frame of step 0
of every block, which repeats the end state of the previous stage or block; it is dropped, so the blocks do not
overlap. Every block gives a VDOS without a window, a VDOS with window (Hann by default) and a VACF, in total and for
every atom group. The returned curves are the means over the blocks, with the block standard error in "vdos_sem" and
"vacf_sem".
The atom groups come from am.classify_vibrational_groups on the input structure, before any MD, and stay fixed for
all blocks: by element, by oxygen class (bridging O_BO, non-bridging O_NBO, free O_free, tricluster O_tri) and
by network former and number of bridging oxygens (Si_Q4, ...). Without cutoff and former_types they are derived
from the composition and the first minimum of the RDF.
Here the NVT stage is shortened to 10 ps and the production to 100 ps in 10 blocks of 10 ps. Frames every 5 fs give a
Nyquist frequency of 100 THz, and 10 ps blocks a resolution of 0.1 THz. With the default
tmp_working_directory=None all files are removed; with a directory, each block's dump is deleted once its spectra
are extracted, unless keep_trajectory=True.
The UserWarning printed below comes from the RDF that derives the Si–O cutoff for the groups: the 16.5 Å box is too
small for the default r_max of 10 Å, which is lowered to 8 Å. It does not affect the spectra.
sim = am.vdos_simulation(
glass,
potential,
temperature_sim=300.0,
thermostat="nose_hoover",
equilibration_steps=10_000, # 10 ps of NVT, short for the demo (default 100 ps)
production_ps=100.0, # 10 blocks (default 200 ps)
block_ps=10.0,
dump_every=5,
window="hann", # the default; None computes only the unwindowed VDOS
)
for grouping, labels in sim["groups"].items():
counts = ", ".join(f"{label}: {len(indices)}" for label, indices in labels.items())
print(f"{grouping:>8}: {counts}")
print(
f"{sim['n_blocks']} blocks of {sim['n_frames']} frames every {sim['dt_fs']:g} fs, "
f"resolution {sim['resolution_thz']:g} THz, Nyquist {sim['nyquist_thz']:g} THz"
)
/Users/achrafatila/Documents/Workflows/amorphouspy/amorphouspy/src/amorphouspy/properties/vibrational/classification.py:102: UserWarning: r_max=10.0000 Å exceeds half the smallest perpendicular cell height (8.2438 Å). r_max has been automatically adjusted to 8.0 Å (largest integer not exceeding the limit). r, rdfs, _cumcn = compute_rdf(structure, r_max=10.0, n_bins=500)
element: O: 200, Si: 100
oxygen: O_BO: 199, O_NBO: 1
qn: Si_Q3: 2, Si_Q4: 98
10 blocks of 2000 frames every 5 fs, resolution 0.1 THz, Nyquist 100 THz
Step 2: Energy conservation¶
In NVE the total energy must be conserved. sim["nve_drift"] summarises the energy and temperature of all kept
frames. Each block restarts from the previous block's dump, written with 6 significant digits, so the energy can jump
at a block boundary; "boundary_energy_jump_mev_per_atom" measures that restart loss alone. The plot shows the total
energy per atom relative to the first frame, and the temperature, with the block boundaries as dotted lines.
drift = sim["nve_drift"]
print(f"Energy drift over all blocks: {drift['energy_drift_mev_per_atom_ps']:.5f} meV/atom/ps")
print(f"Energy drift within each block: {np.array2string(drift['block_energy_drift_mev_per_atom_ps'], precision=4)}")
print(f"Boundary jumps (meV/atom): {np.array2string(drift['boundary_energy_jump_mev_per_atom'], precision=5)}")
print(f"Max |E - E_0| / N: {drift['max_energy_deviation_mev_per_atom']:.4f} meV/atom")
print(
f"Temperature: mean {drift['temperature_mean_k']:.1f} K, std {drift['temperature_std_k']:.1f} K, "
f"drift {drift['temperature_drift_k_per_ps']:.4f} K/ps"
)
e_tot = np.asarray(sim["energy_tot"])
time_ps = (np.arange(len(e_tot)) + 1) * sim["dt_fs"] * 1e-3 # kept frame k is at (k + 1) * dt_fs
block_edges_ps = np.arange(1, sim["n_blocks"]) * sim["n_frames"] * sim["dt_fs"] * 1e-3
_fig, axes = plt.subplots(1, 2, figsize=(3.5 * 2, 3.5 / 1.3333), dpi=300)
axes[0].plot(time_ps, (e_tot - e_tot[0]) / n_atoms * 1e3, lw=0.5, color="steelblue")
axes[0].set_ylabel(r"$(E_\mathrm{tot} - E_0)/N$ (meV/atom)")
axes[1].plot(time_ps, sim["temperature"], lw=0.5, color="tomato")
axes[1].set_ylabel("Temperature (K)")
for ax in axes:
for edge in block_edges_ps:
ax.axvline(edge, color="0.6", ls=":", lw=0.5)
ax.set_xlabel("NVE time (ps)")
plt.tight_layout()
plt.show()
Energy drift over all blocks: -0.00103 meV/atom/ps Energy drift within each block: [-0.0005 0.0009 -0.0037 -0.0006 -0.0017 -0.0005 0.0007 -0.0023 -0.0032 0.0017] Boundary jumps (meV/atom): [-0.00033 -0.00033 0. 0.00067 0.00033 0.00067 -0.00067 0.00033 -0.00067] Max |E - E_0| / N: 0.1200 meV/atom Temperature: mean 296.0 K, std 9.9 K, drift -0.0041 K/ps
Over the 100 ps the total energy drifts by −0.00103 meV/atom/ps (least squares over all blocks), and within single blocks by −0.0037 to +0.0017 meV/atom/ps; the largest deviation from the first frame is 0.12 meV/atom. The thermo output has 8 significant digits, which resolves $E_\mathrm{tot}/N$ to 3.3e-4 meV/atom here. The 9 boundary jumps are 0, ±1 or ±2 of these units (at most 6.7e-4 meV/atom) and add up to zero, so the 6-digit restart costs nothing measurable at this size and block length. The temperature is 296.0 ± 9.9 K (standard deviation of the frames) with a drift of −0.0041 K/ps. Its mean is not exactly 300 K because NVE keeps the energy of the NVT end state, which fluctuates in a 300-atom box.
Step 3: Total VDOS¶
The VDOS is the mass-weighted velocity power spectrum,
$$g(\nu) \propto \sum_i m_i \sum_{\alpha=x,y,z} \left|\tilde v_{i\alpha}(\nu)\right|^2,$$
with $\tilde v_{i\alpha}(\nu)$ the Fourier transform of a velocity component over one block, computed after removing
the centre-of-mass velocity of the whole system. With normalization="unit" (default) the total integrates to 1
($\mathrm{THz}^{-1}$); "3N" gives $3N$ instead. sim["vdos"]["no_window"] keeps the full 0.1 THz resolution, with
leakage from the finite block length; sim["vdos"]["windowed"] applies the Hann window to each block, which
suppresses the leakage and widens the effective resolution to 0.15 THz. The shaded bands are the block standard
errors.
freq_thz = sim["frequencies_thz"]
vdos_mean = {"No window": sim["vdos"]["no_window"], "Hann": sim["vdos"]["windowed"]}
vdos_sem = {"No window": sim["vdos_sem"]["no_window"], "Hann": sim["vdos_sem"]["windowed"]}
for label, vdos in vdos_mean.items():
print(f"{label:>9}: integral {np.trapezoid(vdos['total'], freq_thz):.6f}")
_fig, axes = plt.subplots(1, 2, figsize=(3.5 * 2.5, 3.5 / 1.3333), dpi=300, width_ratios=[3, 2])
for ax in axes:
for (label, vdos), color in zip(vdos_mean.items(), ["black", "tab:red"], strict=True):
g, err = vdos["total"], vdos_sem[label]["total"]
ax.plot(freq_thz, g, lw=0.6, color=color, label=label)
ax.fill_between(freq_thz, g - err, g + err, color=color, alpha=0.2, lw=0)
ax.set_xlabel("Frequency (THz)")
axes[0].set_xlim(0, 45)
axes[0].set_ylim(bottom=0)
axes[0].set_ylabel(r"$g(\nu)$ (THz$^{-1}$)")
axes[0].legend(frameon=False, fontsize=7)
axes[1].set_xlim(20, 28)
axes[1].set_title("24 THz band", fontsize=9)
secax = axes[0].secondary_xaxis(
"top",
functions=(lambda x: am.convert_frequency(x, "THz", "cm-1"), lambda x: am.convert_frequency(x, "cm-1", "THz")),
)
secax.set_xlabel(r"Wavenumber (cm$^{-1}$)")
plt.tight_layout()
plt.show()
No window: integral 1.000000
Hann: integral 1.000000
Step 4: Frequency units¶
am.convert_frequency(values, from_unit, to_unit) converts scalars or arrays between THz, $\mathrm{cm}^{-1}$, meV
and rad/ps. Below, approximate band positions of the unwindowed total VDOS are reported in each unit. Each position is
the maximum of a 1.1 THz running mean (11 bins) inside a window around a band visible in the plot above; these are
rough positions, not fitted peaks.
g_mean = sim["vdos"]["no_window"]["total"]
g_sem = sim["vdos_sem"]["no_window"]["total"]
window_bins = 11 # 1.1 THz at 0.1 THz resolution
g_smooth = np.convolve(g_mean, np.ones(window_bins) / window_bins, mode="same")
band_windows_thz = {"Si-O-Si bending": (10.0, 21.0), "stretching I": (22.0, 27.0), "stretching II": (27.0, 34.0)}
print(f"{'band':>16} {'THz':>7} {'cm-1':>8} {'meV':>7} {'rad/ps':>8}")
for band, (low, high) in band_windows_thz.items():
in_window = (freq_thz >= low) & (freq_thz <= high)
peak_thz = freq_thz[in_window][np.argmax(g_smooth[in_window])]
in_units = [am.convert_frequency(peak_thz, "THz", unit) for unit in ("cm-1", "meV", "rad/ps")]
print(f"{band:>16} {peak_thz:7.2f} {in_units[0]:8.1f} {in_units[1]:7.2f} {in_units[2]:8.2f}")
band THz cm-1 meV rad/ps
Si-O-Si bending 17.50 583.7 72.37 109.96
stretching I 24.50 817.2 101.32 153.94
stretching II 28.40 947.3 117.45 178.44
Step 5: Partial VDOS¶
A group's partial VDOS is the same power spectrum summed over the atoms of the group only, scaled by the normalisation of the total. Partials over disjoint groups therefore add up: the element partials give the total, the oxygen classes give the O partial, and the $\mathrm{Q}^n$ species of Si give the Si partial. A partial integrates to its group's share of the kinetic energy, close to its share of atoms by equipartition. The plot uses the Hann-windowed means; the number of atoms in each group is given in the legend.
partial = sim["vdos"]["windowed"]
partial_sem = sim["vdos_sem"]["windowed"]
groups = sim["groups"]
print(f"max |sum(element) - total|: {np.abs(sum(partial['element'].values()) - partial['total']).max():.1e}")
print(f"max |sum(oxygen) - O|: {np.abs(sum(partial['oxygen'].values()) - partial['element']['O']).max():.1e}")
print(f"max |sum(qn) - Si|: {np.abs(sum(partial['qn'].values()) - partial['element']['Si']).max():.1e}")
for label, values in partial["element"].items():
share = len(groups["element"][label]) / n_atoms
print(f"{label:>2}: integral {np.trapezoid(values, freq_thz):.4f}, share of atoms {share:.4f}")
_fig, axes = plt.subplots(1, 3, figsize=(3.5 * 3, 3.5 / 1.3333), dpi=300, sharey=True)
axes[0].plot(freq_thz, partial["total"], lw=0.6, color="black", label="Total")
for ax, grouping in zip(axes, ("element", "oxygen", "qn"), strict=True):
for label, values in partial[grouping].items():
err = partial_sem[grouping][label]
(line,) = ax.plot(freq_thz, values, lw=0.6, label=f"{label} ({len(groups[grouping][label])})")
ax.fill_between(freq_thz, values - err, values + err, color=line.get_color(), alpha=0.2, lw=0)
ax.set_xlim(0, 45)
ax.set_xlabel("Frequency (THz)")
ax.set_title(grouping, fontsize=9)
ax.legend(frameon=False, fontsize=7)
axes[0].set_ylabel(r"$g(\nu)$ (THz$^{-1}$)")
plt.tight_layout()
plt.show()
max |sum(element) - total|: 2.8e-17 max |sum(oxygen) - O|: 1.4e-17 max |sum(qn) - Si|: 6.9e-18 O: integral 0.6677, share of atoms 0.6667 Si: integral 0.3323, share of atoms 0.3333
Step 6: Velocity autocorrelation function¶
The mass-weighted, normalised VACF is
$$C(t) = \frac{\sum_i m_i \langle \mathbf{v}_i(0)\cdot\mathbf{v}_i(t)\rangle}{\sum_i m_i \langle \mathbf{v}_i^2\rangle},$$
averaged over all time origins of a block (lag $t = k\,\Delta t$ averages the $N - k$ available products), for lags up to half the block. It is never windowed. The total has $C(0) = 1$, and a partial's $C(0)$ is its group's share of the kinetic energy, which equipartition puts close to its share of atoms.
lag_ps = sim["lag_ps"]
vacf, vacf_sem = sim["vacf"], sim["vacf_sem"]
c0 = ", ".join(f"{label} {values[0]:.4f}" for label, values in vacf["element"].items())
shares = ", ".join(f"{label} {len(idx) / n_atoms:.4f}" for label, idx in groups["element"].items())
print(f"C(0): total {vacf['total'][0]:.6f}, {c0}; atom shares {shares}")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
curves = {"Total": (vacf["total"], vacf_sem["total"])}
curves.update({label: (values, vacf_sem["element"][label]) for label, values in vacf["element"].items()})
for label, (values, err) in curves.items():
(line,) = ax.plot(lag_ps, values, lw=0.7, label=label)
ax.fill_between(lag_ps, values - err, values + err, color=line.get_color(), alpha=0.2, lw=0)
ax.axhline(0.0, color="0.6", lw=0.5)
ax.set_xlim(0, 0.5)
ax.set_xlabel("Lag (ps)")
ax.set_ylabel(r"$C(t)$")
ax.legend(frameon=False, fontsize=7)
plt.tight_layout()
plt.show()
C(0): total 1.000000, O 0.6669, Si 0.3331; atom shares O 0.6667, Si 0.3333
Step 7: Comparison with the literature¶
Fossati et al. (J. Am. Ceram. Soc. 104, 1331 (2021), doi:10.1111/jace.17549)
compare the VDOS of silica glass from several interatomic potentials with experimental data. The cell below loads
their Pedone and SHIK curves and the two experimental datasets (labelled "ref. 1" and "ref. 2" in their figure; see
the paper for the original sources), digitized from the published figure by pixel colour and stored in
data/Fossati2021_SiO2_VDOS_*.dat. The values are approximate (about ±0.3 in DOS and ±0.5 meV in energy). Both
digitized curves integrate to 1 over energy, the same normalisation as "unit", so the spectra are compared without
rescaling: the unwindowed VDOS in $\mathrm{THz}^{-1}$ is converted to (atom eV)$^{-1}$ with convert_frequency.
PMMCS is the Pedone potential, so this run should reproduce their Pedone curve. Differences can come from the system size (300 atoms here), the quench history of the glass, and the temperature and run length of the NVE production; those settings of the reference calculation are given in the paper, not here.
# Digitized from Fossati et al. (2021); provenance and accuracy are in the header of each file.
lit_energy_ev, lit_pedone, lit_shik = np.loadtxt("data/Fossati2021_SiO2_VDOS_Pedone_SHIK.dat", unpack=True)
lit_ref1 = np.loadtxt("data/Fossati2021_SiO2_VDOS_exp_ref1.dat")
lit_ref2 = np.loadtxt("data/Fossati2021_SiO2_VDOS_exp_ref2.dat")
print(
f"Integral over energy: SHIK {np.trapezoid(lit_shik, lit_energy_ev):.3f}, "
f"Pedone {np.trapezoid(lit_pedone, lit_energy_ev):.3f}"
)
# This work: mean block VDOS in 1/THz -> 1/eV on an energy axis in eV.
ev_per_thz = am.convert_frequency(1.0, "THz", "meV") * 1e-3
energy_ev = am.convert_frequency(freq_thz, "THz", "meV") * 1e-3
g_ev, g_sem_ev = g_mean / ev_per_thz, g_sem / ev_per_thz
print(f"Integral over energy, this work: {np.trapezoid(g_ev, energy_ev):.3f}")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.fill_between(energy_ev, g_ev - g_sem_ev, g_ev + g_sem_ev, color="black", alpha=0.2, lw=0)
ax.plot(energy_ev, g_ev, lw=0.6, color="black", label=f"This work, PMMCS ({n_atoms} atoms)")
ax.plot(lit_energy_ev, lit_pedone, lw=1.0, color="tab:gray", label="Pedone (Fossati et al.)")
ax.plot(lit_energy_ev, lit_shik, lw=1.0, color="tab:brown", label="SHIK (Fossati et al.)")
ax.plot(*lit_ref1.T, "+", color="black", ms=4, label="Exp., ref. 1")
ax.plot(*lit_ref2.T, "s", mfc="none", color="black", ms=3, label="Exp., ref. 2")
ax.set_xlim(0, 0.18)
ax.set_ylim(bottom=0)
ax.set_xlabel("Mode energy (eV)")
ax.set_ylabel("DOS (1/(atom eV))")
ax.legend(frameon=False, fontsize=6)
plt.tight_layout()
plt.show()
# Position of the stretching band maximum near 0.1 eV (this work smoothed over 1.1 THz, as in Step 4).
for label, energy, dos in [
("This work", energy_ev, g_smooth / ev_per_thz),
("Pedone (digitized)", lit_energy_ev, lit_pedone),
]:
in_window = (energy >= 0.09) & (energy <= 0.115)
print(f"{label:>20}: band maximum at {energy[in_window][np.argmax(dos[in_window])] * 1e3:.1f} meV")
Integral over energy: SHIK 1.002, Pedone 1.000 Integral over energy, this work: 1.000
This work: band maximum at 101.3 meV Pedone (digitized): band maximum at 105.0 meV
Both digitized curves integrate to 1 (Pedone 1.000, SHIK 1.002), as does this run. The PMMCS spectrum of this 300-atom glass follows the Pedone curve of Fossati et al. The stretching band near 0.1 eV peaks at 101.3 meV here and at 105.0 meV in the digitized Pedone curve, about 4 meV lower; the cause was not investigated (system size, quench history and the digitization error of ±0.5 meV are candidates).
Step 8: Reduced VDOS, boson peak and Debye level¶
An elastic continuum (the Debye model) has $g_D(\nu) = 3\nu^2/\nu_D^3$ up to the Debye frequency $\nu_D$, so its reduced VDOS $g(\nu)/\nu^2$ is flat at the Debye level $3/\nu_D^3$ (for a VDOS normalised to 1). In a glass the reduced VDOS rises above this level at low frequency; that excess is the boson peak. The Debye frequency follows from the longitudinal and transverse sound velocities and the number density $n$:
$$v_L = \sqrt{\frac{B + 4G/3}{\rho}}, \quad v_T = \sqrt{\frac{G}{\rho}}, \quad \nu_D^3 = \frac{9n}{4\pi\left(1/v_L^3 + 2/v_T^3\right)}.$$
am.compute_debye_level(structure, B, G) takes the bulk and shear moduli in GPa and the density from the structure.
It never fits the VDOS, so without moduli there is no Debye level. The moduli come from two sources here:
am.elastic_simulation on this glass with PMMCS, the model the VDOS comes from, and literature values for fused
silica ($B$ = 36.7 GPa, $G$ = 31.2 GPa) for comparison. The elastic run uses a strain of 0.5 % and only 10 ps per
strained state, far shorter than production settings; the per-direction constants are printed to show the remaining
scatter.
The periodic box limits the longest acoustic wavelength to its largest perpendicular height $L$, so the lowest
frequency it supports is $\nu_\mathrm{min} = v_T / L$. compute_debye_level reports it, and
am.compute_reduced_vdos(freq_thz, vdos, debye=...) marks every frequency below it as unreliable and says whether the
peak lies there. compute_reduced_vdos takes the raw maximum of $g/\nu^2$ between 0.5 and 5 THz (peak_range_thz),
without smoothing, so it is given the Hann-windowed block mean.
The plot also shows the four literature curves of Step 7, converted from (atom eV)$^{-1}$ on an energy axis to $\mathrm{THz}^{-1}$ on a frequency axis and divided by $\nu^2$. The division magnifies the digitization error at low frequency: near 1 THz the ±0.3 (atom eV)$^{-1}$ in DOS gives about ±10 % and the ±0.5 meV in energy about ±25 % in $\nu^2$, and below 0.5 THz the error is comparable to the signal. Their maxima are therefore taken between 0.7 and 5 THz and are approximate. Above $\nu_\mathrm{min}$ the cell also prints the median ratio of this run to each curve.
with warnings.catch_warnings():
# The per-direction constants of a small glass differ by noise; they are printed below instead.
warnings.filterwarnings("ignore", message="System may not be cubic")
elastic = am.elastic_simulation(
structure=sim["structure"],
potential=potential,
temperature_sim=300.0,
equilibration_steps=10_000, # 10 ps
production_steps=10_000, # 10 ps per strained state
strain=0.005,
ensemble="nvt",
)
cij = elastic["Cij"]
moduli = elastic["moduli"]
print("C11, C22, C33 (GPa):", np.round(np.diag(cij)[:3], 1))
print("C44, C55, C66 (GPa):", np.round(np.diag(cij)[3:], 1))
print(f"B = {moduli['B']:.1f} GPa, G = {moduli['G']:.1f} GPa, E = {moduli['E']:.1f} GPa, Poisson {moduli['nu']:.3f}")
C11, C22, C33 (GPa): [88.6 90.1 97.6] C44, C55, C66 (GPa): [32. 36.4 32.7] B = 44.9 GPa, G = 34.4 GPa, E = 82.1 GPa, Poisson 0.195
moduli_gpa = {
"PMMCS (elastic_simulation)": (moduli["B"], moduli["G"]),
"Fused silica (literature)": (36.7, 31.2),
}
debye = {label: am.compute_debye_level(sim["structure"], b, g) for label, (b, g) in moduli_gpa.items()}
any_debye = next(iter(debye.values()))
print(
f"density {any_debye['density_g_cm3']:.3f} g/cm^3, {any_debye['number_density_per_a3']:.5f} atoms/Å^3, "
f"box edges {np.round(sim['structure'].cell.lengths(), 2)} Å"
)
print(
f"{'moduli':>27} {'v_L (m/s)':>10} {'v_T (m/s)':>10} {'nu_D (THz)':>11} {'theta_D (K)':>12} "
f"{'level (THz^-3)':>15} {'nu_min (THz)':>13}"
)
for label, d in debye.items():
print(
f"{label:>27} {d['longitudinal_velocity_m_s']:10.0f} {d['transverse_velocity_m_s']:10.0f} "
f"{d['debye_frequency_thz']:11.2f} {d['debye_temperature_k']:12.0f} {d['debye_level_thz-3']:15.5f} "
f"{d['lowest_box_frequency_thz']:13.2f}"
)
g_hann = sim["vdos"]["windowed"]["total"]
g_hann_sem = sim["vdos_sem"]["windowed"]["total"]
reduced = {label: am.compute_reduced_vdos(freq_thz, g_hann, debye=d) for label, d in debye.items()}
peak = next(iter(reduced.values())) # reduced VDOS and peak do not depend on the moduli
print(
f"\nRaw maximum of g/nu^2 in 0.5-5 THz: {peak['boson_peak_thz']:.2f} THz, "
f"{peak['boson_peak_height']:.5f} THz^-3, on a range edge: {peak['peak_at_range_edge']}"
)
for label, r in reduced.items():
print(
f"{label:>27}: peak / Debye level {r['boson_peak_over_debye']:.2f}, "
f"reliable from {freq_thz[r['reliable']][0]:.1f} THz, peak below the box limit: {r['peak_below_box_limit']}"
)
# Literature curves of Step 7: 1/(atom eV) on an energy axis in eV -> 1/THz on a frequency axis in THz.
lit_curves = {
"Pedone (Fossati et al.)": (lit_energy_ev, lit_pedone),
"SHIK (Fossati et al.)": (lit_energy_ev, lit_shik),
"Exp., ref. 1": lit_ref1.T,
"Exp., ref. 2": lit_ref2.T,
}
nu_min = debye["PMMCS (elastic_simulation)"]["lowest_box_frequency_thz"]
lit_reduced = {}
print(
"\nLiterature g/nu^2: maximum in 0.7-5 THz (the ±0.5 meV energy error is ±35 % in nu^2 at 0.7 THz), and the\n"
f"median ratio this work / literature over {nu_min:.2f}-5 THz (above the PMMCS box limit):"
)
for label, (energy, dos) in lit_curves.items():
nonzero = energy > 0 # the 0 eV row of the Pedone/SHIK file has no g/nu^2
nu = energy[nonzero] / ev_per_thz
red = dos[nonzero] * ev_per_thz / nu**2
lit_reduced[label] = (nu, red)
window = (nu >= 0.7) & (nu <= 5.0)
i = np.argmax(red[window])
above = (nu >= nu_min) & (nu <= 5.0)
ratio = np.median(np.interp(nu[above], freq_thz, peak["reduced_vdos"]) / red[above])
print(
f"{label:>27}: maximum {red[window][i]:.5f} THz^-3 at {nu[window][i]:.2f} THz, "
f"ratio {ratio:.2f} ({above.sum()} points)"
)
positive = freq_thz > 0
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.fill_between(
freq_thz[positive],
(g_hann - g_hann_sem)[positive] / freq_thz[positive] ** 2,
(g_hann + g_hann_sem)[positive] / freq_thz[positive] ** 2,
color="0.8",
lw=0,
label="block standard error",
)
ax.plot(freq_thz, peak["reduced_vdos"], color="black", lw=0.8, label=f"This work, PMMCS ({n_atoms} atoms)")
lit_styles = {
"Pedone (Fossati et al.)": {"lw": 1.0, "color": "tab:gray"},
"SHIK (Fossati et al.)": {"lw": 1.0, "color": "tab:brown"},
"Exp., ref. 1": {"marker": "+", "ls": "none", "color": "black", "ms": 4},
"Exp., ref. 2": {"marker": "s", "ls": "none", "mfc": "none", "color": "black", "ms": 3},
}
for label, (nu, red) in lit_reduced.items():
ax.plot(nu, red, label=label, **lit_styles[label])
for (label, d), color in zip(debye.items(), ["tab:red", "tab:blue"], strict=True):
ax.axhline(d["debye_level_thz-3"], color=color, ls="--", lw=0.8, label=f"Debye level, {label}")
ax.axvspan(0.0, d["lowest_box_frequency_thz"], color=color, alpha=0.08, lw=0)
ax.axvline(peak["boson_peak_thz"], color="0.4", ls=":", lw=0.8, label="maximum in 0.5–5 THz")
ax.set_xlim(0, 8)
curves = [(freq_thz, peak["reduced_vdos"]), *lit_reduced.values()]
ax.set_ylim(0, 1.3 * max(red[(nu >= 0.5) & (nu <= 8.0)].max() for nu, red in curves))
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel(r"$g(\nu)/\nu^2$ (THz$^{-3}$)")
ax.set_title(r"Shaded: below $\nu_\mathrm{min} = v_T / L$ (red: PMMCS, blue: literature moduli)", fontsize=8)
ax.legend(frameon=False, fontsize=6, loc="upper right")
plt.tight_layout()
plt.show()
density 2.226 g/cm^3, 0.06693 atoms/Å^3, box edges [16.49 16.49 16.49] Å
moduli v_L (m/s) v_T (m/s) nu_D (THz) theta_D (K) level (THz^-3) nu_min (THz)
PMMCS (elastic_simulation) 6384 3929 10.92 524 0.00230 2.38
Fused silica (literature) 5931 3744 10.38 498 0.00269 2.27
Raw maximum of g/nu^2 in 0.5-5 THz: 1.40 THz, 0.00891 THz^-3, on a range edge: False
PMMCS (elastic_simulation): peak / Debye level 3.87, reliable from 2.4 THz, peak below the box limit: True
Fused silica (literature): peak / Debye level 3.32, reliable from 2.3 THz, peak below the box limit: True
Literature g/nu^2: maximum in 0.7-5 THz (the ±0.5 meV energy error is ±35 % in nu^2 at 0.7 THz), and the
median ratio this work / literature over 2.38-5 THz (above the PMMCS box limit):
Pedone (Fossati et al.): maximum 0.01077 THz^-3 at 0.73 THz, ratio 1.06 (22 points)
SHIK (Fossati et al.): maximum 0.01474 THz^-3 at 1.09 THz, ratio 0.93 (22 points)
Exp., ref. 1: maximum 0.00157 THz^-3 at 1.45 THz, ratio 3.23 (4 points)
Exp., ref. 2: maximum 0.01367 THz^-3 at 1.21 THz, ratio 0.97 (3 points)
The PMMCS moduli ($B$ = 44.9 GPa, $G$ = 34.4 GPa) are stiffer than those of fused silica ($B$ +22 %, $G$ +10 %), so
their Debye level is lower (0.00230 vs 0.00269 $\mathrm{THz}^{-3}$) and the Debye temperature higher (524 vs 498 K).
The comparison with the VDOS of this model needs the model's own moduli; the literature level is shown only for
scale. These moduli come from one short run: $C_{11}$, $C_{22}$, $C_{33}$ span 89–98 GPa and $C_{44}$, $C_{55}$,
$C_{66}$ span 32–36 GPa, so they are uncertain by several percent, and elastic_simulation does not give bitwise
identical moduli from one execution to the next.
The reduced VDOS of this run is almost zero below 1 THz: the 300-atom box has hardly any modes there. Its maximum
between 0.5 and 5 THz, at 1.40 THz and 3.87 times the PMMCS Debye level, lies below $\nu_\mathrm{min}$ = 2.38 THz
(shaded), so compute_reduced_vdos returns peak_below_box_limit = True. No acoustic mode of this box lies that low,
and the maximum reflects the few low-frequency modes of a small box, not the boson peak of the bulk glass. Above about
4 THz the reduced VDOS falls below the Debye level, which is only the low-frequency limit.
The literature curves show what the small box misses. Above $\nu_\mathrm{min}$ this run follows the Pedone curve of Fossati et al. (the same potential; median ratio 1.06) and the experimental ref. 2 (0.97, three points), and lies 7 % below SHIK. Between 0.7 and 1.5 THz their Pedone curve stays near 0.009–0.011 $\mathrm{THz}^{-3}$, while this run drops to almost zero below 1.1 THz. That flat stretch is why the printed Pedone maximum sits at the 0.73 THz window edge. Ref. 2 has its maximum at 1.21 THz, 5.1 times the literature Debye level, and SHIK peaks close to it (1.09 THz). Ref. 1 lies below the Debye level from 1.5 to 4.4 THz, where this run is 3.2 times higher (median of four points), so it does not resolve this range. Below about 0.4 THz the digitized Pedone and SHIK curves leave the top of the plot, where the digitization error divided by $\nu^2$ dominates.
A boson-peak statement needs $\nu_\mathrm{min}$ well below the peak: for silica about 50,000 atoms (a 9 nm box, $\nu_\mathrm{min} \approx$ 0.4 THz, estimated from $v_T / L$), and the same analysis at two box sizes giving the same peak is the safest evidence.
Step 9: Harmonic thermodynamics¶
Each mode of frequency $\nu$ is treated as a quantum harmonic oscillator. With $x = h\nu / (k_B T)$ it contributes
$$C_V = k_B \frac{x^2 e^x}{(e^x - 1)^2}, \quad S = k_B \left[\frac{x}{e^x - 1} - \ln\left(1 - e^{-x}\right)\right],$$
$$U = \frac{h\nu}{2} + \frac{h\nu}{e^x - 1}, \quad F = \frac{h\nu}{2} + k_B T \ln\left(1 - e^{-x}\right),$$
and a quantity per atom is $Q(T) = 3 \int g(\nu)\, q(\nu, T)\, d\nu$ for a VDOS normalised to 1 (three modes per
atom). am.compute_vibrational_thermodynamics(freq_thz, vdos, temperatures_k, lowest_frequency_thz=...) returns
$C_V$ and $S$ in $k_B$ per atom and $U$, $F$ and the zero-point energy in meV per atom. Only $\nu > 0$ enters the
integrals; "excluded_weight" reports the share of the VDOS left out at $\nu \le 0$.
The VDOS here comes from classical MD at 300 K, while the oscillators are quantum, so these are the harmonic quantities
of the 300 K spectrum. At low temperature they depend on the low-frequency VDOS, which a small box does not contain.
Below $T_\mathrm{min} = h \nu_\mathrm{low} / k_B$ (1 THz corresponds to 48 K) the values are flagged in "reliable",
not removed; $\nu_\mathrm{low}$ is the PMMCS $\nu_\mathrm{min}$ of Step 8. The input is the Hann-windowed block mean.
from scipy.constants import R
nu_low = debye["PMMCS (elastic_simulation)"]["lowest_box_frequency_thz"]
temperatures_k = np.arange(1.0, 1501.0) # 1-1500 K in 1 K steps
thermo = am.compute_vibrational_thermodynamics(freq_thz, g_hann, temperatures_k, lowest_frequency_thz=nu_low)
print(
f"VDOS integral {thermo['vdos_integral']:.6f}, excluded weight at nu <= 0: {thermo['excluded_weight']:.2e}\n"
f"T_min = {thermo['temperature_bound_k']:.1f} K from nu_low = {thermo['lowest_frequency_thz']:.2f} THz "
f"({thermo['lowest_frequency_source']}); {np.count_nonzero(~thermo['reliable'])} of {len(temperatures_k)} "
"temperatures flagged unreliable"
)
quantities = {
"Cv": ("heat_capacity_kb_per_atom", "k_B/atom"),
"S": ("entropy_kb_per_atom", "k_B/atom"),
"U": ("internal_energy_mev_per_atom", "meV/atom"),
"F": ("free_energy_mev_per_atom", "meV/atom"),
}
i298, i300 = (np.flatnonzero(temperatures_k == t)[0] for t in (298.0, 300.0))
print("\nAt 300 K:")
for name, (key, unit) in quantities.items():
print(f"{name:>4} = {thermo[key][i300]:9.4f} {unit}")
print(f" ZPE = {thermo['zero_point_energy_mev_per_atom']:9.4f} meV/atom")
cp_silica_kb = 44.4 / (3 * R) # J/(mol K) per SiO2 -> k_B per atom; approximate literature value
cv_298 = thermo["heat_capacity_kb_per_atom"][i298]
print(
f"\nCv(298 K) = {cv_298:.3f} k_B/atom = {cv_298 * 3 * R:.1f} J/(mol K) per SiO2\n"
f"Fused silica Cp(298 K) ≈ 44.4 J/(mol K) per SiO2 = {cp_silica_kb:.3f} k_B/atom; "
f"ratio this work / fused silica {cv_298 / cp_silica_kb:.3f}"
)
t_min = thermo["temperature_bound_k"]
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.axvspan(0.0, t_min, color="tab:red", alpha=0.08, lw=0, label=rf"$T < T_\mathrm{{min}}$ = {t_min:.0f} K (unreliable)")
ax.plot(
temperatures_k,
thermo["heat_capacity_kb_per_atom"],
color="black",
lw=0.8,
label=f"Harmonic $C_V$, PMMCS VDOS ({n_atoms} atoms)",
)
ax.axhline(3.0, color="0.4", ls="--", lw=0.8, label=r"Classical limit $3 k_B$")
ax.plot(298.0, cp_silica_kb, "s", mfc="none", color="tab:blue", ms=4, label=r"Fused silica $C_p$ (298 K, approx.)")
ax.set_xlim(0, 1500)
ax.set_ylim(0, 3.2)
ax.set_xlabel("Temperature (K)")
ax.set_ylabel(r"$C_V$ ($k_B$/atom)")
ax.legend(frameon=False, fontsize=7, loc="lower right")
plt.tight_layout()
plt.show()
VDOS integral 1.000000, excluded weight at nu <= 0: 4.78e-08 T_min = 114.4 K from nu_low = 2.38 THz (caller); 114 of 1500 temperatures flagged unreliable At 300 K: Cv = 1.8114 k_B/atom S = 1.5478 k_B/atom U = 121.6528 meV/atom F = 81.6388 meV/atom ZPE = 98.6979 meV/atom Cv(298 K) = 1.802 k_B/atom = 45.0 J/(mol K) per SiO2 Fused silica Cp(298 K) ≈ 44.4 J/(mol K) per SiO2 = 1.780 k_B/atom; ratio this work / fused silica 1.012
The VDOS integrates to 1, and the weight left out at $\nu = 0$ is $4.8 \times 10^{-8}$ (the zero-frequency bin of the Hann spectrum after the centre-of-mass removal), so the frequency cut does not matter here. With the PMMCS $\nu_\mathrm{min}$ = 2.38 THz the bound is $T_\mathrm{min}$ = 114 K: the 114 temperatures from 1 to 114 K are returned but flagged, and the curve below the bound is shown for completeness only. The 300-atom box has no modes below $\nu_\mathrm{min}$ (Step 8), and those modes carry most of $C_V$ at low temperature, so the bulk glass most likely has a higher $C_V$ there. $T_\mathrm{min}$ is a necessary condition, not a guarantee: above it the missing low-frequency weight still matters somewhat.
At 298 K the harmonic $C_V$ is 1.802 $k_B$ per atom, 45.0 J/(mol K) per $\mathrm{SiO_2}$, 1.012 times the approximate
$C_p$ of fused silica (44.4 J/(mol K)). $C_V$ tends to the classical $3 k_B$ only far above the Debye temperature. The
VDOS used here has no block standard error propagated into these values: vdos_simulation returns the block mean and
its standard error, not the individual blocks.
Step 10: The analysis functions on your own trajectory¶
vdos_simulation is built from functions that take any velocity array of shape (n_frames, n_atoms, 3), the masses
in amu and the time between frames in fs. To analyse a trajectory of your own, run NVE with
md_simulation(..., ensemble="nve", n_dump=5): it keeps the velocities of the input structure, here the end state of
the last NVE block. The velocities are in Å/fs. The first frame is that of step 0, the input state, so it is dropped to
get 2000 frames and the same 0.1 THz grid as above.
am.compute_vdos_from_velocities(velocities, masses, dt_fs, window=...): the total VDOS (or one group withindices=).am.compute_partial_vdos(velocities, masses, dt_fs, groups, window=...): all groups ofclassify_vibrational_groupsin one pass.am.compute_vacf_from_velocities(velocities, masses, dt_fs)andam.compute_partial_vacf(...): the VACF.
One 10 ps block has no block standard error; the plot compares it with the 10-block mean of Step 3.
nve = am.md_simulation(
structure=sim["structure"], # carries the velocities of the last NVE block
potential=potential,
ensemble="nve",
production_steps=10_000, # one 10 ps block at 1 fs
n_dump=5,
)
velocities = np.asarray(nve["result"]["velocities"])[1:] # drop the step-0 frame; Å/fs
masses = glass.get_masses() # amu
dt_fs = 5 * 1.0 # n_dump * timestep
print("velocities shape:", velocities.shape)
freq_own, g_own = am.compute_vdos_from_velocities(velocities, masses, dt_fs, window="hann")
_, partial_own = am.compute_partial_vdos(velocities, masses, dt_fs, groups, window="hann")
lag_own, vacf_own = am.compute_vacf_from_velocities(velocities, masses, dt_fs)
print(f"Same frequency grid as vdos_simulation: {np.array_equal(freq_own, freq_thz)}")
print(f"Integral {np.trapezoid(g_own, freq_own):.6f}, C(0) {vacf_own[0]:.6f}, last lag {lag_own[-1]:g} ps")
print(f"max |Si + O - total|: {np.abs(sum(partial_own['element'].values()) - g_own).max():.1e}")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.plot(freq_own, g_own, lw=0.6, color="tab:green", label="One 10 ps block (Hann)")
ax.plot(freq_thz, g_hann, lw=0.8, color="black", label=f"vdos_simulation, mean of {sim['n_blocks']} blocks (Hann)")
ax.set_xlim(0, 45)
ax.set_ylim(bottom=0)
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel(r"$g(\nu)$ (THz$^{-1}$)")
ax.legend(frameon=False, fontsize=7)
plt.tight_layout()
plt.show()
velocities shape: (2000, 300, 3) Same frequency grid as vdos_simulation: True Integral 1.000000, C(0) 1.000000, last lag 5 ps max |Si + O - total|: 3.5e-17
Step 11: The harmonic route¶
am.harmonic_vdos_simulation computes the VDOS of the same glass from its normal modes instead of from MD:
- FIRE minimisation at the fixed cell of the input, down to a force 2-norm of
force_tolerance(1e-6 eV/Å). - The finite-difference dynamical matrix in LAMMPS, with a step of
displacement(1e-5 Å), on the minimised structure. - The matrix is symmetrised and diagonalised; the three translations are dropped, leaving $3N - 3$ modes.
- The VDOS as a sum of Gaussians of $\sigma$ =
broadening_thz(0.2 THz) on the modes, the partials from the eigenvector weights, the participation ratio of every mode and, withtemperatures_k, the harmonic thermodynamics.
The result describes the 0 K inherent structure and has no statistical noise. The matrix holds $(3N)^2$ numbers, so
the route is limited to max_atoms (10,000 by default). Every result carries quality checks, printed below; the
theory page lists what a good and a bad value of each one look like. The UserWarning is the same RDF warning as in
Step 1.
start = time.perf_counter()
harm = am.harmonic_vdos_simulation(glass, potential, temperatures_k=300.0)
print(f"harmonic_vdos_simulation: {time.perf_counter() - start:.1f} s")
mini, diag, thermo_h = harm["minimization"], harm["diagonalization"], harm["thermodynamics"]
print(
f"Minimisation: {mini['stopping_criterion']!r} after {mini['n_iterations']} FIRE steps, "
f"converged {mini['converged']}"
)
print(
f" force 2-norm {mini['force_norm_ev_per_a']:.2e} eV/Å, "
f"largest per-atom force {mini['max_force_ev_per_a']:.2e} eV/Å"
)
print(f" residual pressure {mini['mean_pressure_gpa']:.3f} GPa")
print(f" largest force on the differentiated structure {harm['dynamical_matrix']['max_force_ev_per_a']:.2e} eV/Å")
print(f"Raw-matrix asymmetry {diag['asymmetry']:.1e}, worst entry at atoms {diag['asymmetry_atoms']}")
translations = ", ".join(f"{nu:.1e}" for nu in diag["translational_frequencies_thz"])
overlaps = ", ".join(f"{value:.3f}" for value in diag["translational_overlap"])
print(f"Dropped translations: {translations} THz, overlaps {overlaps}")
print(f"Imaginary modes {diag['n_imaginary']}, lowest mode {diag['min_frequency_thz']:.3f} THz")
print(f"Modes left out of the VDOS {harm['n_imaginary_excluded']}, VDOS integral {harm['grid_integral']:.6f}")
print(
f"T_min = {thermo_h['temperature_bound_k']:.1f} K; Cv(300 K) = {thermo_h['heat_capacity_kb_per_atom'][0]:.4f} "
f"k_B/atom (VACF route, Step 9: {thermo['heat_capacity_kb_per_atom'][i300]:.4f})"
)
harmonic_vdos_simulation: 3.8 s Minimisation: 'force tolerance' after 1114 FIRE steps, converged True force 2-norm 9.93e-07 eV/Å, largest per-atom force 1.69e-07 eV/Å residual pressure -0.198 GPa largest force on the differentiated structure 1.69e-07 eV/Å Raw-matrix asymmetry 1.6e-10, worst entry at atoms (188, 188) Dropped translations: -1.6e-05, -7.0e-06, 1.6e-05 THz, overlaps 1.000, 1.000, 1.000 Imaginary modes 0, lowest mode 1.418 THz Modes left out of the VDOS 0, VDOS integral 1.000000 T_min = 68.1 K; Cv(300 K) = 1.8046 k_B/atom (VACF route, Step 9: 1.8114)
/Users/achrafatila/Documents/Workflows/amorphouspy/amorphouspy/src/amorphouspy/properties/vibrational/classification.py:102: UserWarning: r_max=10.0000 Å exceeds half the smallest perpendicular cell height (8.2438 Å). r_max has been automatically adjusted to 8.0 Å (largest integer not exceeding the limit). r, rdfs, _cumcn = compute_rdf(structure, r_max=10.0, n_bins=500)
The minimisation converged and every check is clean: no imaginary mode, the dropped modes are pure translations, and the raw matrix is symmetric to about $10^{-10}$. The lowest mode, 1.418 THz, is the lowest frequency this box supports and sets $T_\mathrm{min}$.
The plot overlays the harmonic total with the 300 K VACF total of Step 3. The two describe different states: the harmonic VDOS belongs to the 0 K energy minimum, while at 300 K the atoms move in the anharmonic potential around it, which shifts and broadens the bands, and the line shapes differ too (Gaussians of $\sigma$ = 0.2 THz against the Hann resolution of about 0.15 THz). At 10–50 K, where anharmonicity is small, the two routes agree more closely (see "Comparing the two routes" on the theory page).
g_harm = harm["vdos"]["total"]
for label, (x, g) in {"VACF, 300 K": (freq_thz, g_hann), "Harmonic, 0 K": (harm["frequencies_thz"], g_harm)}.items():
print(f"{label:>13}: mean frequency {np.trapezoid(x * g, x):.3f} THz, integral {np.trapezoid(g, x):.6f}")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.plot(freq_thz, g_hann, lw=0.8, color="black", label="VACF route, 300 K (Hann, Step 3)")
ax.plot(harm["frequencies_thz"], g_harm, lw=0.8, color="tab:blue", label=r"Harmonic route, 0 K ($\sigma$ = 0.2 THz)")
ax.set_xlim(0, 45)
ax.set_ylim(bottom=0)
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel(r"$g(\nu)$ (THz$^{-1}$)")
ax.legend(frameon=False, fontsize=7)
plt.tight_layout()
plt.show()
VACF, 300 K: mean frequency 15.910 THz, integral 1.000000 Harmonic, 0 K: mean frequency 15.959 THz, integral 1.000000
The participation ratio $P_k$ measures how many atoms take part in mode $k$, from the displacements of its eigenvector: 1 when all atoms move by the same amount, $1/N$ for a mode on one atom. With 300 atoms a low $P$ does not prove that a mode is localised; that needs the same band compared across box sizes.
nu_modes, ratio = harm["mode_frequencies_thz"], harm["participation_ratio"]
print(f"{nu_modes.size} modes, P from {ratio.min():.4f} to {ratio.max():.3f} (1/N = {1 / n_atoms:.4f})")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.scatter(nu_modes, ratio, s=2, color="black", lw=0)
ax.axhline(1 / n_atoms, color="0.4", ls="--", lw=0.8, label=r"$1/N$")
ax.set_xlim(0, 45)
ax.set_ylim(0, 1)
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel("Participation ratio")
ax.legend(frameon=False, fontsize=7)
plt.tight_layout()
plt.show()
897 modes, P from 0.0097 to 0.639 (1/N = 0.0033)
Step 12: Infrared response¶
A mode absorbs infrared light only if it moves charge. Both workflows compute this with infrared=True, from the
fixed charges of the potential (read by am.charges_from_potential) unless charges is passed.
On the harmonic route the eigenvector of mode $m$ gives its dipole per unit normal coordinate, the mode effective charge $\tilde Z_m$, and the oscillator strength $f_m$:
$$\tilde Z_{m,\alpha} = \sum_i \frac{q_i\, e_{3i+\alpha,m}}{\sqrt{m_i}}, \qquad f_m = \frac{1}{3} \sum_\alpha \tilde Z_{m,\alpha}^2 .$$
The strengths sum to $\sum_i q_i^2 / m_i$ whatever the potential, and the modes add up to the dielectric function
$$\varepsilon(\nu) = \varepsilon_\infty + \frac{e^2}{4\pi^2 \varepsilon_0 V} \sum_m \frac{f_m}{\nu_m^2 - \nu^2 - i\gamma\nu} .$$
eps_inf is the electronic contribution $\varepsilon_\infty$, which fixed charges do not have; 2.1 is the square
of the optical refractive index of silica. The damping $\gamma$ (ir_damping_thz, 0.5 THz by default) joins the
discrete modes of the finite cell into a spectrum.
start = time.perf_counter()
harm_ir = am.harmonic_vdos_simulation(glass, potential, infrared=True, eps_inf=2.1)
print(f"harmonic_vdos_simulation with infrared=True: {time.perf_counter() - start:.1f} s")
ir = harm_ir["infrared"]
charges = ir["charges"]
sum_rule = np.sum(charges**2 / harm_ir["structure"].get_masses())
counts = ", ".join(f"{count} x {value:+.1f} e" for value, count in zip(*np.unique(charges, return_counts=True)))
print(f"Charges: {counts}; sum {charges.sum():.1e} e")
print(f"Sum of strengths {ir['strengths'].sum():.4f} e²/amu, sum rule {sum_rule:.4f} e²/amu")
pairs = ", ".join(f"{pair} {values.sum():.2f}" for pair, values in ir["partial_strengths"]["element"].items())
print(f"Strength by element pair (e²/amu): {pairs}")
print(f"Static dielectric constant: {ir['epsilon_static']:.3f} (eps_inf = {ir['eps_inf']})")
for low, high in ((0, 15), (15, 20), (20, 25), (25, 45)):
band = (harm_ir["mode_frequencies_thz"] >= low) & (harm_ir["mode_frequencies_thz"] < high)
print(f"{low:>2}-{high} THz: {band.sum():>3} modes hold {ir['strengths'][band].sum() / ir['strengths'].sum():.1%}")
_fig, ax = plt.subplots(figsize=(3.5 * 1.5, 3.5 / 1.3333), dpi=300)
ax.vlines(harm_ir["mode_frequencies_thz"], 0, ir["strengths"], lw=0.4, color="black")
ax.set_xlim(0, 45)
ax.set_ylim(bottom=0)
ax.set_xlabel("Frequency (THz)")
ax.set_ylabel(r"$f_m$ ($e^2$/amu)")
plt.tight_layout()
plt.show()
harmonic_vdos_simulation with infrared=True: 3.2 s Charges: 200 x -1.2 e, 100 x +2.4 e; sum 0.0e+00 e Sum of strengths 38.5103 e²/amu, sum rule 38.5103 e²/amu Strength by element pair (e²/amu): O-O 8.41, O-Si 19.17, Si-Si 10.92 Static dielectric constant: 3.225 (eps_inf = 2.1) 0-15 THz: 415 modes hold 4.3% 15-20 THz: 192 modes hold 66.8% 20-25 THz: 145 modes hold 17.1% 25-45 THz: 145 modes hold 11.9%
/Users/achrafatila/Documents/Workflows/amorphouspy/amorphouspy/src/amorphouspy/properties/vibrational/classification.py:102: UserWarning: r_max=10.0000 Å exceeds half the smallest perpendicular cell height (8.2438 Å). r_max has been automatically adjusted to 8.0 Å (largest integer not exceeding the limit). r, rdfs, _cumcn = compute_rdf(structure, r_max=10.0, n_bins=500)
On the MD route the same response comes from the fluctuations of the charge current $J(t) = \sum_i q_i v_i(t)$:
$$\sigma(\nu) = \frac{1}{3 V k_B T} \int_0^\infty \langle J(0) \cdot J(t) \rangle\, e^{i 2\pi\nu t}\, dt, \qquad \varepsilon(\nu) = \varepsilon_\infty + \frac{i\,\sigma(\nu)}{2\pi\nu\,\varepsilon_0},$$
with $k_B T$ taken from the same velocities. am.vdos_simulation(..., infrared=True) does this for every NVE
block and returns the block mean and standard error in sim["infrared"]. Below,
am.compute_dielectric_from_velocities is applied to the single 10 ps trajectory of Step 10, so the curve is
noisier than a block average. am.compute_optical_response turns either dielectric function into the absorption
coefficient, the reflectivity and the loss function.
md_ir = am.compute_dielectric_from_velocities(velocities, masses, charges, dt_fs, glass.cell.volume, eps_inf=2.1)
optics = {
"Harmonic, 0 K": (ir["frequencies_thz"], ir["epsilon"], ir),
"MD, 300 K (one 10 ps block)": (
md_ir["frequencies_thz"],
md_ir["epsilon"],
am.compute_optical_response(md_ir["frequencies_thz"], md_ir["epsilon"]),
),
}
low = {label: eps.real[(x > 1) & (x < 2)].mean() for label, (x, eps, _) in optics.items()}
print("Re eps averaged over 1-2 THz: " + ", ".join(f"{label} {value:.3f}" for label, value in low.items()))
for label, (x, eps, response) in optics.items():
peak = x[np.nanargmax(eps.imag)]
print(
f"{label}: strongest absorption at {peak:.1f} THz ({am.convert_frequency(peak, 'THz', 'cm-1'):.0f} cm⁻¹), "
f"highest reflectivity {np.nanmax(response['reflectivity']):.2f}"
)
_fig, axes = plt.subplots(1, 2, figsize=(3.5 * 2.4, 3.5 / 1.3333), dpi=300)
for (label, (x, eps, response)), color in zip(optics.items(), ("tab:blue", "black"), strict=True):
axes[0].plot(x, eps.imag, lw=0.8, color=color, label=label)
axes[1].plot(x, response["reflectivity"], lw=0.8, color=color, label=label)
axes[0].set_ylabel(r"Im $\varepsilon$")
axes[1].set_ylabel("Reflectivity")
for ax in axes:
ax.set_xlim(0, 45)
ax.set_xlabel("Frequency (THz)")
axes[0].legend(frameon=False, fontsize=7)
plt.tight_layout()
plt.show()
Re eps averaged over 1-2 THz: Harmonic, 0 K 3.242, MD, 300 K (one 10 ps block) 3.306 Harmonic, 0 K: strongest absorption at 18.0 THz (602 cm⁻¹), highest reflectivity 0.37 MD, 300 K (one 10 ps block): strongest absorption at 18.8 THz (627 cm⁻¹), highest reflectivity 0.68
The two routes agree: the same bands, and $\operatorname{Re} \varepsilon$ below them within 2 % (3.24 from the
modes, 3.31 from this block), which with $\varepsilon_\infty = 2.1$ gives a static dielectric constant of 3.2. The single MD block is
noisy; vdos_simulation(..., infrared=True) averages the blocks and reports the standard error.
The strengths obey their sum rule exactly (38.5103 $e^2$/amu), and the O-Si cross term is the largest: silicon and
oxygen carry opposite charges and move against each other. How the total is shared between the bands is where the
fixed charges show their limits. Two thirds of the strength (66.8 %) lies in the band between 15 and 20 THz, and
only 11.9 % above 25 THz, in the Si-O stretching band that dominates the measured infrared spectrum of silica. The
band positions are those of the potential, but the relative intensities are not to be compared with experiment:
the electronic polarisation of the oxygen ions, absent from a rigid-ion model, redistributes the intensity. Born
effective charge tensors from an electronic-structure calculation can be passed as charges of shape
(n_atoms, 3, 3) to both routes. The theory page on the infrared response gives the details.
Quick Reference¶
| Step | Call |
|---|---|
| VDOS workflow | am.vdos_simulation(structure, potential, thermostat="nose_hoover", production_ps=200.0, block_ps=10.0, window="hann") |
| Mean VDOS | sim["frequencies_thz"], sim["vdos"]["no_window" \| "windowed"]["total" \| "element" \| "oxygen" \| "qn"] |
| Block standard error | sim["vdos_sem"], sim["vacf_sem"] (same layout) |
| VACF | sim["lag_ps"], sim["vacf"]["total" \| "element" \| ...] |
| Energy drift | sim["nve_drift"] |
| Atom groups | sim["groups"], or am.classify_vibrational_groups(structure) |
| Units | am.convert_frequency(values, "THz", "cm-1") (also "meV", "rad/ps") |
| Elastic moduli | am.elastic_simulation(structure, potential, ensemble="nvt")["moduli"] (GPa) |
| Debye level | am.compute_debye_level(structure, bulk_modulus_gpa, shear_modulus_gpa) |
| Reduced VDOS | am.compute_reduced_vdos(freq_thz, vdos, debye=debye) |
| Thermodynamics | am.compute_vibrational_thermodynamics(freq_thz, vdos, temperatures_k, lowest_frequency_thz=nu_min) |
| Own NVE trajectory | am.md_simulation(structure, potential, ensemble="nve", n_dump=5)["result"]["velocities"][1:] |
| Total VDOS | am.compute_vdos_from_velocities(velocities, masses, dt_fs, window="hann") |
| Partial VDOS | am.compute_partial_vdos(velocities, masses, dt_fs, groups) |
| VACF | am.compute_vacf_from_velocities(velocities, masses, dt_fs), am.compute_partial_vacf(...) |
| Harmonic workflow | am.harmonic_vdos_simulation(structure, potential, temperatures_k=300.0) |
| Harmonic checks | harm["minimization"], harm["diagonalization"], harm["n_imaginary_excluded"], harm["grid_integral"] |
| Modes | harm["mode_frequencies_thz"], harm["participation_ratio"], harm["mode_weights"] |
| Own dynamical matrix | am.read_dynamical_matrix(path, n_atoms), am.diagonalize_dynamical_matrix(matrix, masses=masses) |
| Harmonic VDOS, participation ratio | am.compute_harmonic_vdos(freqs, eigenvectors, groups=groups), am.compute_participation_ratio(eigenvectors, masses) |
| Infrared response | am.harmonic_vdos_simulation(structure, potential, infrared=True, eps_inf=2.1)["infrared"], am.vdos_simulation(..., infrared=True)["infrared"] |
| Strengths, dielectric function | ir["strengths"], ir["epsilon"], ir["partial_susceptibility"], ir["absorption_cm"], ir["reflectivity"], ir["loss_function"] |
| Own charges, modes or trajectory | am.charges_from_potential(potential, structure), am.compute_ir_oscillator_strengths(eigenvectors, masses, charges), am.compute_dielectric_function(freqs, strengths, volume_a3), am.compute_dielectric_from_velocities(velocities, masses, charges, dt_fs, volume_a3), am.compute_optical_response(freqs, epsilon) |