00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef _chemistry_qc_basis_obint_h
00029
#define _chemistry_qc_basis_obint_h
00030
00031
#ifdef __GNUC__
00032
#pragma interface
00033
#endif
00034
00035
#include <util/ref/ref.h>
00036
#include <util/state/state.h>
00037
#include <math/scmat/matrix.h>
00038
#include <math/scmat/elemop.h>
00039
00040
#include <chemistry/qc/basis/gaussbas.h>
00041
#include <chemistry/qc/basis/dercent.h>
00042
00043
namespace sc {
00044
00045
class Integral;
00046
00047
00048
00049
class EfieldDotVectorData:
public RefCount
00050 {
00051
public:
00052
double position[3];
00053
double vector[3];
00054
00055
void set_position(
double*);
00056
void set_vector(
double*);
00057 };
00058
00059
00060
class DipoleData:
public RefCount
00061 {
00062
public:
00063
double origin[3];
00064
00065 DipoleData(
double *d) {origin[0]=d[0]; origin[1]=d[1]; origin[2]=d[2];}
00066 DipoleData() {origin[0]=origin[1]=origin[2]=0.0;}
00067
void set_origin(
double*);
00068 };
00069
00070
00071
class PointChargeData:
public RefCount
00072 {
00073
private:
00074
int ncharges_;
00075
const double *charges_;
00076
const double *
const*positions_;
00077
double *alloced_charges_;
00078
double **alloced_positions_;
00079
00080
public:
00081
00082
00083 PointChargeData(
int ncharge,
00084
const double *
const*positions,
const double *charges,
00085
int copy_data = 0);
00086 ~PointChargeData();
00087
00088
int ncharges()
const {
return ncharges_; }
00089
const double *charges()
const {
return charges_; }
00090
const double *
const*positions()
const {
return positions_; }
00091 };
00092
00093
00096 class OneBodyInt :
public RefCount {
00097
protected:
00098
00099
Integral *integral_;
00100
00101
Ref<GaussianBasisSet> bs1_;
00102
Ref<GaussianBasisSet> bs2_;
00103
00104
double *buffer_;
00105
00106
OneBodyInt(
Integral *integral,
00107
const Ref<GaussianBasisSet>&b1,
00108
const Ref<GaussianBasisSet>&b2 = 0);
00109
00110
public:
00111
virtual ~
OneBodyInt();
00112
00114
int nbasis()
const;
00115
00117
00118
int nbasis1()
const;
00119
int nbasis2()
const;
00121
00123
int nshell()
const;
00124
00126
00127
int nshell1()
const;
00128
int nshell2()
const;
00130
00132
Ref<GaussianBasisSet> basis();
00133
00135
00136
Ref<GaussianBasisSet> basis1();
00137
Ref<GaussianBasisSet> basis2();
00139
00141
const double *
buffer()
const;
00142
00145
virtual void compute_shell(
int,
int) = 0;
00146
00149
virtual void reinitialize();
00150
00153
virtual bool cloneable();
00154
00157
virtual Ref<OneBodyInt> clone();
00158
00159
Integral *integral()
const {
return integral_; }
00160 };
00161
00162
00163
00164
00165
00166
class ShellPairIter {
00167
private:
00168
const double * buf;
00169
double scale_;
00170
00171
int e12;
00172
00173
int index;
00174
00175
int ioffset;
00176
int joffset;
00177
00178
int iend;
00179
int jend;
00180
00181
int icur;
00182
int jcur;
00183
00184
public:
00185 ShellPairIter();
00186 ~ShellPairIter();
00187
00188
void init(
const double * buffer,
int ishell,
int jshell,
00189
int ioff,
int joff,
int nfunci,
int nfuncj,
int redund=0,
00190
double scale=1.0);
00191
00192
void start() { icur=jcur=index=0; }
00193
int ready()
const {
return (icur < iend); }
00194
00195
void next() {
00196
if (jcur < ((e12)?(icur):((jend)-1))) {
00197 index++;
00198 jcur++;
00199
return;
00200 }
00201
00202 jcur=0;
00203 icur++;
00204
00205 index = icur*jend;
00206 }
00207
00208
int current_i()
const {
return icur; }
00209
int current_j()
const {
return jcur; }
00210
00211
int i()
const {
return icur+ioffset; }
00212
int j()
const {
return jcur+joffset; }
00213
00214
int nint()
const {
return iend*jend; }
00215
00216
double val()
const {
return buf[index]*scale_; }
00217 };
00218
00219
00220
00221
class OneBodyIntIter :
public RefCount {
00222
protected:
00223 Ref<OneBodyInt> obi;
00224 ShellPairIter spi;
00225
00226
int redund;
00227
00228
int istart;
00229
int jstart;
00230
00231
int iend;
00232
int jend;
00233
00234
int icur;
00235
int jcur;
00236
00237
int ij;
00238
00239
public:
00240 OneBodyIntIter();
00241 OneBodyIntIter(
const Ref<OneBodyInt>&);
00242
virtual ~OneBodyIntIter();
00243
00244
virtual void start(
int ist=0,
int jst=0,
int ien=0,
int jen=0);
00245
virtual void next();
00246
00247
int ready()
const {
return (icur < iend); }
00248
00249
int ishell()
const {
return icur; }
00250
int jshell()
const {
return jcur; }
00251
00252
int ijshell()
const {
return ij; }
00253
00254
int redundant()
const {
return redund; }
00255
void set_redundant(
int i) { redund=i; }
00256
00257
virtual double scale() const;
00258
00259 Ref<OneBodyInt> one_body_int() {
return obi; }
00260
00261 ShellPairIter& current_pair();
00262
00263
virtual bool cloneable();
00264
virtual Ref<OneBodyIntIter> clone();
00265 };
00266
00267
00268
00269
00270
00271
class OneBodyIntOp:
public SCElementOp {
00272
protected:
00273 Ref<OneBodyIntIter> iter;
00274
00275
public:
00276 OneBodyIntOp(
const Ref<OneBodyInt>&);
00277 OneBodyIntOp(
const Ref<OneBodyIntIter>&);
00278
virtual ~OneBodyIntOp();
00279
00280
void process(SCMatrixBlockIter&);
00281
void process_spec_rect(SCMatrixRectBlock*);
00282
void process_spec_ltri(SCMatrixLTriBlock*);
00283
void process_spec_rectsub(SCMatrixRectSubBlock*);
00284
void process_spec_ltrisub(SCMatrixLTriSubBlock*);
00285
00286
bool cloneable();
00287 Ref<SCElementOp> clone();
00288
00289
int has_side_effects();
00290 };
00291
00292
class OneBody3IntOp:
public SCElementOp3 {
00293
private:
00294 Ref<OneBodyIntIter> iter;
00295
00296
public:
00297 OneBody3IntOp(
const Ref<OneBodyInt>&b);
00298 OneBody3IntOp(
const Ref<OneBodyIntIter>&);
00299
virtual ~OneBody3IntOp();
00300
00301
void process(SCMatrixBlockIter&,
00302 SCMatrixBlockIter&,
00303 SCMatrixBlockIter&);
00304
void process_spec_rect(SCMatrixRectBlock*,
00305 SCMatrixRectBlock*,
00306 SCMatrixRectBlock*);
00307
void process_spec_ltri(SCMatrixLTriBlock*,
00308 SCMatrixLTriBlock*,
00309 SCMatrixLTriBlock*);
00310
00311
int has_side_effects();
00312
int has_side_effects_in_arg1();
00313
int has_side_effects_in_arg2();
00314
00315 };
00316
00317
00318
00321 class OneBodyDerivInt :
public RefCount {
00322
protected:
00323
00324
Integral *integral_;
00325
00326
Ref<GaussianBasisSet> bs1;
00327
Ref<GaussianBasisSet> bs2;
00328
00329
double *buffer_;
00330
00331
public:
00332
OneBodyDerivInt(
Integral *,
const Ref<GaussianBasisSet>&b);
00333
OneBodyDerivInt(
Integral *,
00334
const Ref<GaussianBasisSet>&b1,
00335
const Ref<GaussianBasisSet>&b2);
00336
virtual ~
OneBodyDerivInt();
00337
00339
int nbasis()
const;
00341
00342
int nbasis1()
const;
00343
int nbasis2()
const;
00345
00347
int nshell()
const;
00349
00350
int nshell1()
const;
00351
int nshell2()
const;
00353
00355
Ref<GaussianBasisSet> basis();
00357
00358
Ref<GaussianBasisSet> basis1();
00359
Ref<GaussianBasisSet> basis2();
00361
00364
const double *
buffer()
const;
00365
00369
virtual void compute_shell(
int ish,
int jsh,
DerivCenters&) = 0;
00370
virtual void compute_shell(
int ish,
int jsh,
int center) = 0;
00372 };
00373
00374 }
00375
00376
#endif
00377
00378
00379
00380
00381