~ubuntu-branches/ubuntu/trusty/psicode/trusty

« back to all changes in this revision

Viewing changes to src/bin/detci/sem.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
468
468
               tmpi = 1; 
469
469
               }
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) {
473
473
              tmpi = 1;
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);
504
504
 
505
 
         k++;
 
505
         if (Parameters.calc_ssq && Parameters.icore==1) {
 
506
            Cvec.buf_unlock();
 
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) {
 
510
              fprintf(outfile, 
 
511
                 "Computed <S^2> not as desired, discarding guess\n");
 
512
              }
 
513
            else k++;
 
514
            }
 
515
         else k++;
506
516
         }
507
517
      Cvec.buf_unlock();
508
518
      Cvec.write_num_vecs(k);
667
677
 
668
678
       }
669
679
 
 
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++) {
 
686
          Sigma.read(i, 0);
 
687
          if (print_lvl > 2) {
 
688
            fprintf(outfile,"Sigma[%d] = ", i);
 
689
            Sigma.print(outfile);
 
690
            fflush(outfile);
 
691
            }
 
692
          for (j=i; j<L; j++) {
 
693
             Sigma2.read(j, 0);
 
694
             if (print_lvl > 2) {
 
695
               fprintf(outfile,"Sigma2[%d] = ", j);
 
696
               Sigma2.print(outfile);
 
697
               fflush(outfile);
 
698
               }
 
699
             sigma_overlap[i][j] = sigma_overlap[j][i] = Sigma * Sigma2;
 
700
             }
 
701
          }
 
702
       Sigma.buf_unlock();
 
703
       Sigma2.buf_unlock();
 
704
 
 
705
       fprintf(outfile, "\nsigma_overlap matrix (%2d) = \n", iter);
 
706
       print_mat(sigma_overlap, L, L, outfile);
 
707
 
 
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);
 
711
         }
 
712
 
 
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
 
716
        */
 
717
 
 
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];
 
724
          }
 
725
       }
 
726
 
 
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;
 
732
       }
 
733
       fprintf(outfile, "\n Guess energy from H^2 = %15.9lf\n", 
 
734
         m_lambda[0][0][L]);
 
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);
 
737
       }
 
738
 
670
739
      /* before we form correction vectors see if enough room to 
671
740
       * append new b vectors to Davidson subspace.
672
741
       */
1011
1080
               evals[i] + enuc + efzc);
1012
1081
 
1013
1082
            if (nroots > 1) {
1014
 
               fprintf(outfile, "  (%4.3lf eV)\n", (evals[i] - evals[0]) *
1015
 
                       _hartree2ev);
 
1083
               fprintf(outfile, "  (%6.4lf eV, %9.2lf 1/cm)\n", 
 
1084
                 (evals[i] - evals[0]) * _hartree2ev,
 
1085
                 (evals[i] - evals[0]) * _hartree2wavenumbers);
1016
1086
               }
1017
1087
            else fprintf(outfile, "\n");
1018
1088
 
1078
1148
           fprintf(outfile,"Warning: Norm of "  
1079
1149
                  "correction (root %d) is < 1.0E-13\n", k);  
1080
1150
           }
 
1151
         Dvec.read(k,0); 
 
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);
 
1156
         }
1081
1157
         tval = sqrt(1.0 / tval);
1082
 
         Dvec.read(k,0); 
1083
1158
         Dvec.symnorm(tval,0,0);
1084
1159
 
1085
1160
         if (print_lvl > 4) {
1136
1211
         Cvec2.buf_unlock();
1137
1212
     */
1138
1213
 
 
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); 
1142
1218
          }
 
1219
        */
1143
1220
 
1144
1221
        iter++;
1145
1222
        iter2++;
1245
1322
       "for icore = %d\n", Parameters.icore);
1246
1323
   }
1247
1324
 
 
1325
   /* PT correction */
 
1326
   /*
 
1327
   if (Parameters.calc_pt_corr) {
 
1328
     Dvec.buf_lock(buffer1);
 
1329
     Dvec.read(0,0);
 
1330
     Dvec.pt_correction();
 
1331
     Dvec.buf_unlock();
 
1332
   }
 
1333
   */
1248
1334
 
1249
1335
   /* Compute S^2 */
1250
1336
   if (Parameters.calc_ssq && Parameters.icore==1) {