Skip to content

Feature: Add supersine electric fields and refactor RT-TDDFT field handling - #7767

Open
AsTonyshment wants to merge 8 commits into
deepmodeling:developfrom
AsTonyshment:feat/supersine
Open

Feature: Add supersine electric fields and refactor RT-TDDFT field handling#7767
AsTonyshment wants to merge 8 commits into
deepmodeling:developfrom
AsTonyshment:feat/supersine

Conversation

@AsTonyshment

@AsTonyshment AsTonyshment commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix #7281.

This PR adds a finite-support supersine electric field to LCAO RT-TDDFT as td_ttype 4 and refactors the complete time-dependent electric-field data flow.

The main changes are:

  • Add supersine amplitude, frequency, phase, shape, start-step, and end-step parameters.
  • Store RT-TDDFT field parameters as typed vectors instead of deferred strings.
  • Enforce one-to-one occurrence mapping between field types, directions, and waveform-specific parameters.
  • Support repeated Cartesian directions by summing their physical contributions while preserving per-occurrence output.
  • Add focused validation for field counts, directions, waveform types, and waveform-specific constraints.

Field-state refactor

Each configured field is now represented by an independent TDField and waveform-specific TDFieldProfile. A shared TDFieldManager owns:

  • the electronic-step counter and active field window;
  • per-occurrence electric-field samples;
  • direction-summed electric fields;
  • the midpoint vector potential and its current-step increment;
  • length-gauge cutoffs and Simpson subdivisions;
  • vector-potential restart state.

The RT-TDDFT ESolver creates the manager and injects the same shared instance into Potential before the time-dependent potential component is registered. Length-gauge sampling is advanced by H_TDDFT_pw, while velocity- and hybrid-gauge integration is advanced by the ESolver. This gives all gauges a single field definition and step state.

Field parsing and unit conversion no longer depend on the legacy Input_Conv::read_td_efield() path. H_TDDFT_pw no longer owns waveform parameter arrays, type counters, temporal waveform dispatch, or vector-potential integration. Its remaining static values are compatibility mirrors for existing propagation, current, force, and restart interfaces.

Input and documentation changes

td_ttype and all waveform parameter lists are parsed directly into typed vectors. The shared repetition-expression parser still supports N*value, but now rejects malformed values, negative repetition counts, trailing characters, and multiple * operators.

Supersine start and end parameters accept per-occurrence default tokens, which inherit the final values of td_tstart and td_tend.

The generated parameter YAML and user documentation have been updated with the field formulas, units, availability conditions, occurrence rules, and supersine parameters.

I/O changes

Electric-field and vector-potential I/O have been moved to dedicated components under source_io/module_efield; vector-potential I/O is no longer handled by TD_info.

  • efield_[index].txt now uses one-based field indices and preserves one file per input occurrence.
  • Fresh calculations truncate the configured field files once during initialization.
  • Restart calculations preserve existing files and append new active-step samples.
  • Vector-potential input and output are renamed from the legacy At.dat to vector_pot.txt.
  • Vector-potential, current, spin, k-point, and propagated-state matrix indices are consistently one-based.
  • The out_current=2 files now follow the current_s[spin]k[kpoint]_comm.txt naming convention.
  • Distributed td_print_eij output now reports global band indices.

The integration-test property collector now validates every configured electric-field output file and vector_pot.txt.

Validation

image

The above image compares ABACUS output with the analytical supersine electric field and vector potential for three directions with different frequencies, phases, supports, and shape parameters.

The electric-field samples closely follow the analytical curves in all three directions. The maximum observed electric-field difference is below approximately 4.9e-7 V/Angstrom, consistent with the output precision.

The ABACUS vector_pot.txt values also overlap the independently reproduced full-precision Simpson results. Their remaining differences are primarily limited by the four-digit scientific-notation output precision.

The analytical supersine vector potential is exactly zero after the pulse. The numerically integrated vector potential, however, is not explicitly constrained to return to zero and may retain a post-pulse residual from finite-resolution Simpson integration. This is most visible for the less smooth sigma=1.50 pulse using two Simpson subdivisions per electronic step:

  • ABACUS post-pulse residual: approximately 9.3459e-4 a.u.
  • Independent full-precision Simpson residual: approximately 9.34594e-4 a.u.

The agreement shows that this residual comes from the numerical quadrature rather than the supersine implementation or text-output rounding. Increasing the forced Simpson resolution in the independent reproduction reduces the residual from approximately 9.35e-4 at N=2 to 4.50e-4, 2.17e-4, and 1.05e-4 at N=4, 8, and 16, respectively.

CPU and GPU regression cases additionally cover supersine velocity-gauge propagation and mixed fields containing all five waveform types, repeated directions, per-occurrence field output, and hybrid-gauge vector-potential integration.

Comment thread source/source_io/module_parameter/read_input_tool.h Outdated
Comment thread source/source_estate/test/potential_new_test.cpp Outdated
Comment thread source/source_estate/module_pot/td_field.h
@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Aug 4, 2026
Copilot AI lite review requested due to automatic review settings August 4, 2026 08:15
@AsTonyshment
AsTonyshment removed the request for review from Copilot August 4, 2026 08:16
Copilot AI lite review requested due to automatic review settings August 4, 2026 09:26
@AsTonyshment
AsTonyshment removed the request for review from Copilot August 4, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add laser envelope of “supersine” form with exact zero boundaries

2 participants