cscf: Hartree-Fock Self-Consistent-Field Module


Files

file  check_rot.cc
 Check MO rotation to make sure C cols haven't swapped.
file  cscf/cleanup.cc
 Enter brief description of file here.
file  cmatsplit.cc
 Enter brief description of file here.
file  common.h
 Enter brief description of file here.
file  cscf.cc
 Enter brief description of file here.
file  dft_inputs.cc
 Enter brief description of file here.
file  cscf/diis.cc
 Enter brief description of file here.
file  diis2_uhf.cc
 Enter brief description of file here.
file  dmat.cc
 Enter brief description of file here.
file  dmat_2.cc
 Enter brief description of file here.
file  dmatuhf.cc
 Enter brief description of file here.
file  ecalc.cc
 Enter brief description of file here.
file  errchk.cc
 Enter brief description of file here.
file  findit.cc
 Enter brief description of file here.
file  findit_uhf.cc
 Enter brief description of file here.
file  form_vec.cc
 Enter brief description of file here.
file  formg2.cc
 Enter brief description of file here.
file  formg_direct.cc
 Enter brief description of file here.
file  formgc.cc
 Enter brief description of file here.
file  formgo.cc
 Enter brief description of file here.
file  cscf/gprgid.cc
 Enter brief description of file here.
file  guess.cc
 Enter brief description of file here.
file  cscf/includes.h
 Enter brief description of file here.
file  init_scf.cc
 Enter brief description of file here.
file  init_uhf.cc
 Enter brief description of file here.
file  occ_fun.cc
 Enter brief description of file here.
file  orb_mix.cc
 Enter brief description of file here.
file  packit_c.cc
 Enter brief description of file here.
file  packit_o.cc
 Enter brief description of file here.
file  phases.cc
 Enter brief description of file here.
file  bin/cscf/rdone.cc
 Enter brief description of file here.
file  bin/cscf/rdtwo.cc
 Enter brief description of file here.
file  rotate_vector.cc
 Enter brief description of file here.
file  scf_input.cc
 Enter brief description of file here.
file  scf_iter.cc
 Enter brief description of file here.
file  scf_iter_2.cc
 Enter brief description of file here.
file  schmit.cc
 Enter brief description of file here.
file  schmit_uhf.cc
 Enter brief description of file here.
file  sdot.cc
 Enter brief description of file here.
file  shalf.cc
 Enter brief description of file here.
file  sortev.cc
 Enter brief description of file here.
file  uhf_iter.cc
 Enter brief description of file here.

Functions

void psi::cscf::check_rot (int nn, int num_mo, double **cold, double **cnew, double *smat_pac, double *fock_evals, int irrep)
void psi::cscf::swap_vectors (double **c, int nn, int j, int i)

Detailed Description


Function Documentation

void psi::cscf::check_rot ( int  nn,
int  num_mo,
double **  cold,
double **  cnew,
double *  smat_pac,
double *  fock_evals,
int  irrep 
)

check_rot(): Check if a rotation has swapped columns of C

Parameters:
nn = number of SO's in an irrep
num_mo = number of MO's in an irrep
cold = old C matrix
cnew = new C matrix
smat_pac = S matrix, packed lower triangular
fock_evals = Fock matrix eigenvalues
irrep = which irrep we're working on (starts from zero)
Returns: none

Definition at line 40 of file check_rot.cc.

References free_matrix(), init_matrix(), mmult(), psi::cscf::swap_vectors(), and tri_to_sq().

00042 {
00043   int i,j,jmaxcoeff,swapped;
00044   double maxcoeff=0.0, tval;
00045   double **smat;
00046   double **tmp1, **tmp2;
00047   static int printed=0;
00048   int count=0;
00049 
00050   smat = init_matrix(nn,nn);
00051   tmp1 = init_matrix(nn,nn);
00052   tmp2 = init_matrix(nn,nn);
00053 
00054   tri_to_sq(smat_pac,smat,nn);
00055 
00056   do {
00057       swapped = 0;
00058 /*      mxmb(cnew,nn,1,smat,1,nn,tmp1,1,nn,nn,nn,nn);
00059       mxmb(tmp1,1,nn,cold,1,nn,tmp2,1,nn,nn,nn,nn);*/
00060       mmult(cnew,1,smat,0,tmp1,0,num_mo,nn,nn,0);
00061       mmult(tmp1,0,cold,0,tmp2,0,num_mo,nn,num_mo,0);
00062 
00063 /*       fprintf(outfile, "C_New Matrix:\n");
00064          print_mat(cnew,nn,nn,outfile);
00065          fprintf(outfile, "C_New * S * C_old:\n");
00066          print_mat(tmp2,nn,nn,outfile); */
00067          
00068 
00069       for(i=0; i < num_mo; i++) {
00070         maxcoeff = 0.0;
00071         for(j=0; j < num_mo; j++) {
00072           if(fabs(tmp2[j][i]) > maxcoeff) { 
00073             maxcoeff = fabs(tmp2[j][i]);
00074             jmaxcoeff = j;
00075           }
00076         }
00077         if (maxcoeff < 0.75) {
00078            fprintf(outfile, "\n   Warning!  Diagonality check C'SC gives ");
00079            fprintf(outfile, "a maximum element of\n   %lf for (%d,%d)\n",
00080                    maxcoeff, jmaxcoeff+1, i+1);
00081            fprintf(outfile, "   Won't perform MO swapping for this column\n");
00082            }
00083         else if (jmaxcoeff != i) {
00084             swap_vectors(cnew,nn,jmaxcoeff,i);
00085             tval = fock_evals[jmaxcoeff];
00086             fock_evals[jmaxcoeff] = fock_evals[i];
00087             fock_evals[i] = tval;
00088             swapped = 1;  count++;
00089             if (!printed) {
00090                fprintf(outfile, 
00091                   "\n   Warning!  MO rotation swapped columns of C matrix\n");
00092                printed = 1;
00093                }
00094             fprintf(outfile, 
00095                "   Swapping back columns %d and %d for irrep %d\n",
00096                jmaxcoeff+1,i+1,irrep+1);
00097             break;
00098          }
00099       }
00100   } while(swapped && count < 50);
00101 
00102   if (count == 50) {
00103      fprintf(outfile, "(check_rot): This is bad.  Tried 50 swaps for ");
00104      fprintf(outfile, "irrep %d!\n", irrep+1);
00105      fprintf(outfile, "   You may want to set check_rot = false\n");
00106      }
00107 
00108   free_matrix(smat,nn);
00109   free_matrix(tmp1,nn);
00110   free_matrix(tmp2,nn);
00111   
00112   /*  
00113   fprintf(outfile, "C_New Matrix(after phase change):\n");
00114   print_mat(cnew,nn,nn,outfile); 
00115   */
00116 }

void psi::cscf::swap_vectors ( double **  c,
int  nn,
int  j,
int  i 
)

swap_vectors(): Swap two vectors of an SCF coefficient matrix

Parameters:
C = SCF coefficient matrix
nn = number of rows in C matrix (number of SO's in that irrep)
j = one of the columns to swap
i = the other column to swap
Returns: none

Definition at line 130 of file check_rot.cc.

Referenced by psi::cscf::check_rot().

00131 {
00132   int k;
00133   double tmp;
00134 
00135   for(k=0; k < nn; k++)  {
00136       tmp = c[k][j];
00137       c[k][j] = c[k][i];
00138       c[k][i] = tmp;
00139     }
00140 }


Generated on Wed Feb 13 16:36:15 2008 for PSI by  doxygen 1.5.4