MADNESS  0.10.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM > Class Template Reference

#include <exchangeoperator.h>

Collaboration diagram for madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >:
Collaboration graph
[legend]

Classes

class  MacroTaskExchangeSimple
 

Public Types

typedef Exchange< T, NDIM >::Algorithm Algorithm
 

Public Member Functions

 ExchangeImpl (World &world, const double lo, const double thresh)
 default ctor More...
 
 ExchangeImpl (World &world, const Nemo *nemo, const int ispin)
 ctor with a nemo calculation More...
 
 ExchangeImpl (World &world, const SCF *calc, const int ispin)
 ctor with a conventional calculation More...
 
std::string info () const
 
bool is_symmetric () const
 
vecfuncT operator() (const vecfuncT &vket) const
 apply the exchange operator on a vector of functions More...
 
ExchangeImplset_algorithm (const Algorithm &alg)
 
void set_bra_and_ket (const vecfuncT &bra, const vecfuncT &ket)
 set the bra and ket orbital spaces, and the occupation More...
 
ExchangeImplset_printlevel (const long &level)
 
ExchangeImplset_taskq (std::shared_ptr< MacroTaskQ > taskq1)
 
ExchangeImplsymmetric (const bool flag)
 

Static Public Member Functions

static auto set_poisson (World &world, const double lo, const double econv=FunctionDefaults< 3 >::get_thresh())
 

Public Attributes

Algorithm algorithm_ = multiworld_efficient
 

Private Types

typedef Function< T, NDIMfunctionT
 
typedef std::vector< functionTvecfuncT
 

Private Member Functions

bool do_print_timings () const
 
vecfuncT K_large_memory (const vecfuncT &vket, const double mul_tol=0.0) const
 computing the upper triangle of the double sum (over vket and the K orbitals) More...
 
vecfuncT K_macrotask_efficient (const vecfuncT &vket, const double mul_tol=0.0) const
 exchange using macrotasks, i.e. apply K on a function in individual worlds More...
 
vecfuncT K_small_memory (const vecfuncT &vket, const double mul_tol=0.0) const
 computing the full square of the double sum (over vket and the K orbitals) More...
 
bool printdebug () const
 

Static Private Member Functions

static vecfuncT compute_K_tile (World &world, const vecfuncT &mo_bra, const vecfuncT &mo_ket, const vecfuncT &vket, std::shared_ptr< real_convolution_3d > poisson, const bool symmetric, const double mul_tol=0.0)
 computing the upper triangle of the double sum (over vket and the K orbitals) More...
 
static void print_timer (World &world)
 
static void reset_timer ()
 

Private Attributes

double lo = 1.e-4
 
vecfuncT mo_bra
 is the exchange matrix symmetric? K phi_i = \sum_k \phi_k \int \phi_k \phi_i More...
 
vecfuncT mo_ket
 MOs for bra and ket. More...
 
double mul_tol = 0.0
 
long printlevel = 0
 
bool symmetric_ = false
 
std::shared_ptr< MacroTaskQtaskq
 
double thresh = FunctionDefaults<NDIM>::get_thresh()
 
Worldworld
 

Static Private Attributes

static std::atomic< long > apply_timer
 
static std::atomic< long > mul1_timer
 timing More...
 
static std::atomic< long > mul2_timer
 

Member Typedef Documentation

◆ Algorithm

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
typedef Exchange<T,NDIM>::Algorithm madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::Algorithm

◆ functionT

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
typedef Function<T, NDIM> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::functionT
private

◆ vecfuncT

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
typedef std::vector<functionT> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::vecfuncT
private

Constructor & Destructor Documentation

◆ ExchangeImpl() [1/3]

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::ExchangeImpl ( World world,
const double  lo,
const double  thresh 
)
inline

default ctor

◆ ExchangeImpl() [2/3]

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::ExchangeImpl ( World world,
const SCF calc,
const int  ispin 
)

◆ ExchangeImpl() [3/3]

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::ExchangeImpl ( World world,
const Nemo nemo,
const int  ispin 
)

Member Function Documentation

◆ compute_K_tile()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::compute_K_tile ( World world,
const vecfuncT mo_bra,
const vecfuncT mo_ket,
const vecfuncT vket,
std::shared_ptr< real_convolution_3d poisson,
const bool  symmetric,
const double  mul_tol = 0.0 
)
staticprivate

◆ do_print_timings()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
bool madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::do_print_timings ( ) const
inlineprivate

◆ info()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::string madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::info ( ) const
inline

◆ is_symmetric()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
bool madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::is_symmetric ( ) const
inline

◆ K_large_memory()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::K_large_memory ( const vecfuncT vket,
const double  mul_tol = 0.0 
) const
private

computing the upper triangle of the double sum (over vket and the K orbitals)

References madness::Exchange< T, NDIM >::is_symmetric(), lo, set_poisson(), and madness::truncate().

◆ K_macrotask_efficient()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::K_macrotask_efficient ( const vecfuncT vf,
const double  mul_tol = 0.0 
) const
private

exchange using macrotasks, i.e. apply K on a function in individual worlds

apply the exchange operator by tiling the exchange matrix

compute the matrix N_{ik} = N \phi_i \phi_k by tiles, with i,k \in batches A,B, do a local reduce within the tiles: K_{iB} = \sum_{k \in batch B} \phi_k N_{ik} and a universe-wide reduce of the tiles: K\phi_i = \sum_{batches B} K_{iB} saving up to half of the cpu time compared to the naive algorithm

Template Parameters
Tnumber type
NDIMphysical dimension of the argument vket
Parameters
vfargument of the exchange operator
mul_tolcutoff parameter for sparse multiplication
Returns
the exchange operator applied on vket

◆ K_small_memory()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::K_small_memory ( const vecfuncT vket,
const double  mul_tol = 0.0 
) const
private

computing the full square of the double sum (over vket and the K orbitals)

was vtol

was vtol

References madness::apply(), madness::gaxpy(), lo, madness::mul_sparse(), set_poisson(), and madness::truncate().

◆ operator()()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::vector< Function< T, NDIM > > madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::operator() ( const vecfuncT vket) const

apply the exchange operator on a vector of functions

note that only one spin is used (either alpha or beta orbitals)

Parameters
[in]vketthe orbitals |i> that the operator is applied on
Returns
a vector of orbitals K| i>

◆ print_timer()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
static void madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::print_timer ( World world)
inlinestaticprivate

◆ printdebug()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
bool madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::printdebug ( ) const
inlineprivate

◆ reset_timer()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
static void madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::reset_timer ( )
inlinestaticprivate

◆ set_algorithm()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
ExchangeImpl& madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::set_algorithm ( const Algorithm alg)
inline

◆ set_bra_and_ket()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
void madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::set_bra_and_ket ( const vecfuncT bra,
const vecfuncT ket 
)
inline

set the bra and ket orbital spaces, and the occupation

Parameters
[in]brabra space, must be provided as complex conjugate
[in]ketket space

References madness::copy().

◆ set_poisson()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
static auto madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::set_poisson ( World world,
const double  lo,
const double  econv = FunctionDefaults<3>::get_thresh() 
)
inlinestatic

◆ set_printlevel()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
ExchangeImpl& madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::set_printlevel ( const long &  level)
inline

◆ set_taskq()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
ExchangeImpl& madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::set_taskq ( std::shared_ptr< MacroTaskQ taskq1)
inline

◆ symmetric()

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
ExchangeImpl& madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::symmetric ( const bool  flag)
inline

Member Data Documentation

◆ algorithm_

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
Algorithm madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::algorithm_ = multiworld_efficient

◆ apply_timer

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::atomic<long> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::apply_timer
inlinestaticprivate

◆ lo

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
double madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::lo = 1.e-4
private

◆ mo_bra

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
vecfuncT madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::mo_bra
private

is the exchange matrix symmetric? K phi_i = \sum_k \phi_k \int \phi_k \phi_i

Referenced by madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::ExchangeImpl().

◆ mo_ket

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
vecfuncT madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::mo_ket
private

◆ mul1_timer

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::atomic<long> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::mul1_timer
inlinestaticprivate

timing

◆ mul2_timer

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::atomic<long> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::mul2_timer
inlinestaticprivate

◆ mul_tol

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
double madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::mul_tol = 0.0
private

◆ printlevel

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
long madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::printlevel = 0
private

◆ symmetric_

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
bool madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::symmetric_ = false
private

◆ taskq

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
std::shared_ptr<MacroTaskQ> madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::taskq
private

◆ thresh

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
double madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::thresh = FunctionDefaults<NDIM>::get_thresh()
private

◆ world

template<typename T , std::size_t NDIM>
template<typename T , std::size_t NDIM>
World& madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::world
private

The documentation for this class was generated from the following files: