Psi4
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
psi::ERISieve Class Reference

#include <sieve.h>

Public Member Functions

 ERISieve (std::shared_ptr< BasisSet > primary, double sieve=0.0)
 Constructor, basis set and first sieve cutoff. More...
 
virtual ~ERISieve ()
 Destructor, frees memory. More...
 
void set_sieve (double sieve)
 Set sieve value and redo indexing. More...
 
double sieve () const
 Get sieve cutoff value. More...
 
double max () const
 Global maximum |(mn|rs)|. More...
 
double shell_ceiling2 (int M, int N, int R, int S)
 Square of ceiling of shell quartet (MN|RS) More...
 
double function_ceiling2 (int m, int n, int r, int s)
 Square of ceiling of integral (mn|rs) More...
 
bool shell_significant (int M, int N, int R, int S)
 Is the shell quartet (MN|RS) significant according to sieve? (no restriction on MNRS order) More...
 
bool shell_significant_qqr (int M, int N, int R, int S)
 
bool function_significant (int m, int n, int r, int s)
 Is the integral (mn|rs) significant according to sieve? (no restriction on mnrs order) More...
 
bool shell_pair_significant (int M, int N)
 Is the shell pair (MN| ever significant according to sieve (no restriction on MN order) More...
 
bool function_pair_significant (int m, int n)
 Is the function pair (mn| ever significant according to sieve (no restriction on mn order) More...
 
const std::vector< std::pair
< int, int > > & 
function_pairs () const
 Significant unique bra- function pairs, in reduced triangular indexing. More...
 
const std::vector< std::pair
< int, int > > & 
shell_pairs () const
 Significant unique bra- shell pairs, in reduced triangular indexing. More...
 
const std::vector< long int > function_pairs_reverse () const
 Unique bra- function pair indexing, accessed in triangular order, or -1 for non-significant pair. More...
 
const std::vector< long int > shell_pairs_reverse () const
 Unique bra- shell pair indexing, accessed in triangular order, or -1 for non-significant pair. More...
 
const std::vector< std::vector
< int > > & 
function_to_function () const
 Significant function pairs, indexes by function. More...
 
const std::vector< std::vector
< int > > & 
shell_to_shell () const
 Significant shell pairs, indexes by shell. More...
 
double shell_pair_value (int m, int n) const
 
std::vector< double > shell_pair_values ()
 
std::vector< double > function_pair_values ()
 
void set_debug (int debug)
 Set debug flag (defaults to 0) More...
 

Protected Member Functions

void common_init ()
 Set initial indexing. More...
 
void integrals ()
 Compute sieve integrals (only done once) More...
 

Protected Attributes

int debug_
 Debug flag (defaults to 0) More...
 
std::shared_ptr< BasisSetprimary_
 Basis set reference. More...
 
int nbf_
 Number of basis functions. More...
 
int nshell_
 Number of shells. More...
 
double sieve_
 Cutoff values. More...
 
double max_
 Maximum |(mn|ls)|. More...
 
double sieve_over_max_
 sieve_ / max_ More...
 
double sieve2_
 sieve_ * sieve_ More...
 
double sieve2_over_max_
 sieve_ * sieve_ / max_ More...
 
std::vector< double > function_pair_values_
 |(mn|mn)| values (nbf * nbf) More...
 
std::vector< double > shell_pair_values_
 max |(MN|MN)| values (nshell * nshell) More...
 
std::vector< std::pair< int,
int > > 
function_pairs_
 Significant unique bra- function pairs, in reduced triangular indexing. More...
 
std::vector< std::pair< int,
int > > 
shell_pairs_
 Significant unique bra- shell pairs, in reduced triangular indexing. More...
 
std::vector< long int > function_pairs_reverse_
 Unique bra- function pair indexing, accessed in triangular order, or -1 for non-significant pair. More...
 
std::vector< long int > shell_pairs_reverse_
 Unique bra- shell pair indexing, accessed in triangular order, or -1 for non-significant pair. More...
 
std::vector< std::vector< int > > shell_to_shell_
 Significant function pairs, indexes by function. More...
 
std::vector< std::vector< int > > function_to_function_
 Significant shell pairs, indexes by shell. More...
 
bool do_qqr_
 
double erfc_thresh_
 
std::vector< Vector3contracted_centers_
 
std::vector< double > extents_
 

Detailed Description

ERISieve

Class to perform ERI sieving

At the moment, this class uses Cauchy-Schwarz sieving, and is designed to be used in concert with density-based sieving. In the future, it is hoped that MBIE sieving may be added to this class.

Use of this class is as follows:

// Initialize the sieve object
std::shared_ptr<ERISieve> sieve(basisset, sieve_cutoff);

// Reset the sieve cutoff (you can do this wherever)
sieve->set_sieve(new_cutoff);

...

// Investigate stuff. This example is for shells, all methods are
// also provided for functions

// Compute a shell quartet (MN|RS), if (MN|RS) >= sieve_cutoff
if (sieve->shell_significant(M,N,R,S)) eri->compute(M,N,R,S);

// Compute a shell quartet (MN|RS), if (MN|RS) * D_RS >= sieve_cutoff
// Squares are used to avoid sqrt()
if (sieve->shell_ceiling2(M,N,R,S) * D_RS * D_RS >= sieve_cutoff * sieve_cutoff)
    eri->compute(M,N,R,S);

// Index the significant MN shell pairs (triangular M,N)
const std::vector<std::pair<int,int> >& MN = sieve->shell_pairs();
for (long int index = 0L; index < MN.size(); ++index) {
    int M = MN[index].first;
    int N = MN[index].second;
}

// Check if a triangular index MNindex (M * (M + 1) / 2) + N exists,
// and if so, where it starts in reduced triangular MN
int MNindex = (M * (M + 1) >> 1) + N;
const std::vector<long int> >& MN_reverse = sieve->shell_pairs_reverse();
int MNreduced = MN_reverse[MNindex];
if (MNreduced < 0) {
    // The shell pair is not signficant
} else {
    // The shell pair is the MNreduced significant shell pair

Constructor & Destructor Documentation

psi::ERISieve::ERISieve ( std::shared_ptr< BasisSet primary,
double  sieve = 0.0 
)

Constructor, basis set and first sieve cutoff.

psi::ERISieve::~ERISieve ( )
virtual

Destructor, frees memory.

Member Function Documentation

void psi::ERISieve::common_init ( void  )
protected

Set initial indexing.

double psi::ERISieve::function_ceiling2 ( int  m,
int  n,
int  r,
int  s 
)
inline

Square of ceiling of integral (mn|rs)

bool psi::ERISieve::function_pair_significant ( int  m,
int  n 
)
inline

Is the function pair (mn| ever significant according to sieve (no restriction on mn order)

std::vector<double> psi::ERISieve::function_pair_values ( )
inline
const std::vector<std::pair<int,int> >& psi::ERISieve::function_pairs ( ) const
inline

Significant unique bra- function pairs, in reduced triangular indexing.

const std::vector<long int> psi::ERISieve::function_pairs_reverse ( ) const
inline

Unique bra- function pair indexing, accessed in triangular order, or -1 for non-significant pair.

bool psi::ERISieve::function_significant ( int  m,
int  n,
int  r,
int  s 
)
inline

Is the integral (mn|rs) significant according to sieve? (no restriction on mnrs order)

const std::vector<std::vector<int> >& psi::ERISieve::function_to_function ( ) const
inline

Significant function pairs, indexes by function.

void psi::ERISieve::integrals ( )
protected

Compute sieve integrals (only done once)

double psi::ERISieve::max ( ) const
inline

Global maximum |(mn|rs)|.

void psi::ERISieve::set_debug ( int  debug)
inline

Set debug flag (defaults to 0)

void psi::ERISieve::set_sieve ( double  sieve)

Set sieve value and redo indexing.

double psi::ERISieve::shell_ceiling2 ( int  M,
int  N,
int  R,
int  S 
)
inline

Square of ceiling of shell quartet (MN|RS)

bool psi::ERISieve::shell_pair_significant ( int  M,
int  N 
)
inline

Is the shell pair (MN| ever significant according to sieve (no restriction on MN order)

double psi::ERISieve::shell_pair_value ( int  m,
int  n 
) const
std::vector<double> psi::ERISieve::shell_pair_values ( )
inline
const std::vector<std::pair<int,int> >& psi::ERISieve::shell_pairs ( ) const
inline

Significant unique bra- shell pairs, in reduced triangular indexing.

const std::vector<long int> psi::ERISieve::shell_pairs_reverse ( ) const
inline

Unique bra- shell pair indexing, accessed in triangular order, or -1 for non-significant pair.

bool psi::ERISieve::shell_significant ( int  M,
int  N,
int  R,
int  S 
)
inline

Is the shell quartet (MN|RS) significant according to sieve? (no restriction on MNRS order)

bool psi::ERISieve::shell_significant_qqr ( int  M,
int  N,
int  R,
int  S 
)
const std::vector<std::vector<int> >& psi::ERISieve::shell_to_shell ( ) const
inline

Significant shell pairs, indexes by shell.

double psi::ERISieve::sieve ( ) const
inline

Get sieve cutoff value.

Member Data Documentation

std::vector<Vector3> psi::ERISieve::contracted_centers_
protected
int psi::ERISieve::debug_
protected

Debug flag (defaults to 0)

bool psi::ERISieve::do_qqr_
protected
double psi::ERISieve::erfc_thresh_
protected
std::vector<double> psi::ERISieve::extents_
protected
std::vector<double> psi::ERISieve::function_pair_values_
protected

|(mn|mn)| values (nbf * nbf)

std::vector<std::pair<int,int> > psi::ERISieve::function_pairs_
protected

Significant unique bra- function pairs, in reduced triangular indexing.

std::vector<long int> psi::ERISieve::function_pairs_reverse_
protected

Unique bra- function pair indexing, accessed in triangular order, or -1 for non-significant pair.

std::vector<std::vector<int> > psi::ERISieve::function_to_function_
protected

Significant shell pairs, indexes by shell.

double psi::ERISieve::max_
protected

Maximum |(mn|ls)|.

int psi::ERISieve::nbf_
protected

Number of basis functions.

int psi::ERISieve::nshell_
protected

Number of shells.

std::shared_ptr<BasisSet> psi::ERISieve::primary_
protected

Basis set reference.

std::vector<double> psi::ERISieve::shell_pair_values_
protected

max |(MN|MN)| values (nshell * nshell)

std::vector<std::pair<int,int> > psi::ERISieve::shell_pairs_
protected

Significant unique bra- shell pairs, in reduced triangular indexing.

std::vector<long int> psi::ERISieve::shell_pairs_reverse_
protected

Unique bra- shell pair indexing, accessed in triangular order, or -1 for non-significant pair.

std::vector<std::vector<int> > psi::ERISieve::shell_to_shell_
protected

Significant function pairs, indexes by function.

double psi::ERISieve::sieve2_
protected

sieve_ * sieve_

double psi::ERISieve::sieve2_over_max_
protected

sieve_ * sieve_ / max_

double psi::ERISieve::sieve_
protected

Cutoff values.

double psi::ERISieve::sieve_over_max_
protected

sieve_ / max_


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