ERKALE
ERKALE - DFT from Hel
 All Classes Functions Variables Friends Pages
eriworker.h
1 /*
2  * This source code is part of
3  *
4  * E R K A L E
5  * -
6  * DFT from Hel
7  *
8  * Written by Susi Lehtola, 2010-2013
9  * Copyright (c) 2010-2013, Susi Lehtola
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  */
16 
17 
18 #ifndef ERIWORKER_H
19 #define ERIWORKER_H
20 
21 // To debug derivatives
22 //#define DEBUGDERIV
23 
24 #include <vector>
25 // Needed to define contr_t
26 #include "basis.h"
27 
28 #include <libint/libint.h>
29 #include <libderiv/libderiv.h>
30 
32 typedef struct {
34  arma::vec AB;
36  arma::mat zeta;
38  arma::cube P;
40  arma::cube PA;
42  arma::cube PB;
44  std::vector<contr_t> ic;
46  std::vector<contr_t> jc;
48  arma::mat S;
50 
53  protected:
55  std::vector<double> arrone;
57  std::vector<double> arrtwo;
58 
60  std::vector<double> * input;
62  std::vector<double> * output;
63 
65  arma::vec Gn;
66 
68  virtual void compute_G(double rho, double T, int nmax);
69 
71  void reorder(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls, bool swap_ij, bool swap_kl, bool swap_ijkl);
72 
74  void spherical_transform(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
76  void transform_i(int am, size_t Nj, size_t Nk, size_t Nl);
78  void transform_j(int am, size_t Ni, size_t Nk, size_t Nl);
80  void transform_k(int am, size_t Ni, size_t Nj, size_t Nl);
82  void transform_l(int am, size_t Ni, size_t Nj, size_t Nk);
83 
86 
87  public:
89  virtual ~IntegralWorker();
90 };
91 
93 class ERIWorker: public IntegralWorker {
95  Libint_t libint;
96 
98  void compute_cartesian(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
100  void compute_cartesian_debug(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
102  void compute_libint_data(const eri_precursor_t & ip, const eri_precursor_t & jp, int mmax);
103 
104  public:
106  ERIWorker(int maxam, int maxcontr);
108  virtual ~ERIWorker();
109 
111  void compute(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
113  void compute_debug(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
115  std::vector<double> get() const;
117  const std::vector<double> * getp() const;
118 };
119 
121 class dERIWorker: public IntegralWorker {
123  Libderiv_t libderiv;
124 
126  void compute_cartesian();
128  void compute_libderiv_data(const eri_precursor_t & ip, const eri_precursor_t & jp, int mmax);
129 
130  // Pointers to the current shells
132  const GaussianShell *is, *is_orig;
134  const GaussianShell *js, *js_orig;
136  const GaussianShell *ks, *ks_orig;
138  const GaussianShell *ls, *ls_orig;
140  bool swap_ij, swap_kl, swap_ijkl;
141 
143  void get_idx(int idx);
144 
145  public:
146  dERIWorker(int maxam, int maxcontr);
147  virtual ~dERIWorker();
148 
150  void compute(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls);
152  std::vector<double> get(int idx);
154  const std::vector<double> * getp(int idx);
155 
157  std::vector<double> get_debug(int idx);
158 };
159 
161 class ERIWorker_srlr: public ERIWorker {
163  void compute_G(double rho, double T, int nmax);
164 
166  double omega;
168  double alpha;
170  double beta;
171 
173  arma::vec bf_short, bf_long;
174 
175  public:
177  ERIWorker_srlr(int maxam, int maxcontr, double omega, double alpha, double beta);
179  ~ERIWorker_srlr();
180 };
181 
185  void compute_G(double rho, double T, int nmax);
186 
188  double omega;
190  double alpha;
192  double beta;
193 
195  arma::vec bf_short, bf_long;
196 
197  public:
198  dERIWorker_srlr(int maxam, int maxcontr, double omega, double alpha, double beta);
199  ~dERIWorker_srlr();
200 };
201 
202 
203 #endif
void compute_libderiv_data(const eri_precursor_t &ip, const eri_precursor_t &jp, int mmax)
Compute data for libderiv.
Definition: eriworker.cpp:1056
A shell of Gaussian basis functions of a given angular momentum, sharing the same exponential contrac...
Definition: basis.h:482
std::vector< double > arrtwo
Storage arrays (operated through pointer)
Definition: eriworker.h:57
std::vector< contr_t > jc
Array of exponents for second center (Nb)
Definition: eriworker.h:46
ERIWorker(int maxam, int maxcontr)
Constructor.
Definition: eriworker.cpp:73
arma::cube PB
Distance between P and shell j center (Na,Nb,3)
Definition: eriworker.h:42
void compute_cartesian(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Compute the cartesian ERIs.
Definition: eriworker.cpp:104
void transform_j(int am, size_t Ni, size_t Nk, size_t Nl)
Do spherical transform with respect to second index.
void compute_cartesian_debug(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Compute the cartesian ERIs using Huzinaga routines.
Definition: eriworker.cpp:1198
double beta
Factor of short-range exchange.
Definition: eriworker.h:192
const GaussianShell * is
1st shell
Definition: eriworker.h:132
arma::mat zeta
Sum of exponents (Na,Nb)
Definition: eriworker.h:36
const GaussianShell * js
2nd shell
Definition: eriworker.h:134
arma::vec bf_short
Short and long range Boys functions.
Definition: eriworker.h:195
std::vector< double > * output
Output array.
Definition: eriworker.h:62
double omega
Range separation constant.
Definition: eriworker.h:166
double omega
Range separation constant.
Definition: eriworker.h:188
arma::mat S
Overlap of primitives on i and j (Na,Nb)
Definition: eriworker.h:48
void transform_k(int am, size_t Ni, size_t Nj, size_t Nl)
Do spherical transform with respect to third index.
Worker for computing short- and long-range electron repulsion integrals.
Definition: eriworker.h:161
std::vector< double > get_debug(int idx)
Compute the derivatives, debug version.
Definition: eriworker.cpp:387
std::vector< contr_t > ic
Contraction for first center (Na)
Definition: eriworker.h:44
ERIWorker_srlr(int maxam, int maxcontr, double omega, double alpha, double beta)
Constructor.
Definition: eriworker.cpp:1421
double beta
Weight for short-range exchange.
Definition: eriworker.h:170
arma::vec AB
Distance between centers A and B.
Definition: eriworker.h:34
arma::vec bf_short
Short and long range Boys functions.
Definition: eriworker.h:173
arma::cube P
Coordinates of center of product gaussian P, dimension (Na,Nb,3)
Definition: eriworker.h:38
const GaussianShell * ks
3rd shell
Definition: eriworker.h:136
arma::vec Gn
Integral kernel (i.e. Boys&#39; function for Coulomb integrals)
Definition: eriworker.h:65
void get_idx(int idx)
Get the idx&#39;th derivative in the input array.
Definition: eriworker.cpp:273
Worker for computing short- and long-range electron repulsion integrals.
Definition: eriworker.h:183
Libint_t libint
Libint worker.
Definition: eriworker.h:95
void compute_G(double rho, double T, int nmax)
Compute the kernel.
Definition: eriworker.cpp:1464
void compute_cartesian()
Compute the cartesian ERI derivatives.
Definition: eriworker.cpp:198
void transform_l(int am, size_t Ni, size_t Nj, size_t Nk)
Do spherical transform with respect to fourth index.
void reorder(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls, bool swap_ij, bool swap_kl, bool swap_ijkl)
Reorder integrals.
Definition: eriworker.cpp:1313
virtual ~ERIWorker()
Destructor.
Definition: eriworker.cpp:83
Worker for computing electron repulsion integrals.
Definition: eriworker.h:121
std::vector< double > * input
Input array.
Definition: eriworker.h:60
double alpha
Weight for long-range (i.e. normal HF) exchange.
Definition: eriworker.h:168
void compute_G(double rho, double T, int nmax)
Compute the kernel.
Definition: eriworker.cpp:1439
Worker for dealing with electron repulsion integrals and their derivatives.
Definition: eriworker.h:52
void spherical_transform(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Do spherical transforms if necessary.
Definition: eriworker.cpp:43
eri_precursor_t compute_precursor(const GaussianShell *is, const GaussianShell *js)
Compute precursor.
Definition: eriworker.cpp:891
arma::cube PA
Distance between P and shell i center (Na,Nb,3)
Definition: eriworker.h:40
std::vector< double > arrone
Storage arrays (operated through pointer)
Definition: eriworker.h:55
void compute(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Compute eris.
Definition: eriworker.cpp:1159
~ERIWorker_srlr()
Destructor.
Definition: eriworker.cpp:1427
double alpha
Factor of long-range exchange.
Definition: eriworker.h:190
void compute(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Compute derivatives.
Definition: eriworker.cpp:1274
const GaussianShell * ls
4th shell
Definition: eriworker.h:138
void transform_i(int am, size_t Nj, size_t Nk, size_t Nl)
Do spherical transform with respect to first index.
Libderiv_t libderiv
Libint worker.
Definition: eriworker.h:123
void compute_libint_data(const eri_precursor_t &ip, const eri_precursor_t &jp, int mmax)
Compute data for libint.
Definition: eriworker.cpp:961
const std::vector< double > * getp(int idx)
Get the derivatives wrt index idx.
Definition: eriworker.cpp:381
virtual void compute_G(double rho, double T, int nmax)
Compute the integral kernel.
Definition: eriworker.cpp:951
void compute_debug(const GaussianShell *is, const GaussianShell *js, const GaussianShell *ks, const GaussianShell *ls)
Compute eris using Huzinaga routines.
Definition: eriworker.cpp:1191
bool swap_ij
Swap?
Definition: eriworker.h:140
const std::vector< double > * getp() const
Get pointer to eris.
Definition: eriworker.cpp:1270
Worker for computing electron repulsion integrals.
Definition: eriworker.h:93
Precursor data for ERIs.
Definition: eriworker.h:32