Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(charge): convert gamma_only layout when reading rho(G) restart - #8509

Open
mohanchen wants to merge 3 commits into
deepmodeling:developfrom
mohanchen:2026-12-04-a
Open

mohanchen wants to merge 3 commits into
deepmodeling:developfrom
mohanchen:2026-12-04-a

Conversation

@mohanchen

Copy link
Copy Markdown
Collaborator

Fix #6664

read_rhog aborted as soon as the gamma_only flag stored in the restart file differed from the current run, so an nscf started from an scf-generated ABACUS-CHARGE-DENSITY.restart silently failed to load the density (issue #6664).

The reader now reconstructs the missing half sphere through the Hermitian relation rho(-G) = conj(rho(G)) instead of returning an error. The mapping is driven by the Miller indices stored in the file, so it works for both directions (half sphere -> full sphere and full sphere -> half sphere) and is independent of which axis defines the half sphere.

Fill logic is factored into a local assign_mode helper, keeping the existing out-of-grid, stick-ownership and cutoff guards unchanged. Tests update InconsistentGammaOnly to expect success and add round-trip coverage for both gamma_only conversions.

read_rhog aborted as soon as the gamma_only flag stored in the restart
file differed from the current run, so an nscf started from an
scf-generated ABACUS-CHARGE-DENSITY.restart silently failed to load the
density (issue deepmodeling#6664).

The reader now reconstructs the missing half sphere through the Hermitian
relation rho(-G) = conj(rho(G)) instead of returning an error. The
mapping is driven by the Miller indices stored in the file, so it works
for both directions (half sphere -> full sphere and full sphere -> half
sphere) and is independent of which axis defines the half sphere.

Fill logic is factored into a local assign_mode helper, keeping the
existing out-of-grid, stick-ownership and cutoff guards unchanged.
Tests update InconsistentGammaOnly to expect success and add
round-trip coverage for both gamma_only conversions.
@mohanchen
mohanchen requested a review from ErjieWu December 4, 2026 05:07
@mohanchen mohanchen added Bugs Bugs that only solvable with sufficient knowledge of DFT Input&Output Suitable for coders without knowing too many DFT details Refactor Refactor ABACUS codes Solve before 3.11 labels Dec 4, 2026
abacus_fixer and others added 2 commits December 5, 2026 15:26
…og read

When the file stores only one half sphere (gamma_mismatch), G and -G may
be owned by different MPI ranks, so assign_mode(-G) silently failed on the
rank owning G and the conjugate partner was never filled. Each rank now
writes into a private buffer and the disjoint entries are merged with an
MPI_Allreduce(SUM).

Also guard the wrapped Miller indices against the reduced fftnx/fftny
size of gamma_only grids, preventing out-of-bounds access to fftixy2ip.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugs Bugs that only solvable with sufficient knowledge of DFT Input&Output Suitable for coders without knowing too many DFT details Refactor Refactor ABACUS codes Solve before 3.11

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Something wrong with reading charge density file in nscf calculations

2 participants