470
470
tval = H0block.H0b_diag[l][i];
471
if (Parameters.S % 2) tval = -tval;
471
if ((int) Parameters.S % 2) tval = -tval;
472
472
if (fabs(H0block.H0b_diag[j][i] - tval) > 1.0E-8) {
474
474
fprintf(outfile,"(sem_iter): H0block.H0b_diag[%d][%d]"
502
502
Cvec.init_vals(k, L, H0block.alplist, H0block.alpidx,
503
503
H0block.betlist, H0block.betidx, H0block.blknum, sm_evals);
505
if (Parameters.calc_ssq && Parameters.icore==1) {
507
tval = Cvec.calc_ssq(buffer1, buffer2, alplist, betlist, k);
508
Cvec.buf_lock(buffer1);
509
if (fabs(tval - (Parameters.S*(Parameters.S+1.0))) > 1.0E-3) {
511
"Computed <S^2> not as desired, discarding guess\n");
507
517
Cvec.buf_unlock();
508
518
Cvec.write_num_vecs(k);
680
if (Parameters.print_sigma_overlap) {
681
/* Form sigma_overlap matrix */
682
Sigma.buf_lock(buffer1);
683
Sigma2.buf_lock(buffer2);
684
zero_mat(sigma_overlap,maxnvect, maxnvect);
685
for (i=0; i<L; i++) {
688
fprintf(outfile,"Sigma[%d] = ", i);
689
Sigma.print(outfile);
692
for (j=i; j<L; j++) {
695
fprintf(outfile,"Sigma2[%d] = ", j);
696
Sigma2.print(outfile);
699
sigma_overlap[i][j] = sigma_overlap[j][i] = Sigma * Sigma2;
705
fprintf(outfile, "\nsigma_overlap matrix (%2d) = \n", iter);
706
print_mat(sigma_overlap, L, L, outfile);
708
for (i=0; i<L; i++) {
709
fprintf(outfile, "\nGuess energy #%d = %15.9lf\n", i,
710
-1.0 * sqrt(sigma_overlap[i][i]) + CalcInfo.enuc + CalcInfo.efzc);
713
/* diagonalize sigma_overlap to see what that does
714
should be the same as diagnolizing H^2 in the basis of the
715
Davidson subspace vectors
718
/* Form Mij matrix */
719
/* This formula assumes the b vectors are orthogonal */
720
zero_mat(M[0],maxnvect,maxnvect);
721
for (i=0; i<L; i++) {
722
for (j=i; j<L; j++) {
723
M[0][i][j] = M[0][j][i] = sigma_overlap[i][j];
727
/* solve the L x L eigenvalue problem M a = lambda a for M roots */
728
sq_rsp(L, L, M[0], m_lambda[0][0], 1, m_alpha[0][0], 1.0E-14);
729
for (i=0; i<L; i++) {
730
m_lambda[0][0][i] = -1.0 * sqrt(m_lambda[0][0][i]) +
731
CalcInfo.enuc + CalcInfo.efzc;
733
fprintf(outfile, "\n Guess energy from H^2 = %15.9lf\n",
735
fprintf(outfile, "\n M eigenvectors and eigenvalues root %d:\n",0);
736
eivout(m_alpha[0][0], m_lambda[0][0], L, L, outfile);
670
739
/* before we form correction vectors see if enough room to
671
740
* append new b vectors to Davidson subspace.
1011
1080
evals[i] + enuc + efzc);
1013
1082
if (nroots > 1) {
1014
fprintf(outfile, " (%4.3lf eV)\n", (evals[i] - evals[0]) *
1083
fprintf(outfile, " (%6.4lf eV, %9.2lf 1/cm)\n",
1084
(evals[i] - evals[0]) * _hartree2ev,
1085
(evals[i] - evals[0]) * _hartree2wavenumbers);
1017
1087
else fprintf(outfile, "\n");
1078
1148
fprintf(outfile,"Warning: Norm of "
1079
1149
"correction (root %d) is < 1.0E-13\n", k);
1152
if (Parameters.zero_det) {
1153
tval -= Dvec.zero_det(Parameters.zero_det_Iac,
1154
Parameters.zero_det_Iaridx, Parameters.zero_det_Ibc,
1155
Parameters.zero_det_Ibridx);
1081
1157
tval = sqrt(1.0 / tval);
1083
1158
Dvec.symnorm(tval,0,0);
1085
1160
if (print_lvl > 4) {
1136
1211
Cvec2.buf_unlock();
1214
/* not sure that you really want to do this every iter... CDS
1139
1215
if (Parameters.calc_ssq && Parameters.icore==1) {
1140
1216
for (k=0; k<L; k++)
1141
Cvec.calc_ssq(buffer1, buffer2, alplist, betlist, k);
1217
tval = Cvec.calc_ssq(buffer1, buffer2, alplist, betlist, k);