Skip to content

Add some unittests/integrate tests to protect the output of KSDFT/SDFT in plane wave basis. #7090

@mohanchen

Description

@mohanchen

Background

Issue Description

Currently, the output results of KSDFT (Kohn-Sham Density Functional Theory) and SDFT (Stochastic Density Functional Theory) calculations under the plane wave basis in ABACUS lack systematic and comprehensive test coverage. This leads to potential risks: code refactoring, performance optimization, or new feature development may inadvertently break the correctness of core calculation outputs, resulting in inconsistent or inaccurate results that are difficult to trace and debug.

Describe the solution you'd like

Objective

To address this gap, we need to:

  1. Add unit tests for key modules involved in KSDFT/SDFT plane wave calculations (e.g., wavefunction initialization, Hamiltonian construction, diagonalization, charge density update, energy/force/stress output) to verify the correctness of individual components.
  2. Integrate end-to-end integration test suites for typical KSDFT/SDFT calculation workflows (including different system types, basis set parameters, and functional settings) to safeguard the consistency of final output results (e.g., total energy, atomic forces, stress tensor, electronic structure) against reference values.
  3. Ensure all new tests are compatible with ABACUS's existing CI/CD pipeline, enabling automatic validation for every code change to prevent regression.

Scope

  • KSDFT and SDFT calculation modules under the plane wave basis
  • Core output quantities: total energy, atomic forces, stress, band structure, charge density, etc.
  • Unit tests for low-level computational components
  • Integration tests for full calculation workflows
  • Compatibility with ABACUS's existing test framework (Google Test) and CI/CD system

Expected Outcome

  • Improved test coverage for KSDFT/SDFT plane wave basis calculations
  • Early detection of output correctness issues during code development
  • Enhanced reliability and reproducibility of ABACUS's core DFT calculation results
  • Reduced risk of regression in subsequent code refactoring and feature updates

Task list only for developers

  • Notice possible changes of behavior
  • Explain the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi

Notice Possible Changes of Behavior (Reminder only for developers)

Objective

To address this gap, we need to:

  1. Add unit tests for key modules involved in KSDFT/SDFT plane wave calculations (e.g., wavefunction initialization, Hamiltonian construction, diagonalization, charge density update, energy/force/stress output) to verify the correctness of individual components.
  2. Integrate end-to-end integration test suites for typical KSDFT/SDFT calculation workflows (including different system types, basis set parameters, and functional settings) to safeguard the consistency of final output results (e.g., total energy, atomic forces, stress tensor, electronic structure) against reference values.
  3. Ensure all new tests are compatible with ABACUS's existing CI/CD pipeline, enabling automatic validation for every code change to prevent regression.

Scope

  • KSDFT and SDFT calculation modules under the plane wave basis
  • Core output quantities: total energy, atomic forces, stress, band structure, charge density, etc.
  • Unit tests for low-level computational components
  • Integration tests for full calculation workflows
  • Compatibility with ABACUS's existing test framework (Google Test) and CI/CD system

Expected Outcome

  • Improved test coverage for KSDFT/SDFT plane wave basis calculations
  • Early detection of output correctness issues during code development
  • Enhanced reliability and reproducibility of ABACUS's core DFT calculation results
  • Reduced risk of regression in subsequent code refactoring and feature updates

Notice any changes of core modules (Reminder only for developers)

No response

Notice Possible Changes of Core Modules (Reminder only for developers)

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Review and understand the proposed feature and its importance.
  • Research on the existing solutions and relevant research articles/resources.
  • Discuss with the team to evaluate the feasibility of implementing the feature.
  • Create a design document outlining the proposed solution and implementation details.
  • Get feedback from the team on the design document.
  • Develop the feature following the agreed design.
  • Write unit tests and integration tests for the feature.
  • Update the documentation to include the new feature.
  • Perform code review and address any issues.
  • Merge the feature into the main branch.
  • Monitor for any issues or bugs reported by users after the feature is released.
  • Address any issues or bugs reported by users and continuously improve the feature.

Metadata

Metadata

Assignees

Labels

Features NeededThe features are indeed needed, and developers should have sophisticated knowledgeInterfacesInterfaces with other packagesUnit Tests/Integreate TestsIssues/PR related to unit tests and integrate tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions