Feature: Support more options and features in the new script for RT-TDDFT absorption spectrum - #7464
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the RT‑TDDFT absorption-spectrum plotting workflow by expanding the CLI and making the absorption/response calculations more flexible (dipole vs current; epsilon vs sigma), while adding additional plotting/export features and more defensive data handling.
Changes:
- Reworked the CLI to separate
--response_sourceand--spectrum_type, with dynamic defaults for--signal_pathand new plot viewport controls (--ylim_*,--*_range). - Updated response-function/KK processing logic (FFT convention handling, safer complex division strategy, Hilbert padding/tapering) and expanded the set of generated plots and exported datasets.
- Removed the legacy
dipole.pytool in favor of the consolidated script flow.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tools/rt-tddft-tools/plot_absorption.py | Major refactor: new CLI, revised spectrum computation, more robust I/O, expanded plotting and structured exports. |
| tools/rt-tddft-tools/dipole.py | Deleted legacy implementation (functionality now covered by the updated plotting script). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mohanchen
approved these changes
Jun 12, 2026
mohanchen
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, thanks for your contribution.
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.
Great thanks to @ESROAMER for trying out the new script and providing highly practical suggestions!
What's changed?
1. Core Physics & Numerical Rigor Enhancements
np.conj) to the Fourier-transformed arrays.ufuncmasking bugs and prevent accidentalNaN/Infcrashes during response function calculations.2. Robustness, Data Validation & Elastic Padding
--step_end, avoiding partial out-of-bound errors.3. CLI Architecture & Usability Overhaul
--response_source(dipole/current) and--spectrum_type(epsilon/sigma).--signal_pathbased on the chosen--response_source(./OUT.ABACUS/dipole_s1.txtfor dipole and./OUT.ABACUS/current_tot.txtfor current), minimizing user-end verbosity.--ylim_energyand--ylim_wavelength.4. Advanced Plotting & Structured Export
calculate_y_limits) coupled with a low-energy cutoff threshold ({type}_dat_real.txtand{type}_dat_imag.txt).