Skip to content

Feat add windows to vdos - #439

Merged
Atilaac merged 5 commits into
mainfrom
feat-add-hann-window-to-vdos
Oct 6, 2026
Merged

Atilaac merged 5 commits into
mainfrom
feat-add-hann-window-to-vdos

Conversation

@Atilaac

@Atilaac Atilaac commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Adds an optional window to compute_vdos_from_velocities and compute_partial_vdos: "hann", "hamming", "blackmanharris" (4-term) or ("gaussian", std) with std in frames.
All windows are periodic and built with scipy.signal.get_window. The default window=None and "hann" are bit-identical to the earlier implementation.
The window is applied per chunk to the centred velocities in the working precision and never in place on the input.

Addresses review feedback: the ensemble was partly inferred (`pressure=None` is NVT, `langevin=True` is Langevin thermostat) and partly specified (`nve=True`). It is now always explicit, and arguments that only apply to one ensemble carry its name as a prefix.

The changes:

- `md_simulation` / `_run_lammps_md`: required `ensemble` (`"nve"`, `"nvt"`, `"npt"`, `"nvt_langevin"`, `"npt_langevin"`). `pressure` / `pressure_end` to `npt_pressure` / `npt_pressure_end`. The `nve` and `langevin` flags are removed.
- `melt_quench_simulation`, `diffusion_simulation`, `viscosity_simulation`, `viscosity_ensemble`: `langevin: bool` is required `thermostat` (`"nose_hoover"` | `"langevin"`). Each protocol still decides NVT/NPT per stage.
- `elastic_simulation`: required `ensemble` + `npt_pressure`; `"nve"` is rejected.
- `cte_from_fluctuations_simulation`, `temperature_scan_simulation`: `pressure` → `npt_pressure`.
- Arguments that don't fit the chosen ensemble raise a `ValueError` before LAMMPS starts.
- API: the config schema is unchanged. `pipeline.py` turns the elastic config's `pressure=None` into an explicit `ensemble`.
- Docs, docstring examples and tutorials are updated.

Some of these changes are breaking
- The parameters above are renamed or removed, and `ensemble` / `thermostat` are required.
- `md_simulation`'s `temperature_sim` now defaults to `None` (was 5000 K).
Adds an optional window to compute_vdos_from_velocities and compute_partial_vdos: "hann", "hamming", "blackmanharris" (4-term) or ("gaussian", std) with std in frames. All windows are periodic and built with scipy.signal.get_window. The default window=None and "hann" are bit-identical to the earlier implementation. The window is applied per chunk to the centred velocities in the working precision and never in place on the input. Normalisation stays exact without transforming unselected atoms: the Parseval sum is w²-weighted, the odd-N last bin uses the windowed signal, "unit"/"3N" integrate to 1 and 3N, partials still sum to the total, and "none" uses 2Δt/Σw². The docstring gives each window's effective resolution (ENBW 1.5 / 1.36 / 2.0, ≈ N/(2√πσ) for the Gaussian). Tests check the cosine-sum coefficients exactly, leakage, normalisation, partition sums, chunking and that the input is never modified. The window costs about 4% in time and no extra memory. The tutorial's Step 6 compares all windows.
@Atilaac Atilaac added type: feature Changelog: new feature or performance improvement → bumps minor version integration Tag a PR with this to run integration tests labels Oct 5, 2026
@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Atilaac
Atilaac merged commit edf3a06 into main Oct 6, 2026
12 of 15 checks passed
@Atilaac
Atilaac deleted the feat-add-hann-window-to-vdos branch October 6, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration Tag a PR with this to run integration tests type: feature Changelog: new feature or performance improvement → bumps minor version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant