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_mbpt_mbpt_h
00029
#define _chemistry_qc_mbpt_mbpt_h
00030
00031
#ifdef __GNUC__
00032
#pragma interface
00033
#endif
00034
00035
#include <util/group/memory.h>
00036
#include <util/group/message.h>
00037
#include <util/group/thread.h>
00038
#include <chemistry/qc/basis/obint.h>
00039
#include <chemistry/qc/basis/tbint.h>
00040
#include <chemistry/qc/scf/scf.h>
00041
00042
namespace sc {
00043
00044
00045
00048 class MBPT2:
public Wavefunction {
00049
protected:
00050
#define ref_to_mp2_acc 100.0
00051
00052
Ref<SCF> reference_;
00053
Ref<MemoryGrp> mem;
00054
int nfzc, nfzv;
00055 size_t mem_alloc;
00056
00057
double cphf_epsilon_;
00058
int eliminate_in_gmat_;
00059
const double *intbuf_;
00060
Ref<TwoBodyInt> tbint_;
00061
Ref<TwoBodyInt> *tbints_;
00062
Ref<TwoBodyDerivInt> *tbintder_;
00063
int nbasis;
00064
int noso;
00065
Ref<MessageGrp> msg_;
00066
int nvir, nocc, nsocc;
00067
00068
Ref<ThreadGrp> thr_;
00069
00070
00071
00072
00073
int dynamic_;
00074
00075
00076
int max_norb_;
00077
00078
00079
int *symorb_irrep_;
00080
int *symorb_num_;
00081
00082
char *method_;
00083
char *algorithm_;
00084
00085
int do_d1_;
00086
00087
int do_d2_;
00088
00089
int nfuncmax;
00090
00091
double hf_energy_;
00092
RefSCVector hf_gradient_;
00093
00094
double restart_ecorr_;
00095
int restart_orbital_v1_;
00096
int restart_orbital_memgrp_;
00097
00098
protected:
00099
void init_variables();
00100
00101
00102
void compute();
00103
00104
00105
00106
void eigen(
RefDiagSCMatrix &vals,
RefSCMatrix &vecs,
00107
RefDiagSCMatrix &occs);
00108
00109
00110
void compute_hsos_v1();
00111
00112
00113 distsize_t compute_v2_memory(
int ni,
00114
int nfuncmax,
int nbfme,
int nshell,
00115
int ndocc,
int nsocc,
int nvir,
int nproc);
00116
void compute_hsos_v2();
00117
00118
00119
void compute_hsos_v2_lb();
00120
00121
00122
int compute_cs_batchsize(size_t mem_static,
int nocc_act);
00123
00124
00125 distsize_t compute_cs_dynamic_memory(
int ni,
int nocc_act);
00126
int make_cs_gmat(
RefSymmSCMatrix& Gmat,
double *DPmat);
00127
int make_cs_gmat_new(
RefSymmSCMatrix& Gmat,
const RefSymmSCMatrix& DPmat);
00128
void form_max_dens(
double *DPmat,
signed char *maxp);
00129
int init_cs_gmat();
00130
void done_cs_gmat();
00131
int make_g_d_nor(
RefSymmSCMatrix& Gmat,
00132
double *DPmat,
const double *mgdbuff);
00133
void cs_cphf(
double **scf_vector,
00134
double *Laj,
double *eigval,
RefSCMatrix& P2aj);
00135
void s2pdm_contrib(
const double *intderbuf,
double *PHF,
00136
double *P2AO,
double **hf_ginter,
double **ginter);
00137
void hcore_cs_grad(
double *PHF,
double *PMP2,
00138
double **hf_ginter,
double **ginter);
00139
void overlap_cs_grad(
double *WHF,
double *WMP2,
00140
double **hf_ginter,
double **ginter);
00141
void compute_cs_grad();
00142
public:
00143
MBPT2(
StateIn&);
00227
MBPT2(
const Ref<KeyVal>&);
00228 ~
MBPT2();
00229
00230
void save_data_state(
StateOut&);
00231
00232
Ref<SCF> ref() {
return reference_; }
00233
double ref_energy();
00234
double corr_energy();
00235
RefSCVector ref_energy_gradient();
00236
RefSCVector corr_energy_gradient();
00237
00238
int nelectron();
00239
00240
int nfzcore()
const {
return nfzc; };
00241
int nfzvirt()
const {
return nfzv; };
00242
00243
RefSymmSCMatrix density();
00244
int spin_polarized();
00245
00246
int gradient_implemented()
const;
00247
int value_implemented()
const;
00248
00249
void symmetry_changed();
00250
00251
00252
void obsolete();
00253
00254
void print(std::ostream&o=ExEnv::out0())
const;
00255 };
00256
00257 }
00258
00259
#endif
00260
00261
00262
00263
00264