1
#ifndef _psi_src_bin_mcscf_scf_h_
2
#define _psi_src_bin_mcscf_scf_h_
4
#include "sblock_vector.h"
5
#include "sblock_matrix.h"
9
namespace psi{ namespace mcscf{
11
enum ReferenceType {rhf, rohf, uhf, tcscf};
18
void compute_energy();
20
ReferenceType reference;
21
static const int maxci = 8;
22
static const int maxdiis = 10;
23
static const int maxbatches = 50;
38
// Out-of-core algorithm
41
size_t batch_pq_min[maxbatches];
42
size_t batch_pq_max[maxbatches];
43
size_t batch_index_min[maxbatches];
44
size_t batch_index_max[maxbatches];
45
size_t batch_size[maxbatches];
46
size_t total_symmetric_block_size;
47
size_t nin_core; // Number of matrix elements of the PK and K matrices held in of core
49
// Addressing routines
51
int npairs; // Total number of pairs
52
int* pairpi; // Number of pairs per irrep
53
int* pairs; // The pairs stored as [ p1 q1 p2 q2 ... ]
54
int** pair; // Maps absolute p and q to the pair index
55
int** pair_sym; // Maps absolute p and q to the pair symmetry
56
int* pair_offset; // Offset for first pair of a given irrep
58
double* PK; // PK(pq|rs)
59
double* K; // K(pq|rs)
61
SBlockVector epsilon; // Effective Fock matrix eigenvalues
64
SBlockMatrix C; // MO coefficients matrix
65
SBlockMatrix C_t; // transformed C matrix
66
SBlockMatrix C_T; // MO coefficients matrix transposed
67
SBlockMatrix Dc; // The density matrix (closed)
68
SBlockMatrix Do; // The density matrix (open)
69
SBlockMatrix Dtc[maxci]; // The density matrix (tcscf)
70
SBlockMatrix Dsum[maxci]; // The density matrix (closed + tcscf)
71
SBlockMatrix Fc; // The Fock matrix (closed)
72
SBlockMatrix Fc_t; // The transformed Fock matrix (closed)
73
SBlockMatrix Fo; // The Fock matrix (open)
74
SBlockMatrix Fo_t; // The transformed Fock matrix (open)
75
SBlockMatrix Favg; // The Fock matrix (average)
76
SBlockMatrix Favg_t; // The transformed Fock matrix (average)
77
SBlockMatrix Ftc[maxci]; // The Fock matrix (tcscf)
78
SBlockMatrix Ftc_t[maxci];// The transformed Fock matrix (tcscf)
79
SBlockMatrix Feff_t; // The transformed effective Fock matrix
80
SBlockMatrix Feff_oAO; // The effective Fock matrix in the orthogonal AO basis
81
SBlockMatrix G; // The G matrix
82
SBlockMatrix T; // a temp matrix
83
SBlockMatrix H; // one electron integrals
84
SBlockMatrix O; // The occupation matrix
85
SBlockMatrix S; // overlap integrals
86
SBlockMatrix S_sqrt_inv; // S^-1/2
87
SBlockMatrix S_sqrt; // S^1/2
89
SBlockMatrix e; // MO coefficients error matrix
90
SBlockMatrix diis_F[maxdiis]; // The Fock matrices saved for DIIS
91
SBlockMatrix diis_e[maxdiis]; // The error matrices saved for DIIS
92
double diis_ci[maxci][maxdiis]; // The ci vector saved for DIIS
95
int nci; // Number of references
96
double norm_ci_grad; // Norm of the CI gradient (sum_I |C_I|)
97
double* ci; // TWOCON CI coefficients
98
double* ci_grad; // TWOCON CI coefficients gradient
99
double** H_tcscf; // TWOCON Hamiltonian
100
int tcscf_mos[maxci]; // Number of the TWOCON mos (relative to the irrep)
101
int tcscf_sym[maxci]; // Symmetry of the TWOCON mos
107
void generate_pairs();
110
void read_so_tei_form_PK();
111
void read_so_tei_form_PK_and_K();
112
void read_Raffanetti(const char* integral_type, double* integrals, int batch);
113
void write_Raffanetti(const char* integral_type, double* integrals, int batch);
115
void construct_S_inverse_sqrt();
116
void iterate_scf_equations();
117
void canonicalize_MO();
119
void check_orthonormality();
120
void print_eigenvectors_and_MO();
122
void initial_guess();
123
void density_matrix();
124
void construct_G(SBlockMatrix& density,SBlockMatrix& G,double* integrals,int batch, double factor);
125
void construct_G(SBlockMatrix& density,SBlockMatrix& G,double* integrals,int batch);
127
void construct_Favg();
128
void construct_Feff(int cycle);
129
double energy(int cycle,double old_energy);
131
void diis(int cycle);
133
// Auxiliary functions
134
void transform(SBlockMatrix& Initial, SBlockMatrix& Final, SBlockMatrix& Transformation);
137
}} /* End Namespaces */
139
#endif // _psi_src_bin_mcscf_scf_h_
156
double* epsilon; // Eigenvalues
157
SBlockMatrix* C; // MO coefficients matrix
158
SBlockMatrix* C_T; // Transpose coefficients matrix
159
SBlockMatrix* C_t; // transformed C matrix
160
SBlockMatrix* D; // density matrix
161
SBlockMatrix* Dc; // closed-shell density matrix
162
SBlockMatrix* Do; // open-shell density matrix
163
SBlockMatrix* Dtc[2]; // tcscf density matrices
164
SBlockMatrix* Ex; // tcscf exchange matrix
165
SBlockMatrix* F; // Fock matrix
166
SBlockMatrix* F_t; // transformed Fock matrix
167
SBlockMatrix* Fc; // closed-shell Fock matrix
168
SBlockMatrix* Fo; // open-shell Fock matrix
170
SBlockMatrix* Fc_t; // transformed closed-shell Fock matrix
171
SBlockMatrix* Fo_t; // transformed open-shell Fock matrix
172
SBlockMatrix* Feff_t; // transformed effective Fock matrix
173
SBlockMatrix* G; // two electron contribution to F
175
SBlockMatrix* SDF; // SDF: used to compute the diis error
176
SBlockMatrix* FDS; // FDS: used to compute the diis error
177
SBlockMatrix* CSC; // CSC = 1 for orthornormal MOs
180
SBlockMatrix* Temp; // A temporary matrix