Skip to content

Commit 5747623

Browse files
author
dyzheng
committed
fix: add get_spin_constrain_energy stub to hsolver supplementary mock
ElecStatePW::get_spin_constrain_energy() is a new virtual override that needs a definition in the vtable. Test targets (MODULE_HSOLVER_base, MODULE_HSOLVER_pw, MODULE_HSOLVER_sdft) compile a mock implementation of ElecStatePW methods instead of linking elecstate_pw.cpp, and were missing a stub for this new method, causing: undefined reference to ElecStatePW::get_spin_constrain_energy()
1 parent 797d2a2 commit 5747623

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

source/source_hsolver/test/hsolver_supplementary_mock.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ void ElecStatePW<T, Device>::cal_becsum(const psi::Psi<T, Device>& psi)
5959
{
6060
}
6161

62+
template <typename T, typename Device>
63+
double ElecStatePW<T, Device>::get_spin_constrain_energy()
64+
{
65+
return 0.0;
66+
}
67+
6268
template class ElecStatePW<std::complex<float>, base_device::DEVICE_CPU>;
6369
template class ElecStatePW<std::complex<double>, base_device::DEVICE_CPU>;
6470
#if ((defined __CUDA) || (defined __ROCM))

0 commit comments

Comments
 (0)