ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
test_dftu_base_write.cpp File Reference
#include "dftu_base_test_fixture.h"
#include "source_pw/module_pwdft/dftu_base.h"
#include "source_pw/module_pwdft/dftu_base_io.h"
#include "source_pw/module_pwdft/dftu_pw_tools.h"
#include <cmath>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
Include dependency graph for test_dftu_base_write.cpp:

Functions

 TEST_F (DFTUBaseTest, AppendSnapshotNAPlaceholderAndReady)
 TEST_F (DFTUBaseTest, OccMatSwitchDisabledWritesNothing)
 TEST_F (DFTUBaseTest, DftPlusUDisabledWritesNothing)
 TEST_F (DFTUBaseTest, LatestOccMatIncludesSortedCollinearEigenvalues)
 TEST_F (DFTUBaseTest, SocEigenvaluesIncludeImaginarySpinCoupling)
 TEST_F (DFTUBaseTest, CollinearEigenvaluesStopAtJacobiCutoff)
 TEST_F (DFTUBaseTest, NonmagneticEigenvaluesUseOnlyMaintainedChannel)
 TEST_F (DFTUBaseTest, NonmagneticPwEigenvaluesKeepSpinSummedWeight)
 TEST_F (DFTUBaseTest, LcaoMethodTwoSocEigenvaluesPreserveCrossOrbitalCoupling)
 TEST_F (DFTUBaseTest, AppendSnapshotGuardDftuOffBeforeIterValidation)

Function Documentation

◆ TEST_F() [1/10]

TEST_F ( DFTUBaseTest ,
AppendSnapshotGuardDftuOffBeforeIterValidation  )

When DFT+U is off (dft_plus_u <= 0) append_ion_step_snapshot must return immediately, BEFORE the iter >= 1 validation. This guard-first ordering was introduced in step 3/3 of the EXX restart refactor so that a transient iter=0 (e.g. from an upstream EXX rerun signal) does not trigger WARNING_QUIT on a non-DFT+U calculation. Passing iter=0 with dft_plus_u=0 must therefore return cleanly.

Here is the call graph for this function:

◆ TEST_F() [2/10]

TEST_F ( DFTUBaseTest ,
AppendSnapshotNAPlaceholderAndReady  )

append_ion_step_snapshot must record an "N/A" placeholder instead of a silent zero matrix when the occupation matrix does not exist yet (the PW istep 0 / iter 1 case), and the real matrix body when it does.

Here is the call graph for this function:

◆ TEST_F() [3/10]

TEST_F ( DFTUBaseTest ,
CollinearEigenvaluesStopAtJacobiCutoff  )
Here is the call graph for this function:

◆ TEST_F() [4/10]

TEST_F ( DFTUBaseTest ,
DftPlusUDisabledWritesNothing  )

dft_plus_u = 0 (no DFT+U) must suppress both the numbered snapshot file and the latest occ_mat.txt, even when out_occ_mat = true (the default). This is the regression test for the abacuslite segfault: a default- constructed Plus_U_Base has an empty l_channel vector, so without this guard write_occup_m() dereferences a null l_channel.data() inside has_l_channel(). The guard also honours the documented contract that out_occ_mat only takes effect for DFT+U calculations (dft_plus_u > 0).

Here is the call graph for this function:

◆ TEST_F() [5/10]

TEST_F ( DFTUBaseTest ,
LatestOccMatIncludesSortedCollinearEigenvalues  )
Here is the call graph for this function:

◆ TEST_F() [6/10]

TEST_F ( DFTUBaseTest ,
LcaoMethodTwoSocEigenvaluesPreserveCrossOrbitalCoupling  )
Here is the call graph for this function:

◆ TEST_F() [7/10]

TEST_F ( DFTUBaseTest ,
NonmagneticEigenvaluesUseOnlyMaintainedChannel  )
Here is the call graph for this function:

◆ TEST_F() [8/10]

TEST_F ( DFTUBaseTest ,
NonmagneticPwEigenvaluesKeepSpinSummedWeight  )
Here is the call graph for this function:

◆ TEST_F() [9/10]

TEST_F ( DFTUBaseTest ,
OccMatSwitchDisabledWritesNothing  )

out_occ_mat = false must suppress both the numbered snapshot file and the latest occ_mat.txt, even when the frequency gates would trigger.

Here is the call graph for this function:

◆ TEST_F() [10/10]

TEST_F ( DFTUBaseTest ,
SocEigenvaluesIncludeImaginarySpinCoupling  )
Here is the call graph for this function: