From e30dc873646a6e437d5f4e20ba0348e8fdade2a0 Mon Sep 17 00:00:00 2001 From: gonzalo Date: Wed, 6 Sep 2023 20:46:37 +0200 Subject: [PATCH] Bug fix regarding to open shell with cuda and libxc --- g2g/cuda/iteration.cu | 18 ++++++++++++++++++ g2g/excited/cuda/fake_cuda.cu | 3 +++ g2g/excited/cuda/g2g_calculateXC.cu | 7 +++++++ g2g/partition.h | 19 +++++++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/g2g/cuda/iteration.cu b/g2g/cuda/iteration.cu index 96f3730d..994b6d74 100644 --- a/g2g/cuda/iteration.cu +++ b/g2g/cuda/iteration.cu @@ -939,6 +939,24 @@ void PointGroupGPU::solve_opened( //cudaPrintMemoryInfo(); } +template +void PointGroupGPU::compute_rmm_libxc(const uint& group_m, const scalar_type* fv, + const scalar_type* gxv, const scalar_type* gyv, const scalar_type* gzv, + const scalar_type& wp, double* coef_a, double* coef_b, + const G2G::vec_type& dxyz_a, const G2G::vec_type& dxyz_b, + double* smallFock_a, double* smallFock_b) {} + +template +void PointGroupGPU::compute_forces_libxc(const uint& group_m, const scalar_type& wp, int& local_atoms, + const scalar_type* fv, const scalar_type* gxv, const scalar_type* gyv, const scalar_type* gzv, + const scalar_type* hpxv, const scalar_type* hpyv, const scalar_type* hpzv, + const scalar_type* hixv, const scalar_type* hiyv, const scalar_type* hizv, + HostMatrix& rmm_input_a, HostMatrix& rmm_input_b, + const G2G::vec_type& dxyz_a, const G2G::vec_type& dxyz_b, + double* coef_a, double* coef_b, + HostMatrix& ddx_a, HostMatrix& ddy_a, HostMatrix& ddz_a, + HostMatrix& ddx_b, HostMatrix& ddy_b, HostMatrix& ddz_b, + double* smallFor_a, double* smallFor_b) {} /******************************* diff --git a/g2g/excited/cuda/fake_cuda.cu b/g2g/excited/cuda/fake_cuda.cu index e755a947..ec519330 100644 --- a/g2g/excited/cuda/fake_cuda.cu +++ b/g2g/excited/cuda/fake_cuda.cu @@ -22,6 +22,9 @@ void PointGroupGPU::lr_closed_init() { } template void PointGroupGPU::solve_closed_lr(double* T,HostMatrix& Fock,int DER) { } +template +void PointGroupGPU::solve_open_lr(double* Ta, double* Tb, HostMatrix& FockA, HostMatrix& FockB,int DER) {} + template void PointGroupGPU::get_tred_input( HostMatrix& tred_input, HostMatrix& source) const { } diff --git a/g2g/excited/cuda/g2g_calculateXC.cu b/g2g/excited/cuda/g2g_calculateXC.cu index 194d551d..2010b66d 100644 --- a/g2g/excited/cuda/g2g_calculateXC.cu +++ b/g2g/excited/cuda/g2g_calculateXC.cu @@ -288,6 +288,13 @@ void PointGroupGPU::solve_closed_lr(double* T, HostMatrix& } } +// For open shell does not work +template +void PointGroupGPU::solve_open_lr(double* Ta, double* Tb, HostMatrix& FockA, HostMatrix& FockB,int DER) { + std::cout << " Linear Response does not work for open shell and cuda, compile lio in cpu mode!" << std::endl; + exit(-1); +} + template void PointGroupGPU::get_tred_input( HostMatrix& tred_input, HostMatrix& source) const diff --git a/g2g/partition.h b/g2g/partition.h index 3eaa58ce..74401ff4 100644 --- a/g2g/partition.h +++ b/g2g/partition.h @@ -280,10 +280,29 @@ class PointGroupGPU: public PointGroup { virtual void solve(Timers& timers, bool compute_rmm, bool lda, bool compute_forces, bool compute_energy, double& energy, double &, double &, double &, double &, HostMatrix &, int, HostMatrix &, bool); + // + // For open shell with libxc, only works in cpu + virtual void compute_rmm_libxc(const uint& group_m, const scalar_type* fv, + const scalar_type* gxv, const scalar_type* gyv, const scalar_type* gzv, + const scalar_type& wp, double* coef_a, double* coef_b, + const G2G::vec_type& dxyz_a, const G2G::vec_type& dxyz_b, + double* smallFock_a, double* smallFock_b); + + virtual void compute_forces_libxc(const uint& group_m, const scalar_type& wp, int& local_atoms, + const scalar_type* fv, const scalar_type* gxv, const scalar_type* gyv, const scalar_type* gzv, + const scalar_type* hpxv, const scalar_type* hpyv, const scalar_type* hpzv, + const scalar_type* hixv, const scalar_type* hiyv, const scalar_type* hizv, + HostMatrix& rmm_input_a, HostMatrix& rmm_input_b, + const G2G::vec_type& dxyz_a, const G2G::vec_type& dxyz_b, + double* coef_a, double* coef_b, + HostMatrix& ddx_a, HostMatrix& ddy_a, HostMatrix& ddz_a, + HostMatrix& ddx_b, HostMatrix& ddy_b, HostMatrix& ddz_b, + double* smallFor_a, double* smallFor_b); virtual void get_tred_input(G2G::HostMatrix& tre_input,G2G::HostMatrix& source) const; virtual void lr_closed_init(); virtual void solve_closed_lr(double* T,HostMatrix& Fock,int DER); + virtual void solve_open_lr(double* Ta, double* Tb, HostMatrix& FockA, HostMatrix& FockB,int DER); virtual void solve_for_exc(double* P,double* V,HostMatrix& F,int met); virtual void calc_W_mat(HostMatrix& , CDFTVars&);