Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GKS #86

Merged
merged 26 commits into from
Nov 21, 2023
Merged

GKS #86

Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
854c6f2
Added GKS boilerplate to include directory
elambros Nov 16, 2023
ea8a679
Added GKS definitions to ReferenceReplicatedXCHostIntegrator
elambros Nov 16, 2023
224cab9
Added GKS boilerplate to reference_replicated_xc_host_integrator_exc_…
elambros Nov 16, 2023
38d9e9e
Fixed some GKS boilerplate bugs
elambros Nov 16, 2023
935fab2
Added GKS boilerplate to local host work driver
elambros Nov 16, 2023
0c11f74
Implemented GKS UVVARS functions
elambros Nov 16, 2023
6c289e4
Fixed some typos for the GKS UVVAR implementation
elambros Nov 16, 2023
6cdbe1c
Implemented EVAL_ZMAT for GKS
elambros Nov 16, 2023
c1d0138
Implemented GKS inside eval_exc_vxc_local_work
elambros Nov 16, 2023
5e0eea8
added debug print statements
elambros Nov 16, 2023
9a1ca0a
Fixed bug related to how spin_dim_scal is used for vrho indexing in G…
elambros Nov 16, 2023
21e8b7f
Made a ternary operation more concise
elambros Nov 17, 2023
f7cbbfb
moved RKS/UKS/GKS to top of eval_exc_vxc_local_work
elambros Nov 17, 2023
b40a998
Added IntegratorSettingsEXCVXC class for runtime KS configuration opt…
elambros Nov 17, 2023
fd1ab77
Changed IntegratorSettingsEXCVXC -> IntegratorSettingsXC
elambros Nov 17, 2023
4ed32b1
Deleted the ":" file in src
elambros Nov 17, 2023
2e68b2c
Renamed Pscalar, VXCscalar -> Ps, VXCs etc..
elambros Nov 17, 2023
79e56ae
Switched ordering from ZXY -> ZYX
elambros Nov 17, 2023
e1ab601
Merge branch 'GKS' of https://github.com/elambros/GauXC into GKS
elambros Nov 17, 2023
563f844
Added placeholder GPU functions for GKS
elambros Nov 18, 2023
16b931c
Fixed typo in GPU functions IntegratorSettingsEXC -> IntegratorSettin…
elambros Nov 18, 2023
64094a0
Added unittest for GGA GKS NOT WORKING: getting a difference of ~10^-…
elambros Nov 18, 2023
de00790
Merged in mGGA and resolved conflicts
elambros Nov 20, 2023
0ed6bd0
Cleaned up some formatting and added gaurdrail to prevent GKS+mGGA
elambros Nov 20, 2023
5c7eed7
Retabbed to remove leftover tab characters
elambros Nov 20, 2023
2db7c71
Fixes GKS GGA unittest ref to use builtin backend
elambros Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions include/gauxc/xc_integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ class XCIntegrator {
XCIntegrator( XCIntegrator&& ) noexcept;

value_type integrate_den( const MatrixType& );
exc_vxc_type_rks eval_exc_vxc ( const MatrixType& );
exc_vxc_type_uks eval_exc_vxc ( const MatrixType&, const MatrixType& );
exc_vxc_type_gks eval_exc_vxc ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&);
exc_vxc_type_rks eval_exc_vxc ( const MatrixType&,
const IntegratorSettingsEXCVXC& = IntegratorSettingsEXCVXC{} );
exc_vxc_type_uks eval_exc_vxc ( const MatrixType&, const MatrixType&,
const IntegratorSettingsEXCVXC& = IntegratorSettingsEXCVXC{} );
exc_vxc_type_gks eval_exc_vxc ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&,
const IntegratorSettingsEXCVXC& = IntegratorSettingsEXCVXC{});
exc_grad_type eval_exc_grad( const MatrixType& );
exx_type eval_exx ( const MatrixType&,
const IntegratorSettingsEXX& = IntegratorSettingsEXX{} );
Expand Down
13 changes: 7 additions & 6 deletions include/gauxc/xc_integrator/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,24 @@ typename XCIntegrator<MatrixType>::value_type

template <typename MatrixType>
typename XCIntegrator<MatrixType>::exc_vxc_type_rks
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& P ) {
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& P, const IntegratorSettingsEXCVXC& ks_settings ) {
if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
return pimpl_->eval_exc_vxc(P);
return pimpl_->eval_exc_vxc(P, ks_settings);
};

template <typename MatrixType>
typename XCIntegrator<MatrixType>::exc_vxc_type_uks
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz ) {
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const IntegratorSettingsEXCVXC& ks_settings ) {
if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
return pimpl_->eval_exc_vxc(Pscalar, Pz);
return pimpl_->eval_exc_vxc(Pscalar, Pz, ks_settings);
};

template <typename MatrixType>
typename XCIntegrator<MatrixType>::exc_vxc_type_gks
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py ) {
XCIntegrator<MatrixType>::eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py,
const IntegratorSettingsEXCVXC& ks_settings ) {
if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
return pimpl_->eval_exc_vxc(Pscalar, Pz, Px, Py);
return pimpl_->eval_exc_vxc(Pscalar, Pz, Px, Py, ks_settings);
};

template <typename MatrixType>
Expand Down
13 changes: 7 additions & 6 deletions include/gauxc/xc_integrator/replicated/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ typename ReplicatedXCIntegrator<MatrixType>::value_type

template <typename MatrixType>
typename ReplicatedXCIntegrator<MatrixType>::exc_vxc_type_rks
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& P ) {
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& P, const IntegratorSettingsEXCVXC& ks_settings ) {

if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
matrix_type VXC( P.rows(), P.cols() );
value_type EXC;

pimpl_->eval_exc_vxc( P.rows(), P.cols(), P.data(), P.rows(),
VXC.data(), VXC.rows(), &EXC );
VXC.data(), VXC.rows(), &EXC, ks_settings );

return std::make_tuple( EXC, VXC );

}

template <typename MatrixType>
typename ReplicatedXCIntegrator<MatrixType>::exc_vxc_type_uks
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& Pscalar, const MatrixType& Pz ) {
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& Pscalar, const MatrixType& Pz, const IntegratorSettingsEXCVXC& ks_settings ) {

if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
matrix_type VXCscalar( Pscalar.rows(), Pscalar.cols() );
Expand All @@ -88,15 +88,16 @@ typename ReplicatedXCIntegrator<MatrixType>::exc_vxc_type_uks
pimpl_->eval_exc_vxc( Pscalar.rows(), Pscalar.cols(), Pscalar.data(), Pscalar.rows(),
Pz.data(), Pz.rows(),
VXCscalar.data(), VXCscalar.rows(),
VXCz.data(), VXCz.rows(), &EXC );
VXCz.data(), VXCz.rows(), &EXC, ks_settings );

return std::make_tuple( EXC, VXCscalar, VXCz );

}

template <typename MatrixType>
typename ReplicatedXCIntegrator<MatrixType>::exc_vxc_type_gks
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py) {
ReplicatedXCIntegrator<MatrixType>::eval_exc_vxc_( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py,
const IntegratorSettingsEXCVXC& ks_settings) {

if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
matrix_type VXCscalar( Pscalar.rows(), Pscalar.cols() );
Expand All @@ -112,7 +113,7 @@ typename ReplicatedXCIntegrator<MatrixType>::exc_vxc_type_gks
VXCscalar.data(), VXCscalar.rows(),
VXCz.data(), VXCz.rows(),
VXCx.data(), VXCx.rows(),
VXCy.data(), VXCy.rows(), &EXC );
VXCy.data(), VXCy.rows(), &EXC, ks_settings );

return std::make_tuple( EXC, VXCscalar, VXCz, VXCx, VXCy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class ReplicatedXCIntegratorImpl {
int64_t ldp, value_type* N_EL ) = 0;
virtual void eval_exc_vxc_( int64_t m, int64_t n, const value_type* P,
int64_t ldp, value_type* VXC, int64_t ldvxc,
value_type* EXC ) = 0;
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings ) = 0;
virtual void eval_exc_vxc_( int64_t m, int64_t n, const value_type* Pscalar,
int64_t ldpscalar,
const value_type* Pz,
int64_t ldpz,
value_type* VXCscalar, int64_t ldvxcscalar,
value_type* VXCz, int64_t ldvxcz,
value_type* EXC ) = 0;
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings ) = 0;
virtual void eval_exc_vxc_( int64_t m, int64_t n, const value_type* Pscalar,
int64_t ldpscalar,
const value_type* Pz,
Expand All @@ -60,7 +60,7 @@ class ReplicatedXCIntegratorImpl {
value_type* VXCz, int64_t ldvxcz,
value_type* VXCx, int64_t ldvxcx,
value_type* VXCy, int64_t ldvxcy,
value_type* EXC ) = 0;
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings ) = 0;

virtual void eval_exc_grad_( int64_t m, int64_t n, const value_type* P,
int64_t ldp, value_type* EXC_GRAD ) = 0;
Expand All @@ -83,15 +83,15 @@ class ReplicatedXCIntegratorImpl {

void eval_exc_vxc( int64_t m, int64_t n, const value_type* P,
int64_t ldp, value_type* VXC, int64_t ldvxc,
value_type* EXC );
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings );

void eval_exc_vxc( int64_t m, int64_t n, const value_type* Pscalar,
int64_t ldpscalar,
const value_type* Pz,
int64_t ldpz,
value_type* VXCscalar, int64_t ldvxcscalar,
value_type* VXCz, int64_t ldvxcz,
value_type* EXC );
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings );
void eval_exc_vxc( int64_t m, int64_t n, const value_type* Pscalar,
int64_t ldpscalar,
const value_type* Pz,
Expand All @@ -104,7 +104,7 @@ class ReplicatedXCIntegratorImpl {
value_type* VXCz, int64_t ldvxcz,
value_type* VXCx, int64_t ldvxcx,
value_type* VXCy, int64_t ldvxcy,
value_type* EXC );
value_type* EXC, const IntegratorSettingsEXCVXC& ks_settings );


void eval_exc_grad( int64_t m, int64_t n, const value_type* P,
Expand Down
6 changes: 3 additions & 3 deletions include/gauxc/xc_integrator/replicated_xc_integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class ReplicatedXCIntegrator : public XCIntegratorImpl<MatrixType> {
std::unique_ptr< pimpl_type > pimpl_;

value_type integrate_den_( const MatrixType& ) override;
exc_vxc_type_rks eval_exc_vxc_ ( const MatrixType& ) override;
exc_vxc_type_uks eval_exc_vxc_ ( const MatrixType&, const MatrixType& ) override;
exc_vxc_type_gks eval_exc_vxc_ ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType& ) override;
exc_vxc_type_rks eval_exc_vxc_ ( const MatrixType&, const IntegratorSettingsEXCVXC& ) override;
exc_vxc_type_uks eval_exc_vxc_ ( const MatrixType&, const MatrixType&, const IntegratorSettingsEXCVXC&) override;
exc_vxc_type_gks eval_exc_vxc_ ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&, const IntegratorSettingsEXCVXC& ) override;
exc_grad_type eval_exc_grad_( const MatrixType& ) override;
exx_type eval_exx_ ( const MatrixType&, const IntegratorSettingsEXX& ) override;
const util::Timer& get_timings_() const override;
Expand Down
19 changes: 10 additions & 9 deletions include/gauxc/xc_integrator/xc_integrator_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ class XCIntegratorImpl {
protected:

virtual value_type integrate_den_( const MatrixType& P ) = 0;
virtual exc_vxc_type_rks eval_exc_vxc_ ( const MatrixType& P ) = 0;
virtual exc_vxc_type_uks eval_exc_vxc_ ( const MatrixType& Pscalar, const MatrixType& Pz ) = 0;
virtual exc_vxc_type_gks eval_exc_vxc_ ( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py ) = 0;
virtual exc_vxc_type_rks eval_exc_vxc_ ( const MatrixType& P, const IntegratorSettingsEXCVXC& ks_settings ) = 0;
virtual exc_vxc_type_uks eval_exc_vxc_ ( const MatrixType& Pscalar, const MatrixType& Pz, const IntegratorSettingsEXCVXC& ks_settings ) = 0;
virtual exc_vxc_type_gks eval_exc_vxc_ ( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py,
const IntegratorSettingsEXCVXC& ks_settings ) = 0;
virtual exc_grad_type eval_exc_grad_( const MatrixType& P ) = 0;
virtual exx_type eval_exx_ ( const MatrixType& P,
const IntegratorSettingsEXX& settings ) = 0;
Expand Down Expand Up @@ -64,16 +65,16 @@ class XCIntegratorImpl {
* @param[in] P The alpha density matrix
* @returns EXC / VXC in a combined structure
*/
exc_vxc_type_rks eval_exc_vxc( const MatrixType& P ) {
return eval_exc_vxc_(P);
exc_vxc_type_rks eval_exc_vxc( const MatrixType& P, const IntegratorSettingsEXCVXC& ks_settings ) {
return eval_exc_vxc_(P, ks_settings);
}

exc_vxc_type_uks eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz ) {
return eval_exc_vxc_(Pscalar, Pz);
exc_vxc_type_uks eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const IntegratorSettingsEXCVXC& ks_settings ) {
return eval_exc_vxc_(Pscalar, Pz, ks_settings);
}

exc_vxc_type_gks eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py ) {
return eval_exc_vxc_(Pscalar, Pz, Px, Py);
exc_vxc_type_gks eval_exc_vxc( const MatrixType& Pscalar, const MatrixType& Pz, const MatrixType& Px, const MatrixType& Py, const IntegratorSettingsEXCVXC& ks_settings ) {
return eval_exc_vxc_(Pscalar, Pz, Px, Py, ks_settings);
}

/** Integrate EXC gradient for RKS
Expand Down
5 changes: 5 additions & 0 deletions include/gauxc/xc_integrator_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ struct IntegratorSettingsSNLinK : public IntegratorSettingsEXX {
double k_tol = 1e-10;
};

struct IntegratorSettingsEXCVXC { virtual ~IntegratorSettingsEXCVXC() noexcept = default; };
wavefunction91 marked this conversation as resolved.
Show resolved Hide resolved
struct IntegratorSettingsKS : public IntegratorSettingsEXCVXC {
double gks_dtol = 1e-12;
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ void LocalHostWorkDriver::eval_uvvar_lda_uks( size_t npts, size_t nbe,
void LocalHostWorkDriver::eval_uvvar_lda_gks( size_t npts, size_t nbe,
const double* basis_eval, const double* Xs, size_t ldxs, const double* Xz,
size_t ldxz, const double* Xx, size_t ldxx, const double* Xy, size_t ldxy,
double* den_eval, double* K) {
double* den_eval, double* K, const double dtol) {

throw_if_invalid_pimpl(pimpl_);
pimpl_->eval_uvvar_lda_gks(npts, nbe, basis_eval, Xs, ldxs, Xz, ldxz, Xx, ldxx, Xy, ldxy, den_eval, K);
pimpl_->eval_uvvar_lda_gks(npts, nbe, basis_eval, Xs, ldxs, Xz, ldxz, Xx, ldxx, Xy, ldxy, den_eval, K, dtol);

}

Expand Down Expand Up @@ -191,12 +191,12 @@ void LocalHostWorkDriver::eval_uvvar_gga_gks( size_t npts, size_t nbe,
const double *dbasis_y_eval, const double* dbasis_z_eval, const double* Xs,
size_t ldxs, const double* Xz, size_t ldxz, const double* Xx, size_t ldxx,
const double* Xy, size_t ldxy, double* den_eval, double* dden_x_eval, double* dden_y_eval,
double* dden_z_eval, double* gamma, double* K, double* H ) {
double* dden_z_eval, double* gamma, double* K, double* H, const double dtol ) {

throw_if_invalid_pimpl(pimpl_);
pimpl_->eval_uvvar_gga_gks(npts, nbe, basis_eval, dbasis_x_eval, dbasis_y_eval,
dbasis_z_eval, Xs, ldxs, Xz, ldxz, Xx, ldxx, Xy, ldxy, den_eval, dden_x_eval, dden_y_eval, dden_z_eval,
gamma, K, H);
gamma, K, H, dtol);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class LocalHostWorkDriver : public LocalWorkDriver {

void eval_uvvar_lda_gks( size_t npts, size_t nbe, const double* basis_eval,
const double* Xs, size_t ldxs, const double* Xz, size_t ldxz,
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K);
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K, const double dtol);


/** Evaluate the U and V variavles for RKS GGA
Expand Down Expand Up @@ -248,7 +248,7 @@ class LocalHostWorkDriver : public LocalWorkDriver {
const double* dbasis_z_eval, const double* Xs, size_t ldxs,
const double* Xz, size_t ldxz, const double* Xx, size_t ldxx,
const double* Xy, size_t ldxy, double* den_eval,
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H );
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H, const double dtol );

/** Evaluate the VXC Z Matrix for RKS LDA
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct LocalHostWorkDriverPIMPL {
double* den_eval) = 0;
virtual void eval_uvvar_lda_gks( size_t npts, size_t nbe, const double* basis_eval,
const double* Xs, size_t ldxs, const double* Xz, size_t ldxz,
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K) = 0;
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K, const double dtol) = 0;

virtual void eval_uvvar_gga_rks( size_t npts, size_t nbe, const double* basis_eval,
const double* dbasis_x_eavl, const double *dbasis_y_eval,
Expand All @@ -91,7 +91,7 @@ struct LocalHostWorkDriverPIMPL {
const double* dbasis_z_eval, const double* Xs, size_t ldxs,
const double* Xz, size_t ldxz, const double* Xx, size_t ldxx,
const double* Xy, size_t ldxy, double* den_eval,
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H ) = 0;
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H, const double dtol) = 0;

virtual void eval_zmat_lda_vxc_rks( size_t npts, size_t nbe, const double* vrho,
const double* basis_eval, double* Z, size_t ldz ) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,14 @@ namespace GauXC {

void ReferenceLocalHostWorkDriver::eval_uvvar_lda_gks( size_t npts, size_t nbe, const double* basis_eval,
const double* Xs, size_t ldxs, const double* Xz, size_t ldxz,
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K) {
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy, double* den_eval, double* K, const double dtol) {


auto *K2 = K; // KZ // store K in the Z matrix
auto *K3 = K2 + npts;
auto *K4 = K3 + npts;

double dtolsq = dtol*dtol;

for( int32_t i = 0; i < (int32_t)npts; ++i ) {

Expand All @@ -170,7 +172,7 @@ namespace GauXC {
double mtemp = rhoz * rhoz + rhox * rhox + rhoy * rhoy;
double mnorm = 0;

if (mtemp > 1.0e-24) {
if (mtemp > dtolsq) {
mnorm = sqrt(mtemp);
K2[i] = rhoz / mnorm;
K3[i] = rhox / mnorm;
Expand Down Expand Up @@ -279,7 +281,7 @@ void ReferenceLocalHostWorkDriver::eval_uvvar_gga_gks( size_t npts, size_t nbe,
const double* dbasis_z_eval, const double* Xs, size_t ldxs,
const double* Xz, size_t ldxz, const double* Xx, size_t ldxx,
const double* Xy, size_t ldxy, double* den_eval,
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H ) {
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma, double* K, double* H, const double dtol) {

auto *K2 = K; // KZ // store K in the Z matrix
auto *K3 = K2 + npts;
Expand All @@ -289,6 +291,8 @@ void ReferenceLocalHostWorkDriver::eval_uvvar_gga_gks( size_t npts, size_t nbe,
auto *H3 = H2 + npts;
auto *H4 = H3 + npts;

double dtolsq = dtol*dtol;

for( int32_t i = 0; i < (int32_t)npts; ++i ) {

const size_t ioffs = size_t(i) * ldxs;
Expand Down Expand Up @@ -375,7 +379,7 @@ void ReferenceLocalHostWorkDriver::eval_uvvar_gga_gks( size_t npts, size_t nbe,
if (std::signbit(s_sum))
sign = -1.;

if (mtemp > 1.0e-24) {
if (mtemp > dtolsq) {
mnorm = sqrt(mtemp);
K2[i] = rhoz / mnorm;
K3[i] = rhox / mnorm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct ReferenceLocalHostWorkDriver : public detail::LocalHostWorkDriverPIMPL {
void eval_uvvar_lda_gks( size_t npts, size_t nbe, const double* basis_eval,
const double* Xs, size_t ldxs, const double* Xz, size_t ldxz,
const double* Xx, size_t ldxx, const double* Xy, size_t ldxy,
double* den_eval, double* K) override;
double* den_eval, double* K, const double dtol) override;

void eval_uvvar_gga_rks( size_t npts, size_t nbe, const double* basis_eval,
const double* dbasis_x_eval, const double *dbasis_y_eval,
Expand All @@ -94,7 +94,7 @@ struct ReferenceLocalHostWorkDriver : public detail::LocalHostWorkDriverPIMPL {
const double* Xz, size_t ldxz, const double* Xx, size_t ldxx,
const double* Xy, size_t ldxy, double* den_eval,
double* dden_x_eval, double* dden_y_eval, double* dden_z_eval, double* gamma,
double* K, double* H ) override;
double* K, double* H, const double dtol ) override;

void eval_zmat_lda_vxc_rks( size_t npts, size_t nbe, const double* vrho,
const double* basis_eval, double* Z, size_t ldz ) override;
Expand Down
Loading