psi::psimrcc::CCManyBody Class Reference

#include <manybody.h>

Inheritance diagram for psi::psimrcc::CCManyBody:

psi::psimrcc::CCMRCC psi::psimrcc::IDMRPT2

Public Member Functions

 CCManyBody ()
virtual ~CCManyBody ()
void generate_integrals ()
void generate_denominators ()
void compute_reference_energy ()
void make_fock_matrix ()
void make_denominators ()
void print_method (const char *text)
void zero_internal_amps ()
void zero_t1_internal_amps ()
void zero_internal_delta_amps ()

Protected Member Functions

void print_eigensystem (int ndets, double **Heff, double *&eigenvector)
double diagonalize_Heff (int root, int ndets, double **Heff, double *&eigenvector, bool initial)
void sort_eigensystem (int ndets, double *&real, double *&imaginary, double **&left, double **&right)
double c_H_c (int ndets, double **H, double *&c)
void generate_triples_denominators ()
void generate_d3_ijk (double ***&d3, bool alpha_i, bool alpha_j, bool alpha_k)
void generate_d3_abc (double ***&d3, bool alpha_a, bool alpha_b, bool alpha_c)
void deallocate_triples_denominators ()

Protected Attributes

double * zeroth_order_eigenvector
double * eigenvector
double ** Heff
double ** Heff_mrpt2
double current_energy
double cas_energy
double old_energy
double huge
double total_time
double norm_amps
double delta_t1_amps
double delta_t2_amps
int diis_step
TriplesType triples_type
TriplesCouplingType triples_coupling_type
double *** d3_ooo
double *** d3_ooO
double *** d3_oOO
double *** d3_OOO
double *** d3_vvv
double *** d3_vvV
double *** d3_vVV
double *** d3_VVV

Detailed Description

Author:
Francesco Evangelista <frank@ccc.uga.edu>

Definition at line 41 of file manybody.h.


Constructor & Destructor Documentation

psi::psimrcc::CCManyBody::CCManyBody (  ) 

Allocate the effective Hamiltonian matrices and eigenvectors

Todo:
wrap the current operations in an init() function

Definition at line 38 of file manybody.cc.

References psi::psimrcc::MOInfo::get_nrefs().

00039 {
00040   // Allocate memory for the eigenvector and the effective Hamiltonian
00041   allocate1(double,zeroth_order_eigenvector,moinfo->get_nrefs());
00042   allocate1(double,eigenvector,moinfo->get_nrefs());
00043   allocate2(double,Heff,moinfo->get_nrefs(),moinfo->get_nrefs());
00044   allocate2(double,Heff_mrpt2,moinfo->get_nrefs(),moinfo->get_nrefs());
00045 
00046   huge  = 1.0e100;
00047   norm_amps = 0.0;
00048   delta_t1_amps = 0.0;
00049   delta_t2_amps = 0.0;
00050   d3_ooo = d3_ooO = d3_oOO = d3_OOO =  d3_vvv = d3_vvV = d3_vVV = d3_VVV = NULL;
00051 }

psi::psimrcc::CCManyBody::~CCManyBody (  )  [virtual]

Deallocate the effective Hamiltonian matrices and eigenvectors

Todo:
wrap the current operations in an cleanup() function

Definition at line 57 of file manybody.cc.

00058 {
00059   release1(zeroth_order_eigenvector);
00060   release1(eigenvector);
00061   release2(Heff);
00062   release2(Heff_mrpt2);
00063 
00064   if(triples_type>ccsd)
00065     deallocate_triples_denominators();
00066 }


Member Function Documentation

void psi::psimrcc::CCManyBody::generate_integrals (  ) 

Creates a CCSort object and stores the address in the global pointer sorter

Definition at line 71 of file manybody.cc.

References psi::psimrcc::CCBLAS::compute_storage_strategy(), and psi::psimrcc::Timer::get().

00072 {
00073   Timer timer;
00074   DEBUGGING(1,
00075     fprintf(outfile,"\n\tvoid CCManyBody::generate_integrals()");
00076     fflush(outfile);
00077   )
00078   // CCSort reads the one and two electron integrals
00079   // and creates the Fock matrices
00080   sorter   = new CCSort(out_of_core_sort);
00081 //   blas->show_storage();
00082   blas->compute_storage_strategy();
00083 //   blas->show_storage();
00084 
00085   DEBUGGING(1,
00086     fprintf(outfile," done. Timing %20.6f s",timer.get());
00087     fflush(outfile);
00088   )
00089 }

void psi::psimrcc::CCManyBody::generate_denominators (  ) 

Generates the MP denominators

\[ \Delta_{ij...}^{ab...}(\mu) = f_{ii}(\mu) + f_{jj}(\mu) + ... - f_{aa}(\mu) - f_{bb}(\mu) - ... \]

where the excitations that are not allowed in reference $ \mu $ are set to a large value (see huge)

Definition at line 96 of file manybody.cc.

References psi::psimrcc::MOInfo::get_aocc(), psi::psimrcc::MOInfo::get_avir(), psi::psimrcc::MOInfo::get_bocc(), psi::psimrcc::MOInfo::get_bvir(), psi::psimrcc::CCMatTmp::get_CCMatrix(), psi::psimrcc::CCBLAS::get_MatrixMap(), psi::psimrcc::CCBLAS::get_MatTmp(), psi::psimrcc::MOInfo::get_nirreps(), psi::psimrcc::MOInfo::get_nocc(), psi::psimrcc::MOInfo::get_nvir(), and psi::psimrcc::CCMatrix::get_two_address_element().

00097 {
00098   START_TIMER(1,"Generating Denominators");
00099 //   for_each(blas->get_MatrixMap_begin(),blas->get_MatrixMap_end(),generate_denominator_element);  
00100 
00101   bool keep_denominators_in_core = false;
00102   if(options->get_str_option("CORR_WFN")=="PT2")
00103     keep_denominators_in_core = true;
00104 
00105   MatrixMap& matrix_map = blas->get_MatrixMap();
00106   MatrixMap::iterator end_iter = matrix_map.end();
00107   for(MatrixMap::iterator iter=matrix_map.begin();iter!=end_iter;++iter){
00108     string str = iter->first;
00109     if(str.find("d1")!=string::npos){
00110 
00111       CCMatTmp MatTmp = blas->get_MatTmp(str,( keep_denominators_in_core ? none : dump));
00112      
00113       bool alpha = true;
00114       if((str.find("O")!=string::npos) || (str.find("V")!=string::npos))
00115         alpha = false;
00116 
00117       double*** matrix = MatTmp->get_matrix();
00118       int reference = MatTmp->get_reference();
00119 
00120       // N.B. Never introduce Matrices/Vectors with O or V in the name before you compute the Fock matrix elements
00121       std::vector<int> aocc     = moinfo->get_aocc("a",reference);
00122       std::vector<int> bocc     = moinfo->get_bocc("a",reference);
00123       std::vector<int> avir     = moinfo->get_avir("a",reference);
00124       std::vector<int> bvir     = moinfo->get_bvir("a",reference);
00125 
00126       // Build the is_ arrays for reference ref
00127       bool* is_aocc = new bool[moinfo->get_nocc()];
00128       bool* is_bocc = new bool[moinfo->get_nocc()];
00129       bool* is_avir = new bool[moinfo->get_nvir()];
00130       bool* is_bvir = new bool[moinfo->get_nvir()];
00131       for(int i=0;i<moinfo->get_nocc();i++){
00132         is_aocc[i]=false;
00133         is_bocc[i]=false;
00134       }
00135       for(int i=0;i<moinfo->get_nvir();i++){
00136         is_avir[i]=false;
00137         is_bvir[i]=false;
00138       }
00139       for(int i=0;i<aocc.size();i++) is_aocc[aocc[i]]=true;
00140       for(int i=0;i<bocc.size();i++) is_bocc[bocc[i]]=true;
00141       for(int i=0;i<avir.size();i++) is_avir[avir[i]]=true;
00142       for(int i=0;i<bvir.size();i++) is_bvir[bvir[i]]=true;
00143 
00144       // Read the Fock matrices
00145       CCMatTmp f_oo_Matrix = blas->get_MatTmp("fock[o][o]",reference,( keep_denominators_in_core ? none : dump));
00146       CCMatTmp f_OO_Matrix = blas->get_MatTmp("fock[O][O]",reference,( keep_denominators_in_core ? none : dump));
00147       CCMatTmp f_vv_Matrix = blas->get_MatTmp("fock[v][v]",reference,( keep_denominators_in_core ? none : dump));
00148       CCMatTmp f_VV_Matrix = blas->get_MatTmp("fock[V][V]",reference,( keep_denominators_in_core ? none : dump));
00149 
00150       CCMatrix* f_ii_Matrix;
00151       CCMatrix* f_aa_Matrix;
00152 
00153       if(alpha)
00154         f_ii_Matrix = f_oo_Matrix.get_CCMatrix();
00155       else
00156         f_ii_Matrix = f_OO_Matrix.get_CCMatrix();
00157       if(alpha)
00158         f_aa_Matrix = f_vv_Matrix.get_CCMatrix();
00159       else
00160         f_aa_Matrix = f_VV_Matrix.get_CCMatrix();
00161 
00162       short* ia = new short[2];
00163       for(int n=0;n<moinfo->get_nirreps();n++)
00164         for(int i = 0;i<MatTmp->get_left_pairpi(n);i++)
00165           for(int j = 0;j<MatTmp->get_right_pairpi(n);j++){
00166             MatTmp->get_two_indices(ia,n,i,j);
00167 
00168             // Set the denomiator to huge by default
00169             matrix[n][i][j]=huge;
00170 
00171             if(alpha){
00172               // Build the denominator
00173               if(is_aocc[ia[0]] && is_avir[ia[1]]){
00174                 matrix[n][i][j] =f_ii_Matrix->get_two_address_element(ia[0],ia[0]);
00175                 matrix[n][i][j]-=f_aa_Matrix->get_two_address_element(ia[1],ia[1]);
00176               }
00177             }else{
00178               // Build the denominator
00179               if(is_bocc[ia[0]] && is_bvir[ia[1]]){
00180                 matrix[n][i][j] =f_ii_Matrix->get_two_address_element(ia[0],ia[0]);
00181                 matrix[n][i][j]-=f_aa_Matrix->get_two_address_element(ia[1],ia[1]);
00182               }
00183             }
00184           } // End loop over n,i,j
00185       delete[] is_aocc;
00186       delete[] is_bocc;
00187       delete[] is_avir;
00188       delete[] is_bvir;
00189       delete[] ia;
00190     } // End "if d1"
00191 
00192     if(str.find("d2")!=string::npos){
00193       CCMatTmp MatTmp = blas->get_MatTmp(str,( keep_denominators_in_core ? none : dump));
00194 
00195       double*** matrix = MatTmp->get_matrix();
00196       int reference = MatTmp->get_reference();
00197 
00198       // N.B. Never introduce Matrices/Vectors with O or V in the name before you compute the Fock matrix elements
00199       std::vector<int> aocc     = moinfo->get_aocc("a",reference);
00200       std::vector<int> bocc     = moinfo->get_bocc("a",reference);
00201       std::vector<int> avir     = moinfo->get_avir("a",reference);
00202       std::vector<int> bvir     = moinfo->get_bvir("a",reference);
00203 
00204       // Build the is_ arrays for reference ref
00205       bool* is_aocc = new bool[moinfo->get_nocc()];
00206       bool* is_bocc = new bool[moinfo->get_nocc()];
00207       bool* is_avir = new bool[moinfo->get_nvir()];
00208       bool* is_bvir = new bool[moinfo->get_nvir()];
00209       for(int i=0;i<moinfo->get_nocc();i++){
00210         is_aocc[i]=false;
00211         is_bocc[i]=false;
00212       }
00213       for(int i=0;i<moinfo->get_nvir();i++){
00214         is_avir[i]=false;
00215         is_bvir[i]=false;
00216       }
00217       for(int i=0;i<aocc.size();i++) is_aocc[aocc[i]]=true;
00218       for(int i=0;i<bocc.size();i++) is_bocc[bocc[i]]=true;
00219       for(int i=0;i<avir.size();i++) is_avir[avir[i]]=true;
00220       for(int i=0;i<bvir.size();i++) is_bvir[bvir[i]]=true;
00221 
00222       bool alpha = false;
00223       bool beta  = false;
00224       if((str.find("o")!=string::npos) || (str.find("v")!=string::npos))
00225         alpha= true;
00226       if((str.find("O")!=string::npos) || (str.find("V")!=string::npos))
00227         beta = true;
00228 
00229       // Read the Fock matrices
00230       CCMatTmp f_oo_Matrix = blas->get_MatTmp("fock[oo]",reference,( keep_denominators_in_core ? none : dump));
00231       CCMatTmp f_OO_Matrix = blas->get_MatTmp("fock[OO]",reference,( keep_denominators_in_core ? none : dump));
00232       CCMatTmp f_vv_Matrix = blas->get_MatTmp("fock[vv]",reference,( keep_denominators_in_core ? none : dump));
00233       CCMatTmp f_VV_Matrix = blas->get_MatTmp("fock[VV]",reference,( keep_denominators_in_core ? none : dump));
00234 
00235       CCMatrix* f_ii_Matrix;
00236       CCMatrix* f_jj_Matrix;
00237       CCMatrix* f_aa_Matrix;
00238       CCMatrix* f_bb_Matrix;
00239 
00240       if(alpha && !beta){
00241         f_ii_Matrix = f_oo_Matrix.get_CCMatrix();
00242         f_jj_Matrix = f_oo_Matrix.get_CCMatrix();
00243         f_aa_Matrix = f_vv_Matrix.get_CCMatrix();
00244         f_bb_Matrix = f_vv_Matrix.get_CCMatrix();
00245       }else if(alpha && beta){
00246         f_ii_Matrix = f_oo_Matrix.get_CCMatrix();
00247         f_jj_Matrix = f_OO_Matrix.get_CCMatrix();
00248         f_aa_Matrix = f_vv_Matrix.get_CCMatrix();
00249         f_bb_Matrix = f_VV_Matrix.get_CCMatrix();
00250       }else if(!alpha && beta){
00251         f_ii_Matrix = f_OO_Matrix.get_CCMatrix();
00252         f_jj_Matrix = f_OO_Matrix.get_CCMatrix();
00253         f_aa_Matrix = f_VV_Matrix.get_CCMatrix();
00254         f_bb_Matrix = f_VV_Matrix.get_CCMatrix();
00255       }
00256 
00257       short* ijab = new short[4];
00258       for(int n=0;n<moinfo->get_nirreps();n++)
00259         for(int i = 0;i<MatTmp->get_left_pairpi(n);i++)
00260           for(int j = 0;j<MatTmp->get_right_pairpi(n);j++){
00261             MatTmp->get_four_indices(ijab,n,i,j);
00262 
00263             // Set the denomiator to huge by default
00264             matrix[n][i][j]=huge;
00265 
00266             if(alpha && !beta){
00267               // Build the denominator
00268               if(is_aocc[ijab[0]] && is_aocc[ijab[1]] && is_avir[ijab[2]] && is_avir[ijab[3]]){
00269                 matrix[n][i][j] =f_ii_Matrix->get_two_address_element(ijab[0],ijab[0]);
00270                 matrix[n][i][j]+=f_jj_Matrix->get_two_address_element(ijab[1],ijab[1]);
00271                 matrix[n][i][j]-=f_aa_Matrix->get_two_address_element(ijab[2],ijab[2]);
00272                 matrix[n][i][j]-=f_bb_Matrix->get_two_address_element(ijab[3],ijab[3]);
00273               }
00274             }else if(alpha && beta){
00275               // Build the denominator
00276               if(is_aocc[ijab[0]] && is_bocc[ijab[1]] && is_avir[ijab[2]] && is_bvir[ijab[3]]){
00277                 matrix[n][i][j] =f_ii_Matrix->get_two_address_element(ijab[0],ijab[0]);
00278                 matrix[n][i][j]+=f_jj_Matrix->get_two_address_element(ijab[1],ijab[1]);
00279                 matrix[n][i][j]-=f_aa_Matrix->get_two_address_element(ijab[2],ijab[2]);
00280                 matrix[n][i][j]-=f_bb_Matrix->get_two_address_element(ijab[3],ijab[3]);
00281               }
00282             }else if(!alpha && beta){
00283               // Build the denominator
00284               if(is_bocc[ijab[0]] && is_bocc[ijab[1]] && is_bvir[ijab[2]] && is_bvir[ijab[3]]){
00285                 matrix[n][i][j] =f_ii_Matrix->get_two_address_element(ijab[0],ijab[0]);
00286                 matrix[n][i][j]+=f_jj_Matrix->get_two_address_element(ijab[1],ijab[1]);
00287                 matrix[n][i][j]-=f_aa_Matrix->get_two_address_element(ijab[2],ijab[2]);
00288                 matrix[n][i][j]-=f_bb_Matrix->get_two_address_element(ijab[3],ijab[3]);
00289               }
00290             }
00291           } // End loop over n,i,j
00292       delete[] is_aocc;
00293       delete[] is_bocc;
00294       delete[] is_avir;
00295       delete[] is_bvir;
00296       delete[] ijab;
00297     } // End "if d2"
00298   } // End for each reference
00299   END_TIMER(1);
00300 }

void psi::psimrcc::CCManyBody::compute_reference_energy (  ) 

Computes the energy for each unique reference determinant

Definition at line 497 of file manybody.cc.

References psi::psimrcc::Timer::get(), psi::psimrcc::MOInfo::get_aocc(), psi::psimrcc::MOInfo::get_bocc(), psi::psimrcc::MOInfo::get_fzcore_energy(), psi::psimrcc::CCBLAS::get_MatTmp(), psi::psimrcc::MOInfo::get_nuclear_energy(), psi::psimrcc::MOInfo::get_nunique(), psi::psimrcc::MOInfo::get_ref_number(), and psi::psimrcc::CCBLAS::print().

00498 {
00499   Timer timer;
00500   DEBUGGING(3,
00501     fprintf(outfile,"\n\tvoid CCManyBody::compute_reference_energy()");
00502     fflush(outfile);
00503   )
00504 
00505   // Compute the zeroth-order energy for the unique references
00506   for(int n=0;n<moinfo->get_nunique();n++){
00507     int unique_n = moinfo->get_ref_number("u",n);
00508     double ref_energy=moinfo->get_nuclear_energy()+moinfo->get_fzcore_energy();
00509     // Grab reference n and the list of occupied orbitals
00510     std::vector<int> aocc     = moinfo->get_aocc("u",n);
00511     std::vector<int> bocc     = moinfo->get_bocc("u",n);
00512 
00513     // Read these matrices
00514     CCMatTmp f_oo_Matrix = blas->get_MatTmp("fock[o][o]",unique_n,none);
00515     CCMatTmp f_OO_Matrix = blas->get_MatTmp("fock[O][O]",unique_n,none);
00516     CCMatTmp V_oooo_Matrix = blas->get_MatTmp("<[oo]:[oo]>",none);
00517     CCMatTmp V_oOoO_Matrix = blas->get_MatTmp("<[oo]|[oo]>",none);
00518 
00519     for(int i=0;i<aocc.size();i++)
00520       ref_energy+=f_oo_Matrix->get_two_address_element(aocc[i],aocc[i]);
00521     for(int i=0;i<bocc.size();i++)
00522       ref_energy+=f_OO_Matrix->get_two_address_element(bocc[i],bocc[i]);
00523 
00524     for(int i=0;i<aocc.size();i++)
00525       for(int j=0;j<aocc.size();j++)
00526         ref_energy -= 0.5 * V_oooo_Matrix->get_four_address_element(aocc[i],aocc[j],aocc[i],aocc[j]);
00527     for(int i=0;i<bocc.size();i++)
00528       for(int j=0;j<bocc.size();j++)
00529         ref_energy -= 0.5 * V_oooo_Matrix->get_four_address_element(bocc[i],bocc[j],bocc[i],bocc[j]);
00530     for(int i=0;i<aocc.size();i++)
00531       for(int j=0;j<bocc.size();j++)
00532         ref_energy -= V_oOoO_Matrix->get_four_address_element(aocc[i],bocc[j],aocc[i],bocc[j]);
00533     // Write the energy to the ERef
00534     CCMatTmp ERef_Matrix = blas->get_MatTmp("ERef",unique_n,none);
00535     ERef_Matrix->set_scalar(ref_energy);
00536   }
00537 
00538 
00539   DEBUGGING(3,
00540     blas->print("ERef{u}");
00541     fprintf(outfile," done. Timing %20.6f s",timer.get());
00542     fflush(outfile);
00543   )
00544 }

double psi::psimrcc::CCManyBody::diagonalize_Heff ( int  root,
int  ndets,
double **  Heff,
double *&  eigenvector,
bool  initial 
) [protected]

This function computes the left and right eigenvalues of a generic real matrix

Parameters:
root selects the root for which the left-eigenvector must be saved
ndets size of the matrix
Heff the $ \mathbf{H}^{\mathrm{eff}} $ matrix stored as a double**
eigenvector the $ \mathbf{c} $ left-eigenvector stored as a double* *
initial a bool used to enable root following. initial = true allows you to select a root while initial = false follows the root that has the largest overlap with the previous eigenvector
Returns:

Definition at line 594 of file manybody.cc.

00595 {
00596     double      energy;
00597     double*     real;
00598     double*     imaginary;
00599     double*     work;
00600     double**    left;
00601     double**    right;
00602     double**    H;
00603 
00604     int lwork = 6*ndets*ndets;
00605     allocate1(double,work,lwork);
00606     allocate1(double,real,ndets);
00607     allocate1(double,imaginary,ndets);
00608 
00609     allocate2(double,H,ndets,ndets);
00610     allocate2(double,left,ndets,ndets);
00611     allocate2(double,right,ndets,ndets);
00612 
00613     for(int i=0;i<ndets;i++)
00614       for(int j=0;j<ndets;j++)
00615         H[j][i] = Heff[i][j];
00616 
00617     int info;
00618 
00619     F_DGEEV("V","V",&ndets, &(H[0][0]), &ndets, &(real[0]), &(imaginary[0]),
00620        &(left[0][0]), &ndets, &(right[0][0]), &ndets, &(work[0]), &lwork, &info);
00621 
00622     sort_eigensystem(ndets,real,imaginary,left,right);
00623 
00624     if(initial){
00625     fprintf(outfile,"\n\n\tHeff Matrix\n");
00626     for(int i=0;i<ndets;i++){
00627       fprintf(outfile,"\n\t");
00628       for(int j=0;j<ndets;j++)
00629         fprintf(outfile," %22.15f",Heff[i][j]);
00630     }
00631 
00632     fprintf(outfile,"\n\n\tLeft Matrix\n");
00633     for(int i=0;i<ndets;i++){
00634       fprintf(outfile,"\n\t");
00635       for(int j=0;j<ndets;j++)
00636         fprintf(outfile," %22.15f",left[j][i]);
00637     }
00638 
00639     fprintf(outfile,"\n\n\tRight Matrix\n");
00640     for(int i=0;i<ndets;i++){
00641       fprintf(outfile,"\n\t");
00642       for(int j=0;j<ndets;j++)
00643         fprintf(outfile," %22.15f",right[j][i]);
00644     }
00645 
00646     fprintf(outfile,"\n\n\tReal                  Imaginary\n");
00647     for(int i=0;i<ndets;i++)
00648       fprintf(outfile,"\n\t%22.15f   %22.15f",real[i],imaginary[i]);
00649     fprintf(outfile,"\n");
00650     }
00651 
00652     // Select the eigenvector to follow
00653     if(initial){
00654       for(int k=0;k<ndets;k++){
00655         zeroth_order_eigenvector[k] = right[root][k];
00656         eigenvector[k]              = right[root][k];
00657       }
00658       energy = real[root];
00659       // Eliminate the triplet solution if required
00660       if((options->get_bool_option("LOCK_SINGLET")==1)&&(ndets==4)){
00661         if((fabs(eigenvector[0])<5.0e-2)&& (fabs(eigenvector[3])<5.0e-2) && ((eigenvector[1]/eigenvector[2])<-0.5)){
00662           fprintf(outfile,"\n\tSelecting root %d since original root is a triplet\n",root+1,root);
00663           root++;
00664           for(int k=0;k<ndets;k++)
00665             eigenvector[k]=right[root][k];
00666           energy = real[root];
00667         }
00668       }
00669     }
00670     else // find vector with maximum overlap
00671     {
00672       int select_vect=0;
00673       double max_overlap=0.0;
00674       double overlap=0.0;
00675       for(int i=0;i<ndets;i++){
00676           overlap=0.0;
00677           for(int m=0;m<ndets;m++)
00678               overlap+=zeroth_order_eigenvector[m]*right[i][m];
00679           overlap=sqrt(overlap*overlap);
00680           if(overlap>max_overlap){
00681               select_vect=i;
00682               max_overlap=overlap;
00683           }
00684       }
00685       for(int m=0;m<ndets;m++)
00686         eigenvector[m]=right[select_vect][m];
00687       energy = real[select_vect];
00688     }
00689     release1(work);
00690     release1(real);
00691     release1(imaginary);
00692     release2(H);
00693     release2(left);
00694     release2(right);
00695     return(energy);
00696 }

double psi::psimrcc::CCManyBody::c_H_c ( int  ndets,
double **  H,
double *&  c 
) [protected]

This function computes $ E = \mathbf{c}^{\dagger} \mathbf{H} \mathbf{c} $

Parameters:
ndets size of the $ \mathbf{c} $ vector
H the $ \mathbf{H} $ matrix stored as a double**
c the $ \mathbf{c} $ vector stored as a double*
Returns:
$ E $

Definition at line 577 of file manybody.cc.

00578 {
00579     double energy = 0.0;
00580     for(int i=0;i<ndets;i++)
00581       for(int j=0;j<ndets;j++)
00582         energy += c[i]*H[i][j]*c[j];
00583     return(energy);
00584 }


The documentation for this class was generated from the following files:
Generated on Wed Feb 13 16:36:16 2008 for PSI by  doxygen 1.5.4