Kindfield
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
Public Member Functions | Protected Attributes | List of all members
HermiteIntegral Class Reference

Sets up and solves the recurrence relations for R used in the Coulomb integrals. More...

#include <hermiteintegral.h>

Collaboration diagram for HermiteIntegral:
Collaboration graph
[legend]

Public Member Functions

 HermiteIntegral (int dimensionMax)
 
void reset (int dimension)
 
void set (double alpha, const Vector3 &A, int t, int u, int v)
 
void setupR (int t, int u, int v)
 
const cube & operator[] (const uword row) const
 
cube & operator[] (const uword row)
 
const cube & operator() (const uword row) const
 
cube & operator() (const uword row)
 
double operator() (const uword n, const uword t, const uword u, const uword v) const
 

Protected Attributes

double m_alpha
 
Vector3 m_A
 
field< cube > m_R
 
int m_dimensionMax
 
BoysFunction boysFunction
 

Detailed Description

Sets up and solves the recurrence relations for R used in the Coulomb integrals.

Definition at line 12 of file hermiteintegral.h.

Constructor & Destructor Documentation

HermiteIntegral::HermiteIntegral ( int  dimensionMax)

Definition at line 11 of file hermiteintegral.cpp.

11  :
12  m_alpha(0),
14  m_dimensionMax(dimensionMax)
15 {
16  reset(dimensionMax);
17 }

Member Function Documentation

const cube & HermiteIntegral::operator() ( const uword  row) const
inline

Definition at line 34 of file hermiteintegral.h.

34  {
35  return m_R(row);
36 }
cube & HermiteIntegral::operator() ( const uword  row)
inline

Definition at line 48 of file hermiteintegral.h.

49 {
50  return const_cast<cube&>(static_cast<const HermiteIntegral&>(*this)(row));
51 }
double HermiteIntegral::operator() ( const uword  n,
const uword  t,
const uword  u,
const uword  v 
) const
inline

Definition at line 38 of file hermiteintegral.h.

38  {
39  return m_R(n)(t,u,v);
40 }
const cube & HermiteIntegral::operator[] ( const uword  row) const
inline

Definition at line 42 of file hermiteintegral.h.

42  {
43  return m_R[row];
44 }
cube & HermiteIntegral::operator[] ( const uword  row)
inline

Definition at line 53 of file hermiteintegral.h.

54 {
55  return const_cast<cube&>(static_cast<const HermiteIntegral&>(*this)[row]);
56 }
void HermiteIntegral::reset ( int  dimension)

Definition at line 19 of file hermiteintegral.cpp.

20 {
21  m_dimensionMax = dimension;
22  int tMax = m_dimensionMax;
23  int nMax = m_dimensionMax;
24  m_R.reset();
25  // nMax + 1 because looking up element n = nMax requires a size of nMax + 1 to be available
26  m_R.set_size(nMax + 1);
27  for(int n = 0; n <= nMax; n++) {
28  m_R(n) = zeros(tMax + 1, tMax + 1, tMax + 1);
29  }
30 }
void HermiteIntegral::set ( double  alpha,
const Vector3 A,
int  t,
int  u,
int  v 
)

Definition at line 32 of file hermiteintegral.cpp.

34 {
35  m_alpha = alpha;
36  m_A = A;
37  setupR(t, u, v);
38 }
void HermiteIntegral::setupR ( int  t,
int  u,
int  v 
)

Definition at line 40 of file hermiteintegral.cpp.

40  {
41  const Vector3 &PC = m_A;
42  double p = m_alpha;
43  double boysArg = p * dot(m_A, m_A);
44  int tuvSumMax = tin + uin + vin;
45  int nMax = tin + uin + vin;
46  boysFunction.set(boysArg, nMax);
47  // Calculate R0_tuv
48  double powResult = 1;
49  m_R(0)(0,0,0) = boysFunction.result(0);
50  for(int n = 1; n <= nMax; n++) {
51  powResult *= -2*p;
52  m_R(n)(0,0,0) = powResult * boysFunction.result(n);
53  }
54  // Iterate over all elements with t + u + v = tuvSum (slide 36)
55  for(int tuvSum = 1; tuvSum <= tuvSumMax; tuvSum++) {
56  for(int n = 0; n <= nMax - tuvSum; n++) {
57  for(int t = 0; t <= tin; t++) {
58  for(int u = 0; u <= uin; u++) {
59  for(int v = 0; v <= vin; v++) {
60  if(t + u + v != tuvSum || t + u + v == 0) {
61  continue;
62  }
63  int largestElement = max(t,max(u,v));
64  // Needed indices
65  int t2 = t;
66  int u2 = u;
67  int v2 = v;
68  int t3 = t;
69  int u3 = u;
70  int v3 = v;
71  // Resulting factors
72  int factor2 = t;
73  double factor3 = PC(0);
74  // Choose indices based on method (slide 34)
75  if(largestElement == t) {
76  t2 = t - 2;
77  t3 = t - 1;
78  factor2 = t - 1;
79  factor3 = PC(0);
80  } else if(largestElement == u) {
81  u2 = u - 2;
82  u3 = u - 1;
83  factor2 = u - 1;
84  factor3 = PC(1);
85  } else {
86  v2 = v - 2;
87  v3 = v - 1;
88  factor2 = v - 1;
89  factor3 = PC(2);
90  }
91  double currentValue = 0;
92  if(t2 >= 0 && u2 >= 0 && v2 >= 0) {
93  currentValue += factor2 * m_R(n+1)(t2, u2, v2);
94  }
95  if(t3 >= 0 && u3 >= 0 && v3 >= 0) {
96  currentValue += factor3 * m_R(n+1)(t3, u3, v3);
97  }
98  m_R(n)(t, u, v) = currentValue;
99  }
100  }
101  }
102  }
103  }
104 }

Member Data Documentation

BoysFunction HermiteIntegral::boysFunction
protected

Definition at line 31 of file hermiteintegral.h.

Vector3 HermiteIntegral::m_A
protected

Definition at line 28 of file hermiteintegral.h.

double HermiteIntegral::m_alpha
protected

Definition at line 27 of file hermiteintegral.h.

int HermiteIntegral::m_dimensionMax
protected

Definition at line 30 of file hermiteintegral.h.

field<cube> HermiteIntegral::m_R
protected

Definition at line 29 of file hermiteintegral.h.


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