Skip to content

RT-TDDFT hybrid-exchange restart dereferences dm_last_step before initialization #8280

Open

Description

@memii-x

Summary

A fresh-process LCAO RT-TDDFT restart with hybrid exchange crashes in the first EXX density preparation. This is reproducible for both HSE and PBE0 in hybrid gauge.

The restart reaches the first electronic iteration, then exits with SIGSEGV (MPI exit code 139) before producing a propagated current sample.

Reproduction

Start from the repository's Si RT PBE0 fixture, retaining its Si pseudopotential/orbital, Gamma-centered 2x1x1 mesh and field parameters. Set both atoms' movement flags to zero and use absolute paths without spaces for pseudo_dir and orbital_dir.

Override/add these INPUT entries (replace existing entries rather than duplicating them):

suffix restartcheck
dft_functional pbe0
exx_singularity_correction spencer
symmetry -1
fixed_atoms 1
cal_force 0
dump_force 0
scf_thr 1e-7
scf_nmax 100
md_nstep 2
estep_per_md 5
td_dt 0.005
md_restartfreq 1
out_wfc_lcao 2
out_app_flag 0
out_freq_td 1
out_efield 1
out_vecpot 1
out_current 1
  1. Run with two MPI ranks and OMP_NUM_THREADS=1. This completes the initial state and five electronic propagation steps.
  2. Copy the whole OUT.restartcheck directory to a separate checkpoint directory. Copy the program-generated checkpoint/STRU/STRU_MD_1 to checkpoint/STRU_MD_1 without changing its contents. Preserve the WFC directory and both restart files.
  3. In a new sibling run directory, reuse INPUT/STRU/KPT, change md_nstep to 3, and add:
    md_restart 1
    init_wfc file binary
    init_chg atomic
    read_file_dir ../checkpoint/
    
  4. Start a new MPI process. It crashes at the first EXX update.

The same procedure reproduces with dft_functional hse and exx_singularity_correction limits.

The saved electronic step is 5 (0.025 fs), ionic restart step is 1, and saved A_z is approximately -0.0004019805510552 in Hartree atomic units. The checkpoint files remain unchanged throughout the controls.

Observed controls

Build/control HSE restart PBE0 restart
Current direct-kernel image candidate for #8170 SIGSEGV SIGSEGV
Earlier #8170 source at 4a2e4b8 SIGSEGV SIGSEGV
Same earlier source with input-phase adapters disabled for diagnosis SIGSEGV SIGSEGV

Uninterrupted ten-step runs and five-step prefix runs complete for both functionals; current and vector-potential values agree over their common prefix at the printed precision.

Environment: GNU 11.4, OpenMPI, LibRI b0eff7a, Libxc 5.1.7; CPU/LCAO build, two MPI ranks, one OpenMP thread.

Source-level cause

The existing upstream code at f5315651166ea265ba673996e3c9efeb5e4cd9b0 declares dm_last_step without initialization. In exx_eachiterinit, a later-step first iteration takes the cal(*this->dm_last_step) branch. However, the pointer is assigned in exx_iter_finish only after convergence. A fresh process replaying a nonzero saved electronic step can therefore dereference it before that assignment.

Relevant upstream files:

Symbolicated phase-enabled stack:

Exx_LRI_Interface::prepare_exx_density
Exx_LRI_Interface::exx_eachiterinit
ESolver_KS_LCAO::iter_init
ESolver_KS_LCAO_TDDFT::runner
MD_func::force_virial
MD_base::setup

The phase-disabled control fails in Mix_DMk_2D::restart_all called from the same exx_eachiterinit path.

Runtime reproductions above use the listed PR-based builds; the unchanged lifetime defect was also checked directly in upstream source. This issue tracks restart initialization separately from the input/image phase correction in #8170. The expected behavior is to reconstruct the saved density and its source-time state before the first EXX update.

Activity

  1. ABACUS-PR-BOT commented on Nov 3, 2026

    @ABACUS-PR-BOT
    Collaborator

    Source tracing at f5315651166ea265ba673996e3c9efeb5e4cd9b0 confirms the invalid first-use path: restart replay passes electronic step 5 and iteration 1 into EXX, which uses dm_last_step before its post-convergence assignment. The constructor leaves that pointer indeterminate.

    An additional requirement for a fix is to reconstruct DMK before this call. Loading the binary WFC fills wavefunctions and occupations; the initial DM conversion is guarded by istep == 0, while the restart conversion through weight_dm_rho happens after EXX. Falling back to the allocated current DM can therefore consume its initial zero density.

    The regression should check the first EXX input against the saved WFC/occupations and saved field endpoint, then compare the resumed HSE and PBE0 trajectories with uninterrupted runs at equal electronic times. Merely avoiding the crash would not establish correct continuation.

    This is a source-supported diagnosis; I have not independently rerun the reported MPI crashes or numerical continuity controls.

  2. added
    rt-TDDFT
    Bugs
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugsrt-TDDFT

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions