ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
test_dftu_base.cpp File Reference
#include "dftu_base_test_fixture.h"
#include "source_cell/atom_spec.h"
#include "source_pw/module_pwdft/dftu_base.h"
#include "source_pw/module_pwdft/dftu_pw_tools.h"
#include <mpi.h>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <unistd.h>
#include <vector>
Include dependency graph for test_dftu_base.cpp:

Functions

 TEST_F (DFTUBaseTest, InitBaseYukawaEnabledCreatesObject)
 Enabling Yukawa screening constructs its run-lifetime state.
 TEST_F (DFTUBaseTest, InitBaseYukawaDisabledLeavesObjectEmpty)
 Disabling Yukawa screening leaves its optional state empty.
 TEST_F (DFTUBaseTest, InitBaseSeedsURampingState)
 U-ramping starts from zero and advances toward the configured target.
 TEST_F (DFTUBaseTest, InitBaseComputesMixedOrbitalOffsetsForSpinModes)
 TEST_F (DFTUBaseTest, InitOccMat1BuildsPotentialFromFile)
 TEST_F (DFTUBaseTest, InitOccMat2BuildsPotentialFromFileAndIsStable)
int main (int argc, char **argv)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

◆ TEST_F() [1/6]

TEST_F ( DFTUBaseTest ,
InitBaseComputesMixedOrbitalOffsetsForSpinModes  )

init_base owns the flat potential offsets used by PW and the occupation mixer. Check the real layout for unequal orbital sizes and all spin modes.

Here is the call graph for this function:

◆ TEST_F() [2/6]

TEST_F ( DFTUBaseTest ,
InitBaseSeedsURampingState  )

U-ramping starts from zero and advances toward the configured target.

◆ TEST_F() [3/6]

TEST_F ( DFTUBaseTest ,
InitBaseYukawaDisabledLeavesObjectEmpty  )

Disabling Yukawa screening leaves its optional state empty.

◆ TEST_F() [4/6]

TEST_F ( DFTUBaseTest ,
InitBaseYukawaEnabledCreatesObject  )

Enabling Yukawa screening constructs its run-lifetime state.

◆ TEST_F() [5/6]

TEST_F ( DFTUBaseTest ,
InitOccMat1BuildsPotentialFromFile  )

For init_occ_mat=1 the file-loaded occupation matrix must seed the Hamiltonian at the first SCF step. Before the fix the whole iter_init_dftu_pw was skipped at the first step, so pot_onsite and E_plusU stayed zero and the file matrix was overwritten by the psi-reprojected matrix at iter=2 without ever entering the Hamiltonian. This test verifies the mechanism: after init_base reads the file, compute_pot_uterm_and_energy must produce a non-zero potential and energy from the file-loaded matrix.

Here is the call graph for this function:

◆ TEST_F() [6/6]

TEST_F ( DFTUBaseTest ,
InitOccMat2BuildsPotentialFromFileAndIsStable  )

For init_occ_mat=2 the occupation matrix is fixed from the file throughout the calculation. Every SCF step must rebuild the potential from the same matrix. This test verifies that (1) the file matrix produces a non-zero potential and energy, and (2) a second call with the unchanged matrix reproduces the same results — the defining property of mode 2 ("fixed matrix").

Here is the call graph for this function: