|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#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>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) | |
| 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.
| 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.
| TEST_F | ( | DFTUBaseTest | , |
| CollinearEigenvaluesStopAtJacobiCutoff | ) |
| 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).
| TEST_F | ( | DFTUBaseTest | , |
| LatestOccMatIncludesSortedCollinearEigenvalues | ) |
| TEST_F | ( | DFTUBaseTest | , |
| LcaoMethodTwoSocEigenvaluesPreserveCrossOrbitalCoupling | ) |
| TEST_F | ( | DFTUBaseTest | , |
| NonmagneticEigenvaluesUseOnlyMaintainedChannel | ) |
| TEST_F | ( | DFTUBaseTest | , |
| NonmagneticPwEigenvaluesKeepSpinSummedWeight | ) |
| 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.
| TEST_F | ( | DFTUBaseTest | , |
| SocEigenvaluesIncludeImaginarySpinCoupling | ) |