Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions include/gauxc/xc_integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class XCIntegrator {
using exx_type = matrix_type;
using fxc_contraction_type_rks = matrix_type;
using fxc_contraction_type_uks = std::tuple< matrix_type, matrix_type >;
using fxc_contraction_type_gks = std::tuple< matrix_type, matrix_type, matrix_type, matrix_type >;
using dd_psi_type = std::vector< value_type >;
using dd_psi_potential_type = matrix_type;

Expand Down Expand Up @@ -80,10 +81,22 @@ class XCIntegrator {
exx_type eval_exx ( const MatrixType&,
const IntegratorSettingsEXX& = IntegratorSettingsEXX{} );

/**
* @brief Contract the XC kernel with a trial density matrix.
*
* RKS: eval_fxc_contraction( P, tP ).
* UKS: eval_fxc_contraction( Ps, Pz, tPs, tPz ), returning ( FXCs, FXCz ).
* GKS: eval_fxc_contraction( Ps, Pz, Py, Px, tPs, tPz, tPy, tPx ), returning
* ( FXCs, FXCz, FXCy, FXCx ), in the argument order of the GKS
* eval_exc_vxc. LDA only.
*/
fxc_contraction_type_rks eval_fxc_contraction ( const MatrixType&, const MatrixType&,
const IntegratorSettingsXC& = IntegratorSettingsXC{} );
fxc_contraction_type_uks eval_fxc_contraction ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&,
const IntegratorSettingsXC& = IntegratorSettingsXC{} );
fxc_contraction_type_gks eval_fxc_contraction ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&,
const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&,
const IntegratorSettingsXC& = IntegratorSettingsXC{} );

dd_psi_type eval_dd_psi( const MatrixType&, unsigned );
dd_psi_potential_type eval_dd_psi_potential( const MatrixType&, unsigned );
Expand Down
9 changes: 9 additions & 0 deletions include/gauxc/xc_integrator/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ typename XCIntegrator<MatrixType>::fxc_contraction_type_uks
return pimpl_->eval_fxc_contraction(Ps, Pz, tPs, tPz, ks_settings);
};

template <typename MatrixType>
typename XCIntegrator<MatrixType>::fxc_contraction_type_gks
XCIntegrator<MatrixType>::eval_fxc_contraction( const MatrixType& Ps, const MatrixType& Pz, const MatrixType& Py, const MatrixType& Px,
const MatrixType& tPs, const MatrixType& tPz, const MatrixType& tPy, const MatrixType& tPx,
const IntegratorSettingsXC& ks_settings ) {
if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
return pimpl_->eval_fxc_contraction(Ps, Pz, Py, Px, tPs, tPz, tPy, tPx, ks_settings);
};

template <typename MatrixType>
typename XCIntegrator<MatrixType>::dd_psi_type
XCIntegrator<MatrixType>::eval_dd_psi(const MatrixType& P, unsigned max_Ylm) {
Expand Down
20 changes: 20 additions & 0 deletions include/gauxc/xc_integrator/replicated/impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,26 @@ typename ReplicatedXCIntegrator<MatrixType>::fxc_contraction_type_uks

}

template <typename MatrixType>
typename ReplicatedXCIntegrator<MatrixType>::fxc_contraction_type_gks
ReplicatedXCIntegrator<MatrixType>::eval_fxc_contraction_( const MatrixType& Ps, const MatrixType& Pz, const MatrixType& Py, const MatrixType& Px,
const MatrixType& tPs, const MatrixType& tPz, const MatrixType& tPy, const MatrixType& tPx,
const IntegratorSettingsXC& ks_settings ) {

if( not pimpl_ ) GAUXC_PIMPL_NOT_INITIALIZED();
matrix_type FXCs( Ps.rows(), Ps.cols() ), FXCz( Pz.rows(), Pz.cols() );
matrix_type FXCy( Py.rows(), Py.cols() ), FXCx( Px.rows(), Px.cols() );

pimpl_->eval_fxc_contraction( Ps.rows(), Ps.cols(),
Ps.data(), Ps.rows(), Pz.data(), Pz.rows(), Py.data(), Py.rows(), Px.data(), Px.rows(),
tPs.data(), tPs.rows(), tPz.data(), tPz.rows(), tPy.data(), tPy.rows(), tPx.data(), tPx.rows(),
FXCs.data(), FXCs.rows(), FXCz.data(), FXCz.rows(), FXCy.data(), FXCy.rows(), FXCx.data(), FXCx.rows(),
ks_settings );

return std::make_tuple( FXCs, FXCz, FXCy, FXCx );

}

template <typename MatrixType>
typename ReplicatedXCIntegrator<MatrixType>::dd_psi_type
ReplicatedXCIntegrator<MatrixType>::eval_dd_psi_( const MatrixType& P, unsigned max_Ylm ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ class ReplicatedXCIntegratorImpl {
value_type* FXCs, int64_t ldfxcs,
value_type* FXCz, int64_t ldfxcz,
const IntegratorSettingsXC& ks_settings )=0;
// GKS: not pure, so the device integrators need no stub
virtual void eval_fxc_contraction_( int64_t m, int64_t n,
const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz,
const value_type* Py, int64_t ldpy, const value_type* Px, int64_t ldpx,
const value_type* tPs, int64_t ldtps, const value_type* tPz, int64_t ldtpz,
const value_type* tPy, int64_t ldtpy, const value_type* tPx, int64_t ldtpx,
value_type* FXCs, int64_t ldfxcs, value_type* FXCz, int64_t ldfxcz,
value_type* FXCy, int64_t ldfxcy, value_type* FXCx, int64_t ldfxcx,
const IntegratorSettingsXC& ) {
GAUXC_GENERIC_EXCEPTION("GKS FXC Contraction Not Implemented For This Integrator");
}
virtual void eval_dd_psi_( int64_t m, int64_t n, const value_type* P, int64_t ldp, unsigned max_Ylm,
value_type* ddPsi, int64_t ldPsi ) = 0;
virtual void eval_dd_psi_potential_( int64_t m, int64_t n, const value_type* X, unsigned max_Ylm,
Expand Down Expand Up @@ -177,6 +188,15 @@ class ReplicatedXCIntegratorImpl {
value_type* FXCz, int64_t ldfxcz,
const IntegratorSettingsXC& ks_settings );

void eval_fxc_contraction( int64_t m, int64_t n,
const value_type* Ps, int64_t ldps, const value_type* Pz, int64_t ldpz,
const value_type* Py, int64_t ldpy, const value_type* Px, int64_t ldpx,
const value_type* tPs, int64_t ldtps, const value_type* tPz, int64_t ldtpz,
const value_type* tPy, int64_t ldtpy, const value_type* tPx, int64_t ldtpx,
value_type* FXCs, int64_t ldfxcs, value_type* FXCz, int64_t ldfxcz,
value_type* FXCy, int64_t ldfxcy, value_type* FXCx, int64_t ldfxcx,
const IntegratorSettingsXC& ks_settings );

void eval_dd_psi( int64_t m, int64_t n, const value_type* P,
int64_t ldp, unsigned max_Ylm,
value_type* ddPsi, int64_t ldPsi );
Expand Down
3 changes: 3 additions & 0 deletions include/gauxc/xc_integrator/replicated_xc_integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ReplicatedXCIntegrator : public XCIntegratorImpl<MatrixType> {
using exx_type = typename XCIntegratorImpl<MatrixType>::exx_type;
using fxc_contraction_type_rks = typename XCIntegratorImpl<MatrixType>::fxc_contraction_type_rks;
using fxc_contraction_type_uks = typename XCIntegratorImpl<MatrixType>::fxc_contraction_type_uks;
using fxc_contraction_type_gks = typename XCIntegratorImpl<MatrixType>::fxc_contraction_type_gks;
using dd_psi_type = typename XCIntegratorImpl<MatrixType>::dd_psi_type;
using dd_psi_potential_type = typename XCIntegratorImpl<MatrixType>::dd_psi_potential_type;

Expand All @@ -59,6 +60,8 @@ class ReplicatedXCIntegrator : public XCIntegratorImpl<MatrixType> {
exx_type eval_exx_ ( const MatrixType&, const IntegratorSettingsEXX& ) override;
fxc_contraction_type_rks eval_fxc_contraction_ ( const MatrixType&, const MatrixType&, const IntegratorSettingsXC& ) override;
fxc_contraction_type_uks eval_fxc_contraction_ ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&, const IntegratorSettingsXC&) override;
fxc_contraction_type_gks eval_fxc_contraction_ ( const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&,
const MatrixType&, const MatrixType&, const MatrixType&, const MatrixType&, const IntegratorSettingsXC&) override;
dd_psi_type eval_dd_psi_( const MatrixType& , unsigned ) override;
dd_psi_potential_type eval_dd_psi_potential_( const MatrixType& , unsigned ) override;
const util::Timer& get_timings_() const override;
Expand Down
16 changes: 16 additions & 0 deletions include/gauxc/xc_integrator/xc_integrator_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class XCIntegratorImpl {
using exx_type = typename XCIntegrator<MatrixType>::exx_type;
using fxc_contraction_type_rks = typename XCIntegrator<MatrixType>::fxc_contraction_type_rks;
using fxc_contraction_type_uks = typename XCIntegrator<MatrixType>::fxc_contraction_type_uks;
using fxc_contraction_type_gks = typename XCIntegrator<MatrixType>::fxc_contraction_type_gks;
using dd_psi_type = typename XCIntegrator<MatrixType>::dd_psi_type;
using dd_psi_potential_type = typename XCIntegrator<MatrixType>::dd_psi_potential_type;

Expand All @@ -54,6 +55,12 @@ class XCIntegratorImpl {
const MatrixType& tP, const IntegratorSettingsXC& ks_settings ) = 0;
virtual fxc_contraction_type_uks eval_fxc_contraction_ ( const MatrixType& Ps, const MatrixType& Pz,
const MatrixType& tPs, const MatrixType& tPz, const IntegratorSettingsXC& ks_settings ) = 0;
// GKS: not pure, so integrators without it (the device ones) need no stub
virtual fxc_contraction_type_gks eval_fxc_contraction_ ( const MatrixType& Ps, const MatrixType& Pz, const MatrixType& Py, const MatrixType& Px,
const MatrixType& tPs, const MatrixType& tPz, const MatrixType& tPy, const MatrixType& tPx,
const IntegratorSettingsXC& ) {
GAUXC_GENERIC_EXCEPTION("GKS FXC Contraction Not Implemented For This Integrator");
}


virtual dd_psi_type eval_dd_psi_( const MatrixType& P, unsigned max_Ylm ) = 0;
Expand Down Expand Up @@ -175,6 +182,15 @@ class XCIntegratorImpl {
return eval_fxc_contraction_(Ps, Pz, tPs, tPz, ks_settings);
}

/** Evaluate the GKS FXC contraction (LDA only), returning
* ( FXCs, FXCz, FXCy, FXCx ).
*/
fxc_contraction_type_gks eval_fxc_contraction( const MatrixType& Ps, const MatrixType& Pz, const MatrixType& Py, const MatrixType& Px,
const MatrixType& tPs, const MatrixType& tPz, const MatrixType& tPy, const MatrixType& tPx,
const IntegratorSettingsXC& ks_settings ) {
return eval_fxc_contraction_(Ps, Pz, Py, Px, tPs, tPz, tPy, tPx, ks_settings);
}

/** Evaluate Psi vector for ddX
*
* @param[in] P The density matrix
Expand Down
Loading