Feat add windows to vdos - #439
Merged
Merged
Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional window to
compute_vdos_from_velocitiesandcompute_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.