3
\brief Enter brief description of file here
6
* Revision 1.2 2001/06/29 20:39:28 evaleev
7
* Modified cscf to use libpsio to store supermatrix files.
9
/* Revision 1.1.1.1 2000/02/04 22:52:30 evaleev
10
/* Started PSI 3 repository
12
/* Revision 1.2 1999/08/17 19:04:15 evaleev
13
/* Changed the default symmetric orthogonalization to the canonical
14
/* orthogonalization. Now, if near-linear dependencies in the basis are found,
15
/* eigenvectors of the overlap matrix with eigenvalues less than 1E-6 will be
16
/* left out. This will lead to num_mo != num_so, i.e. SCF eigenvector is no
17
/* longer a square matrix. Had to rework some routines in libfile30, and add some.
18
/* The progrem prints out a warning if near-linear dependencies are found. TRANSQT
19
/* and a whole bunch of other codes has to be fixed to work with such basis sets.
21
/* Revision 1.1.1.1 1999/04/12 16:59:26 evaleev
22
/* Added a version of CSCF that can work with CINTS.
30
namespace psi { namespace cscf {
32
static double *gtmp2,*gtmpo2,*ptmp2,*ptmpo2;
33
extern int num_bufs_c,num_bufs_o,readflgc,readflgo;
34
extern struct c_pkints {
39
extern struct o_pkints {
46
extern int lasto,lastc;
49
extern int *int_nums_c;
50
extern int *int_nums_o;
52
void formg_two(int iju, int* optest)
54
register int i,j,k,joff,nn;
58
double dotest,tmpval,qtemp;
59
struct o_pkints *o_temp;
60
struct c_pkints *c_temp;
65
gtmp2 = (double *) init_array(tmpsiz);
66
gtmpo2 = (double *) init_array(tmpsiz);
67
ptmp2 = (double *) init_array(tmpsiz);
68
ptmpo2 = (double *) init_array(tmpsiz);
71
//bzero(gtmp2,sizeof(double)*tmpsiz);
72
memset(gtmp2,'\0',sizeof(double)*tmpsiz);
73
//bzero(gtmpo2,sizeof(double)*tmpsiz);
74
memset(gtmpo2,'\0',sizeof(double)*tmpsiz);
77
for(k=joff=0; k < num_ir ; k++) {
78
if(nn=scf_info[k].num_so) {
79
for(i=0; i < nn ; i++)
80
for(j=0; j <= i ; j++) {
82
ptmp2[ioff[i+joff]+j+joff] = scf_info[k].dpmat[ioff[i]+j];
83
ptmpo2[ioff[i+joff]+j+joff] = scf_info[k].dpmato[ioff[i]+j];
85
ptmp2[ioff[i+joff]+j+joff] = scf_info[k].pmat[ioff[i]+j];
86
ptmpo2[ioff[i+joff]+j+joff] = scf_info[k].pmato[ioff[i]+j];
94
/* int_nums_o = (int *) init_array(num_bufs_o+1); */
95
int_nums_o = (int *) init_int_array(num_bufs_o+1);
96
/* int_nums_c = (int *) init_array(num_bufs_c+1); */
97
int_nums_c = (int *) init_int_array(num_bufs_c+1);
98
for(i=1; i < num_bufs_o ; i++) int_nums_o[i]=maxbuf;
99
for(i=1; i < num_bufs_c ; i++) int_nums_c[i]=maxbuf;
100
int_nums_o[num_bufs_o]=lasto;
101
int_nums_c[num_bufs_c]=lastc;
106
num=int_nums_o[whereo];
107
for (j=0; j < num_bufs_o ; j++) {
110
for (i=num; i ; i--,o_temp++) {
113
tmpval = (*o_temp).pval;
114
dotest = (*o_temp).qval;
116
gtmp2[ij] += ptmp2[kl]*tmpval;
117
gtmp2[kl] += ptmp2[ij]*tmpval;
118
if(optest[ij] && optest[kl]) {
120
gtmpo2[ij] += alpha1*ptmpo2[kl]*tmpval;
121
gtmpo2[kl] += alpha1*ptmpo2[ij]*tmpval;
124
qtemp = tmpval + alpha2*dotest;
125
gtmpo2[ij] += ptmpo2[kl]*qtemp;
126
gtmpo2[kl] += ptmpo2[ij]*qtemp;
129
gtmpo2[ij] += alpha3*ptmpo2[kl]*tmpval;
130
gtmpo2[kl] += alpha3*ptmpo2[ij]*tmpval;
135
if (readflgo && j < num_bufs_o-1) {
136
if(whereo==num_bufs_o) {
137
PKmat.bufpos = PSIO_ZERO;
141
num=int_nums_o[whereo];
142
psio_read(PKmat.unit, PKmat.key, (char *) o_outbuf, sizeof(struct o_pkints)*num,
143
PKmat.bufpos, &(PKmat.bufpos));
147
num=int_nums_c[wherec];
148
for (j=0; j < num_bufs_c ; j++) {
151
for (i=num; i ; i--,c_temp++) {
154
tmpval = (*c_temp).pval;
156
gtmp2[ij] += ptmp2[kl]*tmpval;
157
gtmp2[kl] += ptmp2[ij]*tmpval;
158
if(optest[ij] && optest[kl]) {
160
gtmpo2[ij] += alpha1*ptmpo2[kl]*tmpval;
161
gtmpo2[kl] += alpha1*ptmpo2[ij]*tmpval;
164
gtmpo2[ij] += ptmpo2[kl]*tmpval;
165
gtmpo2[kl] += ptmpo2[ij]*tmpval;
168
gtmpo2[ij] += alpha3*ptmpo2[kl]*tmpval;
169
gtmpo2[kl] += alpha3*ptmpo2[ij]*tmpval;
174
if (readflgc && j < num_bufs_c-1) {
175
if(wherec==num_bufs_c) {
176
Pmat.bufpos = PSIO_ZERO;
180
num=int_nums_c[wherec];
181
psio_read(Pmat.unit, Pmat.key, (char *) c_outbuf, sizeof(struct c_pkints)*num,
182
Pmat.bufpos, &(Pmat.bufpos));
186
for(k=joff=0; k < num_ir ; k++) {
187
if(nn=scf_info[k].num_so) {
188
for(i=0; i < nn ; i++)
189
for(j=0; j <= i ; j++) {
191
scf_info[k].gmat[ioff[i]+j] += gtmp2[ioff[i+joff]+j+joff];
192
scf_info[k].gmato[ioff[i]+j] += gtmpo2[ioff[i+joff]+j+joff];
194
scf_info[k].gmat[ioff[i]+j] = gtmp2[ioff[i+joff]+j+joff];
195
scf_info[k].gmato[ioff[i]+j] = gtmpo2[ioff[i+joff]+j+joff];
200
fprintf(outfile,"\n gmat for irrep %s\n",scf_info[k].irrep_label);
201
print_array(scf_info[k].gmat,nn,outfile);
202
fprintf(outfile,"\n gmato for irrep %s\n",scf_info[k].irrep_label);
203
print_array(scf_info[k].gmato,nn,outfile);
209
}} // namespace psi::cscf