add_ref_UHF.cc

Go to the documentation of this file.
00001 
00005 #include <stdio.h>
00006 #include <libiwl/iwl.h>
00007 #include "MOInfo.h"
00008 #include "Params.h"
00009 #include "Frozen.h"
00010 #define EXTERN
00011 #include "globals.h"
00012 
00013 namespace psi { namespace ccdensity {
00014 
00015 /* add_ref_UHF(): This function adds the reference contributions to
00016 ** the one- and two-particle density matrices.  These contributions
00017 ** are simply the prefactors in front of the one- and two-electron
00018 ** intgegrals, respectively, in the UHF energy expression.  In the
00019 ** case of the two-pdm, however, care must be taken that only the
00020 ** permutationally unique elements be written to disk.
00021 **
00022 ** In spin-orbitals with Mulliken-order two-electron integrals, the
00023 ** three spin contributions to the SCF energy are:
00024 **
00025 ** E_AA(SCF) = sum_I h_II + 1/2 sum_IJ ([II|JJ] - [IJ|IJ])
00026 ** E_BB(SCF) = sum_i h_ii + 1/2 sum_ij ([ii|jj] - [ij|ij])
00027 ** E_AB(SCF) = 1/2 sum_Ij [II|jj]
00028 **
00029 ** I use QT-standard ordering for the indices in these expressions.
00030 */
00031 
00032 void add_ref_UHF(struct iwlbuf *AA, struct iwlbuf *BB, struct iwlbuf *AB)
00033 {
00034   int i,j;
00035   int nfzc, nclsd, nopen;
00036 
00037   nfzc = moinfo.nfzc;
00038   nclsd = moinfo.nclsd;
00039   nopen = moinfo.nopen;
00040 
00041   /*** One-electron components ***/
00042 
00043   /* alpha-occ block */
00044   for(i=0; i < (nfzc + nclsd + nopen); i++)
00045     moinfo.opdm_a[i][i] += 1.0;
00046 
00047   /* beta-occ block */
00048   for(i=0; i < (nfzc + nclsd); i++)
00049     moinfo.opdm_b[i][i] += 1.0;
00050 
00051   /*** Two-electron components ***/
00052 
00053   /* AA */
00054   for(i=0; i < (nfzc + nclsd + nopen); i++) {
00055     for(j=0; j < i; j++) {
00056       iwl_buf_wrt_val(AA, i, i, j, j, 0.5, 0, outfile, 0);
00057 
00058       iwl_buf_wrt_val(AA, i, j, i, j,-0.25, 0, outfile, 0);
00059       iwl_buf_wrt_val(AA, j, i, j, i,-0.25, 0, outfile, 0);
00060       iwl_buf_wrt_val(AA, i, j, j, i,-0.25, 0, outfile, 0);
00061     }
00062   }
00063 
00064   /* BB */
00065   for(i=0; i < (nfzc + nclsd); i++) {
00066     for(j=0; j < i; j++) {
00067       iwl_buf_wrt_val(BB, i, i, j, j, 0.5, 0, outfile, 0);
00068 
00069       iwl_buf_wrt_val(BB, i, j, i, j,-0.25, 0, outfile, 0);
00070       iwl_buf_wrt_val(BB, j, i, j, i,-0.25, 0, outfile, 0);
00071       iwl_buf_wrt_val(BB, i, j, j, i,-0.25, 0, outfile, 0);
00072     }
00073   }
00074 
00075   /* AB */
00076   for(i=0; i < (nfzc + nclsd + nopen); i++)
00077     for(j=0; j < (nfzc + nclsd); j++)
00078       iwl_buf_wrt_val(AB, i, i, j, j, 1.0, 0, outfile, 0);
00079 
00080 }
00081 
00082 }} // namespace psi::ccdensity

Generated on Wed Feb 13 16:35:39 2008 for PSI by  doxygen 1.5.4