r12int_eval.h
//
// r12int_eval.h
//
// Copyright (C) 2004 Edward Valeev
//
// Author: Edward Valeev <edward.valeev@chemistry.gatech.edu>
// Maintainer: EV
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//
#ifdef __GNUG__
#pragma interface
#endif
#ifndef _chemistry_qc_mbptr12_r12inteval_h
#define _chemistry_qc_mbptr12_r12inteval_h
#include <util/ref/ref.h>
#include <chemistry/qc/mbptr12/vxb_eval_info.h>
#include <chemistry/qc/mbptr12/linearr12.h>
#include <chemistry/qc/mbptr12/r12_amps.h>
namespace sc {
class R12IntEval : virtual public SavableState {
bool evaluated_;
// Calculation information (number of basis functions, R12 approximation, etc.)
Ref<R12IntEvalInfo> r12info_;
// Note that intermediate B is symmetric but is stored as a full matrix to simplify the code
// that computes asymmetric form of B
RefSCMatrix Vaa_, Vab_, Xaa_, Xab_, Baa_, Bab_, Aaa_, Aab_, T2aa_, T2ab_;
RefSCMatrix Ac_aa_, Ac_ab_;
RefSCMatrix Raa_, Rab_; // Not sure if I'll compute and keep these explicitly later
Ref<R12Amplitudes> Amps_; // Amplitudes of various R12-contributed terms in pair functions
RefSCVector emp2pair_aa_, emp2pair_ab_;
RefSCDimension dim_ij_aa_, dim_ij_ab_, dim_ij_s_, dim_ij_t_;
RefSCDimension dim_ab_aa_, dim_ab_ab_;
bool gbc_;
bool ebc_;
LinearR12::ABSMethod abs_method_;
LinearR12::StandardApproximation stdapprox_;
bool spinadapted_;
bool include_mp1_;
bool follow_ks_ebcfree_;
int debug_;
// Map to TwoBodyMOIntsTransform objects that have been computed previously
typedef std::map<std::string, Ref<TwoBodyMOIntsTransform> > TformMap;
TformMap tform_map_;
// Returns pointer to the appropriate transform.
// If the transform is not found then throw runtime_error
Ref<TwoBodyMOIntsTransform> get_tform_(const std::string&);
Ref<MOIndexSpace> focc_space_;
void form_focc_space_();
Ref<MOIndexSpace> factocc_space_;
void form_factocc_space_();
Ref<MOIndexSpace> canonvir_space_;
void form_canonvir_space_();
void init_tforms_();
void init_intermeds_();
void r2_contrib_to_X_orig_();
void r2_contrib_to_X_new_();
RefSCMatrix compute_r2_(const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2);
RefSCMatrix fock_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
const Ref<MOIndexSpace>& ket_space, double scale_J = 1.0, double scale_K = 1.0);
RefSCMatrix coulomb_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
const Ref<MOIndexSpace>& ket_space);
RefSCMatrix exchange_(const Ref<MOIndexSpace>& occ_space, const Ref<MOIndexSpace>& bra_space,
const Ref<MOIndexSpace>& ket_space);
void checkpoint_() const;
const int tasks_with_ints_(const Ref<R12IntsAcc> ints_acc, vector<int>& map_to_twi);
void contrib_to_VXB_a_symm_(const std::string& tform_name);
void contrib_to_VXB_a_asymm_(const std::string& tform_name);
void obs_contrib_to_VXB_gebc_vbseqobs_();
void abs1_contrib_to_VXB_gebc_();
void contrib_to_VXB_gebc_vbsneqobs_();
void compute_A_simple_();
void compute_A_via_commutator_();
void compute_T2_();
void compute_R_();
void AT2_contrib_to_V_();
void AR_contrib_to_B_();
void compute_B_gbc_1_();
void compute_B_gbc_2_();
void compute_dualEmp2_();
void compute_dualEmp1_();
void compute_T2_vbsneqobs_();
void compute_R_vbsneqobs_(const Ref<TwoBodyMOIntsTransform>& ipjq_tform,
RefSCMatrix& Raa, RefSCMatrix& Rab);
void compute_amps_();
void globally_sum_scmatrix_(RefSCMatrix& A, bool to_all_tasks = false, bool to_average = false);
void globally_sum_scvector_(RefSCVector& A, bool to_all_tasks = false, bool to_average = false);
void globally_sum_intermeds_(bool to_all_tasks = false);
public:
R12IntEval(StateIn&);
R12IntEval(const Ref<R12IntEvalInfo>& info, bool gbc = true, bool ebc = true,
LinearR12::ABSMethod abs_method = LinearR12::ABS_CABSPlus,
LinearR12::StandardApproximation stdapprox = LinearR12::StdApprox_Ap,
bool follow_ks_ebcfree = false);
~R12IntEval();
void save_data_state(StateOut&);
virtual void obsolete();
void include_mp1(bool include_mp1);
void set_debug(int debug);
void set_dynamic(bool dynamic);
void set_print_percent(double print_percent);
void set_memory(size_t nbytes);
const bool gbc() const { return gbc_; }
const bool ebc() const { return ebc_; }
const LinearR12::StandardApproximation stdapprox() const { return stdapprox_; }
bool follow_ks_ebcfree() const { return follow_ks_ebcfree_; }
Ref<R12IntEvalInfo> r12info() const;
RefSCDimension dim_oo_aa() const;
RefSCDimension dim_oo_ab() const;
RefSCDimension dim_oo_s() const;
RefSCDimension dim_oo_t() const;
RefSCDimension dim_vv_aa() const;
RefSCDimension dim_vv_ab() const;
virtual void compute();
RefSCMatrix V_aa();
RefSCMatrix X_aa();
RefSymmSCMatrix B_aa();
RefSCMatrix A_aa();
RefSCMatrix Ac_aa();
RefSCMatrix T2_aa();
RefSCMatrix V_ab();
RefSCMatrix X_ab();
RefSymmSCMatrix B_ab();
RefSCMatrix A_ab();
RefSCMatrix Ac_ab();
RefSCMatrix T2_ab();
RefSCVector emp2_aa();
RefSCVector emp2_ab();
Ref<R12Amplitudes> amps();
RefDiagSCMatrix evals() const;
};
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: