4
#include<libciomr/libciomr.h>
5
#include<libchkpt/chkpt.h>
6
#include<libint/libint.h>
13
/*-------------------------------
14
Explicit function declarations
15
-------------------------------*/
16
static void print_ccoefs(void);
23
double **ccvecs, *alpha, *beta;
26
MOInfo.Escf = chkpt_rd_escf();
30
/* CDS: I revised this stuff about correlation and SCF energies */
32
/* If SCF, can say Eref = Escf (I guess...) */
33
if (strcmp(UserOptions.wfn,"SCF")==0) {
34
MOInfo.Eref = MOInfo.Escf;
37
MOInfo.Eref = chkpt_rd_eref();
40
/* Note: this init_moinfo() routine is not always called! We'll need
41
to re-grab some of the above energies in other subroutines to be
42
positive we have them on-hand */
44
MOInfo.num_mo = chkpt_rd_nmo();
45
MOInfo.orbspi = chkpt_rd_orbspi();
46
MOInfo.clsdpi = chkpt_rd_clsdpi();
47
MOInfo.openpi = chkpt_rd_openpi();
48
MOInfo.virtpi = init_int_array(Symmetry.nirreps);
49
for(irrep=0;irrep<Symmetry.nirreps;irrep++)
50
MOInfo.virtpi[irrep] = MOInfo.orbspi[irrep] - MOInfo.clsdpi[irrep] - MOInfo.openpi[irrep];
51
MOInfo.scf_evals[0] = chkpt_rd_evals();
52
scf_evec_so = chkpt_rd_scf();
53
MOInfo.scf_evec[0] = block_matrix(MOInfo.num_mo,BasisSet.num_ao);
54
mmult(Symmetry.usotao,1,scf_evec_so,0,MOInfo.scf_evec[0],1,BasisSet.num_ao,Symmetry.num_so,MOInfo.num_mo,0);
55
free_block(scf_evec_so);
56
if (UserOptions.reftype == uhf) {
57
MOInfo.scf_evals[1] = chkpt_rd_beta_evals();
58
scf_evec_so = chkpt_rd_beta_scf();
59
MOInfo.scf_evec[1] = block_matrix(MOInfo.num_mo,BasisSet.num_ao);
60
mmult(Symmetry.usotao,1,scf_evec_so,0,MOInfo.scf_evec[1],1,BasisSet.num_ao,Symmetry.num_so,MOInfo.num_mo,0);
61
free_block(scf_evec_so);
64
/*--- Check the validity of the checkpoint file ---*/
65
iopen = chkpt_rd_iopen();
66
switch (UserOptions.reftype) {
67
case rhf: if (iopen != 0) punt("Content of checkpoint file inconsistent with REFERENCE\n"); break;
68
case uhf: if (iopen != 0) punt("Content of checkpoint file inconsistent with REFERENCE\n"); break;
69
case rohf: if (iopen <= 0) punt("Content of checkpoint file inconsistent with REFERENCE\n"); break;
70
case twocon: if (iopen >= 0) punt("Content of checkpoint file inconsistent with REFERENCE\n"); break;
73
/*--- Number of d.-o. MOs and s.-o. MOs ---*/
77
for (i=0;i<Symmetry.nirreps;i++) {
78
MOInfo.ndocc += MOInfo.clsdpi[i];
79
if (MOInfo.openpi[i] != 0)
81
MOInfo.nsocc += MOInfo.openpi[i];
83
MOInfo.nuocc = MOInfo.num_mo - MOInfo.ndocc - MOInfo.nsocc;
85
/*--- Number of closed and open shells (no virtuals) ---*/
86
MOInfo.num_moshells = MOInfo.num_openmoshells = ( -1 + (int)sqrt(1.0+8.0*abs(iopen)) )/2; /* number of open shells */
87
if (MOInfo.ndocc > 0) /* add closed shells as well */
88
MOInfo.num_moshells++;
91
/*--- Read in open-shell coupling coeffcients ---*/
92
ccvecs = chkpt_rd_ccvecs();
93
if (iopen != 0) { /*--- NOTE! These are Pitzer's coupling constants (a and b).
94
To get Yamaguchi's constants (alpha and beta) use this:
95
alpha = (1-a)/2 beta = (b-1)/4
101
if (UserOptions.reftype == twocon) {
102
MOInfo.tcscf_occ[0] = 2.0/(1.0-alpha[0]);
103
MOInfo.tcscf_occ[1] = 2.0/(1.0-alpha[2]);
106
if (UserOptions.reftype == rohf || UserOptions.reftype == twocon) {
107
/*--- Form square matrices of coupling coeffcients ---*/
108
MOInfo.Alpha = block_matrix(MOInfo.num_moshells,MOInfo.num_moshells);
109
MOInfo.Beta = block_matrix(MOInfo.num_moshells,MOInfo.num_moshells);
110
/* Put alpha's and beta's in Alpha and Beta */
111
if (MOInfo.ndocc > 0) { /* There are closed shells */
112
/* Closed-Closed CCs */
113
MOInfo.Alpha[0][0] = 2.0;
114
MOInfo.Beta[0][0] = -1.0;
115
if (UserOptions.reftype == rohf) { /*--- Highspin and opeh-shell singlet cases ---*/
116
/* Closed-Open CCs */
117
for(i=1;i<MOInfo.num_moshells;i++) {
118
MOInfo.Alpha[0][i] = MOInfo.Alpha[i][0] = 1.0;
119
MOInfo.Beta[0][i] = MOInfo.Beta[i][0] = -0.5;
121
/* Open-Open blocks */
122
for(i=0;i<MOInfo.num_openmoshells;i++)
124
MOInfo.Alpha[i+1][j+1] = MOInfo.Alpha[j+1][i+1] = (1.0 - alpha[ioff[i]+j]) * 0.5;
125
MOInfo.Beta[i+1][j+1] = MOInfo.Beta[j+1][i+1] = (beta[ioff[i]+j] + 1.0) * -0.25;
128
else if (UserOptions.reftype == twocon) { /*--- TCSCF ---*/
129
MOInfo.Alpha[0][1] = MOInfo.Alpha[1][0] = MOInfo.tcscf_occ[0];
130
MOInfo.Beta[0][1] = MOInfo.Beta[1][0] = (-0.5) * MOInfo.tcscf_occ[0];
131
MOInfo.Alpha[0][2] = MOInfo.Alpha[2][0] = MOInfo.tcscf_occ[1];
132
MOInfo.Beta[0][2] = MOInfo.Beta[2][0] = (-0.5) * MOInfo.tcscf_occ[1];
133
MOInfo.Alpha[1][1] = MOInfo.tcscf_occ[0] * 0.5;
134
MOInfo.Alpha[2][2] = MOInfo.tcscf_occ[1] * 0.5;
135
MOInfo.Beta[1][2] = MOInfo.Beta[2][1] = sqrt(MOInfo.tcscf_occ[0]*MOInfo.tcscf_occ[1]) * (-0.5);
138
else { /* There are no closed shells */
139
if (UserOptions.reftype == rohf) { /*--- Highspin and opeh-shell singlet cases ---*/
140
/* Open-Open blocks */
141
for(i=0;i<MOInfo.num_openmoshells;i++)
143
MOInfo.Alpha[i][j] = MOInfo.Alpha[j][i] = (1.0 - alpha[ioff[i]+j]) * 0.5;
144
MOInfo.Beta[i][j] = MOInfo.Beta[j][i] = (beta[ioff[i]+j] - 1.0) * 0.25;
147
else if (UserOptions.reftype == twocon) { /*--- TCSCF ---*/
148
MOInfo.Alpha[0][0] = MOInfo.tcscf_occ[0] * 0.5;
149
MOInfo.Alpha[1][1] = MOInfo.tcscf_occ[1] * 0.5;
150
MOInfo.Beta[0][1] = MOInfo.Beta[1][0] = sqrt(MOInfo.tcscf_occ[0]*MOInfo.tcscf_occ[1]) * (-0.5);
162
void cleanup_moinfo()
164
free(MOInfo.scf_evals[0]);
165
free_block(MOInfo.scf_evec[0]);
166
if (UserOptions.reftype == uhf) {
167
free(MOInfo.scf_evals[1]);
168
free_block(MOInfo.scf_evec[1]);
174
if (UserOptions.reftype == rohf || UserOptions.reftype == twocon) {
175
free_block(MOInfo.Alpha);
176
free_block(MOInfo.Beta);
183
/*----------------------
184
Print coupling coeffs
185
----------------------*/
190
if (UserOptions.print_lvl >= PRINT_CCOEFF) {
191
fprintf(outfile," -Yamaguchi's coupling coefficients :\n\n");
192
fprintf(outfile," i j alpha beta \n");
193
fprintf(outfile," -------------------------\n");
194
for (i=0;i<MOInfo.num_moshells;i++)
196
fprintf(outfile," %2d %2d %5.3f %5.3f\n",
197
i+1,j+1,MOInfo.Alpha[i][j],MOInfo.Beta[i][j]);
198
fprintf(outfile,"\n\n");