Skip to content

Commit

Permalink
Bug fix regarding to open shell with cuda and libxc
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalodm committed Sep 6, 2023
1 parent 4ee8f59 commit e30dc87
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions g2g/cuda/iteration.cu
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,24 @@ void PointGroupGPU<scalar_type>::solve_opened(
//cudaPrintMemoryInfo();
}

template<class scalar_type>
void PointGroupGPU<scalar_type>::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<scalar_type, 3>& dxyz_a, const G2G::vec_type<scalar_type, 3>& dxyz_b,
double* smallFock_a, double* smallFock_b) {}

template<class scalar_type>
void PointGroupGPU<scalar_type>::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<scalar_type>& rmm_input_a, HostMatrix<scalar_type>& rmm_input_b,
const G2G::vec_type<scalar_type, 3>& dxyz_a, const G2G::vec_type<scalar_type, 3>& dxyz_b,
double* coef_a, double* coef_b,
HostMatrix<scalar_type>& ddx_a, HostMatrix<scalar_type>& ddy_a, HostMatrix<scalar_type>& ddz_a,
HostMatrix<scalar_type>& ddx_b, HostMatrix<scalar_type>& ddy_b, HostMatrix<scalar_type>& ddz_b,
double* smallFor_a, double* smallFor_b) {}


/*******************************
Expand Down
3 changes: 3 additions & 0 deletions g2g/excited/cuda/fake_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void PointGroupGPU<scalar_type>::lr_closed_init() { }
template<class scalar_type>
void PointGroupGPU<scalar_type>::solve_closed_lr(double* T,HostMatrix<double>& Fock,int DER) { }

template<class scalar_type>
void PointGroupGPU<scalar_type>::solve_open_lr(double* Ta, double* Tb, HostMatrix<double>& FockA, HostMatrix<double>& FockB,int DER) {}

template <class scalar_type>
void PointGroupGPU<scalar_type>::get_tred_input(
HostMatrix<scalar_type>& tred_input, HostMatrix<double>& source) const { }
Expand Down
7 changes: 7 additions & 0 deletions g2g/excited/cuda/g2g_calculateXC.cu
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ void PointGroupGPU<scalar_type>::solve_closed_lr(double* T, HostMatrix<double>&
}
}

// For open shell does not work
template<class scalar_type>
void PointGroupGPU<scalar_type>::solve_open_lr(double* Ta, double* Tb, HostMatrix<double>& FockA, HostMatrix<double>& 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 <class scalar_type>
void PointGroupGPU<scalar_type>::get_tred_input(
HostMatrix<scalar_type>& tred_input, HostMatrix<double>& source) const
Expand Down
19 changes: 19 additions & 0 deletions g2g/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,29 @@ class PointGroupGPU: public PointGroup<scalar_type> {
virtual void solve(Timers& timers, bool compute_rmm, bool lda, bool compute_forces,
bool compute_energy, double& energy, double &, double &, double &, double &,
HostMatrix<double> &, int, HostMatrix<double> &, 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<scalar_type, 3>& dxyz_a, const G2G::vec_type<scalar_type, 3>& 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<scalar_type>& rmm_input_a, HostMatrix<scalar_type>& rmm_input_b,
const G2G::vec_type<scalar_type, 3>& dxyz_a, const G2G::vec_type<scalar_type, 3>& dxyz_b,
double* coef_a, double* coef_b,
HostMatrix<scalar_type>& ddx_a, HostMatrix<scalar_type>& ddy_a, HostMatrix<scalar_type>& ddz_a,
HostMatrix<scalar_type>& ddx_b, HostMatrix<scalar_type>& ddy_b, HostMatrix<scalar_type>& ddz_b,
double* smallFor_a, double* smallFor_b);

virtual void get_tred_input(G2G::HostMatrix<scalar_type>& tre_input,G2G::HostMatrix<double>& source) const;
virtual void lr_closed_init();
virtual void solve_closed_lr(double* T,HostMatrix<double>& Fock,int DER);
virtual void solve_open_lr(double* Ta, double* Tb, HostMatrix<double>& FockA, HostMatrix<double>& FockB,int DER);
virtual void solve_for_exc(double* P,double* V,HostMatrix<double>& F,int met);
virtual void calc_W_mat(HostMatrix<double>& , CDFTVars&);

Expand Down

0 comments on commit e30dc87

Please sign in to comment.