From 9e2a671356b7dc56b8c4db9c267666644bdc7539 Mon Sep 17 00:00:00 2001 From: "Thomas D. Kuehne" Date: Sun, 24 May 2026 21:40:56 +0200 Subject: [PATCH 1/2] Add spin-summed RKS density setting --- include/gauxc/xc_integrator_settings.hpp | 3 +++ ...incore_replicated_xc_device_integrator.hpp | 9 ++++---- ...re_replicated_xc_device_integrator_exc.hpp | 3 +-- ...plicated_xc_device_integrator_exc_grad.hpp | 7 +++++- ...eplicated_xc_device_integrator_exc_vxc.hpp | 23 ++++++++++++------- ...d_xc_device_integrator_fxc_contraction.hpp | 19 ++++++++++----- ...replicated_xc_host_integrator_exc_grad.hpp | 7 +++++- ..._replicated_xc_host_integrator_exc_vxc.hpp | 3 ++- ...ted_xc_host_integrator_fxc_contraction.hpp | 3 ++- ...shell_batched_replicated_xc_integrator.hpp | 8 +++++-- ...l_batched_replicated_xc_integrator_exc.hpp | 5 ++-- ...ched_replicated_xc_integrator_exc_grad.hpp | 4 ++-- ...tched_replicated_xc_integrator_exc_vxc.hpp | 17 +++++++------- ...plicated_xc_integrator_fxc_contraction.hpp | 2 +- tests/standalone_driver.cxx | 12 +++++++--- tests/xc_integrator.cxx | 13 +++++++++++ 16 files changed, 95 insertions(+), 43 deletions(-) diff --git a/include/gauxc/xc_integrator_settings.hpp b/include/gauxc/xc_integrator_settings.hpp index 1ec26d0e6..c8fbd7be3 100644 --- a/include/gauxc/xc_integrator_settings.hpp +++ b/include/gauxc/xc_integrator_settings.hpp @@ -23,6 +23,9 @@ struct IntegratorSettingsSNLinK : public IntegratorSettingsEXX { struct IntegratorSettingsXC { virtual ~IntegratorSettingsXC() noexcept = default; }; struct IntegratorSettingsKS : public IntegratorSettingsXC { double gks_dtol = 1e-12; + // RKS density matrices are interpreted as one-spin densities by default. + // Set this when the caller provides the spin-summed closed-shell density. + bool rks_density_matrix_is_spin_summed = false; }; struct IntegratorSettingsEXC_GRAD : public IntegratorSettingsKS { diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator.hpp index 30ff47ce1..b5b1e29f5 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator.hpp @@ -116,7 +116,8 @@ class IncoreReplicatedXCDeviceIntegrator : const value_type* Py, int64_t ldpy, const value_type* Px, int64_t ldpx, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data, bool do_vxc ); + XCDeviceData& device_data, bool do_vxc, + const IntegratorSettingsXC& settings ); void exc_vxc_local_work_( const basis_type& basis, const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz, @@ -127,14 +128,14 @@ class IncoreReplicatedXCDeviceIntegrator : value_type* VXCy, int64_t ldvxcy, value_type* VXCx, int64_t ldvxcx, value_type* EXC, value_type *N_EL, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data ); + XCDeviceData& device_data, const IntegratorSettingsXC& settings ); void fxc_contraction_local_work_( const basis_type& basis, const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz, const value_type* tPs, int64_t ldtps, const value_type* tPz, int64_t ldtpz, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data); + XCDeviceData& device_data, const IntegratorSettingsXC& settings); void fxc_contraction_local_work_( const basis_type& basis, const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz, @@ -144,7 +145,7 @@ class IncoreReplicatedXCDeviceIntegrator : value_type* FXCs, int64_t ldfxcs, value_type* FXCz, int64_t ldfxcz, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data ); + XCDeviceData& device_data, const IntegratorSettingsXC& settings ); void eval_exc_grad_local_work_( const basis_type& basis, const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz, diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp index 9a2a7cf4f..0c71b6efa 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp @@ -59,7 +59,7 @@ void IncoreReplicatedXCDeviceIntegrator:: exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, // Passing nullptr for VXCs disables VXC entirely nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, EXC, &N_EL, - tasks.begin(), tasks.end(), *device_data_ptr); + tasks.begin(), tasks.end(), *device_data_ptr, ks_settings); }); GAUXC_MPI_CODE( @@ -100,4 +100,3 @@ void IncoreReplicatedXCDeviceIntegrator:: } } - diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_grad.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_grad.hpp index 6c030bc29..15230d680 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_grad.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_grad.hpp @@ -168,6 +168,10 @@ void IncoreReplicatedXCDeviceIntegrator:: IntegratorSettingsEXC_GRAD exc_grad_settings; if( auto* tmp = dynamic_cast(&settings) ) { exc_grad_settings = *tmp; + } else if( auto* ks_tmp = dynamic_cast(&settings) ) { + exc_grad_settings.gks_dtol = ks_tmp->gks_dtol; + exc_grad_settings.rks_density_matrix_is_spin_summed = + ks_tmp->rks_density_matrix_is_spin_summed; } // Check that Partition Weights have been calculated @@ -221,7 +225,8 @@ void IncoreReplicatedXCDeviceIntegrator:: else lwd->eval_collocation_gradient( &device_data ); // Evaluate X matrix and V vars - const auto xmat_fac = is_rks ? 2.0 : 1.0; + const auto xmat_fac = + (is_rks and not exc_grad_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; const auto need_lapl = func.needs_laplacian(); const auto need_xmat_grad = not func.is_lda(); auto do_xmat_vvar = [&](density_id den_id) { diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_vxc.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_vxc.hpp index 416a49c5a..ef15fdbaa 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_vxc.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc_vxc.hpp @@ -110,8 +110,8 @@ void IncoreReplicatedXCDeviceIntegrator:: // If we can do reductions on the device (e.g. NCCL) // Don't communicate data back to the host before reduction this->timer_.time_op("XCIntegrator.LocalWork_EXC_VXC", [&](){ - exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, tasks.begin(), tasks.end(), - *device_data_ptr, true); + exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, tasks.begin(), tasks.end(), + *device_data_ptr, true, settings); }); GAUXC_MPI_CODE( @@ -177,7 +177,7 @@ void IncoreReplicatedXCDeviceIntegrator:: this->timer_.time_op("XCIntegrator.LocalWork_EXC_VXC", [&](){ exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, VXCs, ldvxcs, VXCz, ldvxcz, VXCy, ldvxcy, VXCx, ldvxcx, EXC, - &N_EL, tasks.begin(), tasks.end(), *device_data_ptr); + &N_EL, tasks.begin(), tasks.end(), *device_data_ptr, settings); }); GAUXC_MPI_CODE( @@ -225,7 +225,8 @@ void IncoreReplicatedXCDeviceIntegrator:: const value_type* Py, int64_t ldpy, const value_type* Px, int64_t ldpx, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data, bool do_vxc ) { + XCDeviceData& device_data, bool do_vxc, + const IntegratorSettingsXC& settings ) { const bool is_gks = (Pz != nullptr) and (Py != nullptr) and (Px != nullptr); const bool is_uks = (Pz != nullptr) and (Py == nullptr) and (Px == nullptr); const bool is_rks = (Ps != nullptr) and (not is_uks and not is_gks); @@ -243,6 +244,11 @@ void IncoreReplicatedXCDeviceIntegrator:: if( func.is_mgga() and is_gks ) GAUXC_GENERIC_EXCEPTION("GKS mGGAs NYI!"); + IntegratorSettingsKS ks_settings; + if( auto* tmp = dynamic_cast(&settings) ) { + ks_settings = *tmp; + } + // Get basis map BasisSetMap basis_map(basis,mol); @@ -312,7 +318,8 @@ void IncoreReplicatedXCDeviceIntegrator:: else if( func.is_gga() ) lwd->eval_collocation_gradient( &device_data ); else lwd->eval_collocation( &device_data ); - const double xmat_fac = is_rks ? 2.0 : 1.0; + const double xmat_fac = + (is_rks and not ks_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; const bool need_xmat_grad = func.is_mgga(); // Evaluate X matrix and V vars @@ -396,11 +403,12 @@ void IncoreReplicatedXCDeviceIntegrator:: value_type* VXCy, int64_t ldvxcy, value_type* VXCx, int64_t ldvxcx, value_type* EXC, value_type *N_EL, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data ) { + XCDeviceData& device_data, const IntegratorSettingsXC& settings ) { // Get integrate and keep data on device const bool do_vxc = VXCs; - exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, task_begin, task_end, device_data, do_vxc ); + exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, + task_begin, task_end, device_data, do_vxc, settings ); auto rt = detail::as_device_runtime(this->load_balancer_->runtime()); rt.device_backend()->master_queue_synchronize(); @@ -414,4 +422,3 @@ void IncoreReplicatedXCDeviceIntegrator:: } } - diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_fxc_contraction.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_fxc_contraction.hpp index ffc0ca417..0b8139244 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_fxc_contraction.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_fxc_contraction.hpp @@ -85,7 +85,7 @@ namespace GauXC::detail { // Don't communicate data back to the host before reduction this->timer_.time_op("XCIntegrator.LocalWork_FXC", [&](){ fxc_contraction_local_work_( basis, Ps, ldps, Pz, ldpz, tPs, ldtps, tPz, ldtpz, - tasks.begin(), tasks.end(), *device_data_ptr); + tasks.begin(), tasks.end(), *device_data_ptr, ks_settings); }); GAUXC_MPI_CODE( @@ -127,7 +127,8 @@ namespace GauXC::detail { // data from device this->timer_.time_op("XCIntegrator.LocalWork_FXC", [&](){ fxc_contraction_local_work_( basis, Ps, ldps, Pz, ldpz, tPs, ldtps, tPz, ldtpz, &N_EL, - FXCs, ldfxcs, FXCz, ldfxcz, tasks.begin(), tasks.end(), *device_data_ptr); + FXCs, ldfxcs, FXCz, ldfxcz, tasks.begin(), tasks.end(), *device_data_ptr, + ks_settings); }); GAUXC_MPI_CODE( @@ -160,7 +161,7 @@ namespace GauXC::detail { const value_type* tPs, int64_t ldtps, const value_type* tPz, int64_t ldtpz, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data) { + XCDeviceData& device_data, const IntegratorSettingsXC& settings) { const bool is_uks = (Pz != nullptr); const bool is_rks = !is_uks; if (not is_rks and not is_uks) { @@ -175,6 +176,11 @@ namespace GauXC::detail { const auto& func = *this->func_; const auto& mol = this->load_balancer_->molecule(); + IntegratorSettingsKS ks_settings; + if( auto* tmp = dynamic_cast(&settings) ) { + ks_settings = *tmp; + } + // Get basis map BasisSetMap basis_map(basis,mol); @@ -243,7 +249,8 @@ namespace GauXC::detail { else if( func.is_gga() ) lwd->eval_collocation_gradient( &device_data ); else lwd->eval_collocation( &device_data ); - const double xmat_fac = is_rks ? 2.0 : 1.0; + const double xmat_fac = + (is_rks and not ks_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; const bool need_xmat_grad = func.is_mgga(); // Evaluate X matrix and V vars @@ -327,11 +334,11 @@ namespace GauXC::detail { value_type* FXCs, int64_t ldfxcs, value_type* FXCz, int64_t ldfxcz, host_task_iterator task_begin, host_task_iterator task_end, - XCDeviceData& device_data ) { + XCDeviceData& device_data, const IntegratorSettingsXC& settings ) { // Get integrate and keep data on device fxc_contraction_local_work_( basis, Ps, ldps, Pz, ldpz, tPs, ldtps, tPz, ldtpz, - task_begin, task_end, device_data); + task_begin, task_end, device_data, settings); auto rt = detail::as_device_runtime(this->load_balancer_->runtime()); rt.device_backend()->master_queue_synchronize(); diff --git a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_grad.hpp b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_grad.hpp index f04ae24b7..b3c5db950 100644 --- a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_grad.hpp +++ b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_grad.hpp @@ -126,6 +126,10 @@ void ReferenceReplicatedXCHostIntegrator:: IntegratorSettingsEXC_GRAD exc_grad_settings; if( auto* tmp = dynamic_cast(&settings) ) { exc_grad_settings = *tmp; + } else if( auto* ks_tmp = dynamic_cast(&settings) ) { + exc_grad_settings.gks_dtol = ks_tmp->gks_dtol; + exc_grad_settings.rks_density_matrix_is_spin_summed = + ks_tmp->rks_density_matrix_is_spin_summed; } // Get basis map @@ -330,7 +334,8 @@ void ReferenceReplicatedXCHostIntegrator:: // Evaluate X matrix (2 * P * B/Bx/By/Bz) -> store in Z // XXX: This assumes that bfn + gradients are contiguous in memory - const auto xmat_fac = is_rks ? 2.0 : 1.0; + const auto xmat_fac = + (is_rks and not exc_grad_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; const int xmat_len = func.is_lda() ? 1 : 4; lwd->eval_xmat( xmat_len*npts, nbf, nbe, submat_map, xmat_fac, Ps, ldps, basis_eval, nbe, xNmat, nbe, nbe_scr ); diff --git a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_vxc.hpp b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_vxc.hpp index 141085c9f..4442f3580 100644 --- a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_vxc.hpp +++ b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_exc_vxc.hpp @@ -385,7 +385,8 @@ void ReferenceReplicatedXCHostIntegrator:: // Evaluate X matrix (fac * P * B) -> store in Z - const auto xmat_fac = is_rks ? 2.0 : 1.0; // TODO Fix for spinor RKS input + const auto xmat_fac = + (is_rks and not ks_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; lwd->eval_xmat( mgga_dim_scal * npts, nbf, nbe, submat_map, xmat_fac, Ps, ldps, basis_eval, nbe, zmat, nbe, nbe_scr ); diff --git a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_fxc_contraction.hpp b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_fxc_contraction.hpp index 192fe0f89..473e56f75 100644 --- a/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_fxc_contraction.hpp +++ b/src/xc_integrator/replicated/host/reference_replicated_xc_host_integrator_fxc_contraction.hpp @@ -387,7 +387,8 @@ void ReferenceReplicatedXCHostIntegrator:: // Evaluate X matrix (fac * P * B) -> store in Z - const auto xmat_fac = is_rks ? 2.0 : 1.0; // TODO Fix for spinor RKS input + const auto xmat_fac = + (is_rks and not ks_settings.rks_density_matrix_is_spin_summed) ? 2.0 : 1.0; lwd->eval_xmat( mgga_dim_scal * npts, nbf, nbe, submat_map, xmat_fac, Ps, ldps, basis_eval, nbe, zmat, nbe, nbe_scr ); // X matrix for Pz diff --git a/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator.hpp b/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator.hpp index 5c1d4a949..ce8365ad6 100644 --- a/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator.hpp +++ b/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator.hpp @@ -133,7 +133,9 @@ class ShellBatchedReplicatedXCIntegrator : value_type* VXCy, int64_t ldvxcy, value_type* VXCx, int64_t ldvxcx, value_type* EXC, value_type *N_EL, - host_task_iterator task_begin, host_task_iterator task_end, incore_integrator_type& incore_integrator + host_task_iterator task_begin, host_task_iterator task_end, + incore_integrator_type& incore_integrator, + const IntegratorSettingsXC& ks_settings ); @@ -146,7 +148,9 @@ class ShellBatchedReplicatedXCIntegrator : value_type* VXCz, int64_t ldvxcz, value_type* VXCy, int64_t ldvxcy, value_type* VXCx, int64_t ldvxcx, - value_type* EXC, value_type* N_EL, incore_integrator_type& incore_integrator); + value_type* EXC, value_type* N_EL, + incore_integrator_type& incore_integrator, + const IntegratorSettingsXC& ks_settings); public: template diff --git a/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator_exc.hpp b/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator_exc.hpp index 2a5565c9c..02126e12a 100644 --- a/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator_exc.hpp +++ b/src/xc_integrator/shell_batched/shell_batched_replicated_xc_integrator_exc.hpp @@ -38,7 +38,7 @@ void ShellBatchedReplicatedXCIntegratorload_balancer_->basis(); @@ -84,7 +84,7 @@ void ShellBatchedReplicatedXCIntegratortimer_.time_op("XCIntegrator.LocalWork", [&](){ exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, EXC, - &N_EL, tasks.begin(), tasks.end(), incore_integrator ); + &N_EL, tasks.begin(), tasks.end(), incore_integrator, ks_settings ); }); // Release ownership of LWD back to this integrator instance @@ -134,4 +134,3 @@ void ShellBatchedReplicatedXCIntegrator @@ -31,7 +31,7 @@ void ShellBatchedReplicatedXCIntegratorload_balancer_->basis(); @@ -98,7 +98,7 @@ void ShellBatchedReplicatedXCIntegratortimer_.time_op("XCIntegrator.LocalWork", [&](){ exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, VXCs, ldvxcs, VXCz, ldvxcz, VXCy, ldvxcy, VXCx, ldvxcx, EXC, - &N_EL, tasks.begin(), tasks.end(), incore_integrator ); + &N_EL, tasks.begin(), tasks.end(), incore_integrator, ks_settings ); }); // Release ownership of LWD back to this integrator instance @@ -166,7 +166,8 @@ void ShellBatchedReplicatedXCIntegrator EXC_GRAD; if( integrate_exc_grad ) { + IntegratorSettingsEXC_GRAD exc_grad_settings; + exc_grad_settings.rks_density_matrix_is_spin_summed = rks_density_matrix_is_spin_summed; if( rks ) { - EXC_GRAD = integrator.eval_exc_grad( P ); + EXC_GRAD = integrator.eval_exc_grad( P, exc_grad_settings ); } else if( uks ) { - EXC_GRAD = integrator.eval_exc_grad( P, Pz ); + EXC_GRAD = integrator.eval_exc_grad( P, Pz, exc_grad_settings ); } else if( gks ) { std::cout << "Warning: eval_exc_grad + GKS NYI!" << std::endl; diff --git a/tests/xc_integrator.cxx b/tests/xc_integrator.cxx index 947a9914b..0145dc366 100644 --- a/tests/xc_integrator.cxx +++ b/tests/xc_integrator.cxx @@ -215,6 +215,19 @@ void test_xc_integrator( ExecutionSpace ex, const RuntimeEnvironment& rt, auto EXC2 = integrator.eval_exc( P ); CHECK(EXC2 == Approx(EXC)); + if( func.is_lda() ) { + // External interfaces may provide the spin-summed closed-shell density + // instead of the one-spin density used by GauXC's default RKS convention. + matrix_type P_spin_summed = 2.0 * P; + IntegratorSettingsKS spin_summed_settings; + spin_summed_settings.rks_density_matrix_is_spin_summed = true; + auto EXC3 = integrator.eval_exc( P_spin_summed, spin_summed_settings ); + CHECK(EXC3 == Approx(EXC_ref)); + auto [ EXC4, VXC4 ] = integrator.eval_exc_vxc( P_spin_summed, spin_summed_settings ); + CHECK(EXC4 == Approx(EXC_ref)); + (void)VXC4; + } + } else if (uks) { auto [ EXC, VXC, VXCz ] = integrator.eval_exc_vxc( P, Pz ); From 8646de6092dde550251269d9c776d52874e0aa4c Mon Sep 17 00:00:00 2001 From: "Thomas D. Kuehne" Date: Mon, 25 May 2026 23:57:16 +0200 Subject: [PATCH 2/2] Address spin-summed RKS density review comments --- .../device/incore_replicated_xc_device_integrator_exc.hpp | 2 +- tests/standalone_driver.cxx | 8 +++++--- tests/xc_integrator.cxx | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp index 0c71b6efa..b6f4a3daa 100644 --- a/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp +++ b/src/xc_integrator/replicated/device/incore_replicated_xc_device_integrator_exc.hpp @@ -59,7 +59,7 @@ void IncoreReplicatedXCDeviceIntegrator:: exc_vxc_local_work_( basis, Ps, ldps, Pz, ldpz, Py, ldpy, Px, ldpx, // Passing nullptr for VXCs disables VXC entirely nullptr, 0, nullptr, 0, nullptr, 0, nullptr, 0, EXC, &N_EL, - tasks.begin(), tasks.end(), *device_data_ptr, ks_settings); + tasks.begin(), tasks.end(), *device_data_ptr, settings); }); GAUXC_MPI_CODE( diff --git a/tests/standalone_driver.cxx b/tests/standalone_driver.cxx index 7d8981b01..8e085f10f 100644 --- a/tests/standalone_driver.cxx +++ b/tests/standalone_driver.cxx @@ -459,6 +459,10 @@ int main(int argc, char** argv) { double EXC, N_EL; std::cout << std::scientific << std::setprecision(12); + IntegratorSettingsKS ks_settings; + ks_settings.rks_density_matrix_is_spin_summed = + rks_density_matrix_is_spin_summed; + if( integrate_den ) { if( (uks or gks) and !world_rank ) { std::cout << "Warning: integrate_den will only integrate the scalar density!" << std::endl; @@ -471,8 +475,6 @@ int main(int argc, char** argv) { if( integrate_vxc ) { if( rks ) { - IntegratorSettingsKS ks_settings; - ks_settings.rks_density_matrix_is_spin_summed = rks_density_matrix_is_spin_summed; std::tie(EXC, VXC) = integrator.eval_exc_vxc( P, ks_settings ); } else if ( uks ) { @@ -583,7 +585,7 @@ int main(int argc, char** argv) { // Compute FXC contraction if( rks ) { - FXC = integrator.eval_fxc_contraction( P, tP, IntegratorSettingsXC{} ); + FXC = integrator.eval_fxc_contraction( P, tP, ks_settings ); } else if( uks ) { std::tie(FXC, FXCz) = integrator.eval_fxc_contraction( P, Pz, tP, tPz, IntegratorSettingsXC{} ); } else if( gks ) { diff --git a/tests/xc_integrator.cxx b/tests/xc_integrator.cxx index 0145dc366..5773ba510 100644 --- a/tests/xc_integrator.cxx +++ b/tests/xc_integrator.cxx @@ -225,7 +225,8 @@ void test_xc_integrator( ExecutionSpace ex, const RuntimeEnvironment& rt, CHECK(EXC3 == Approx(EXC_ref)); auto [ EXC4, VXC4 ] = integrator.eval_exc_vxc( P_spin_summed, spin_summed_settings ); CHECK(EXC4 == Approx(EXC_ref)); - (void)VXC4; + auto VXC4_diff_nrm = ( VXC4 - VXC_ref ).norm(); + CHECK( VXC4_diff_nrm / basis.nbf() < 1e-10 ); } } else if (uks) {