MPQC  3.0.0-alpha
singles_casscf.h
1 //
2 // singles_casscf.h
3 //
4 // Copyright (C) 2014 Chong Peng
5 //
6 // Authors: Chong Peng
7 // Maintainer: Chong Peng and Edward Valeev
8 //
9 // This file is part of the MPQC Toolkit.
10 //
11 // The MPQC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The MPQC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the MPQC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _mpqc_src_lib_chemistry_qc_mbptr12_singles_casscf_h
29 #define _mpqc_src_lib_chemistry_qc_mbptr12_singles_casscf_h
30 
31 
32 #if defined(MPQC_NEW_FEATURES)
33 #include <chemistry/qc/mbptr12/sr_r12intermediates.h>
34 
35 namespace sc {
36 
37  class CabsSingles {
38 
39  public:
40 
41  CabsSingles() = default;
42 
43  CabsSingles(std::shared_ptr <SingleReference_R12Intermediates<double>> srr12intrmds, bool extra_basis) : singles_r12intrmds_(srr12intrmds), extra_basis_(extra_basis){}
44 
45  ~CabsSingles() = default;
46 
47  double compute(const std::string &h0);
48  void obsolete() { singles_r12intrmds_ = NULL; }
49  void print(std::ostream& os = ExEnv::out0()) const;
50 
51  const bool extra_basis() {return extra_basis_;}
52  const std::shared_ptr <SingleReference_R12Intermediates<double>> r12intermediates() { return singles_r12intrmds_; }
53 
54 
55  private:
56 
57  template<typename T>
58  struct CabsSingles_ {
59 
60  typedef TA::Array<T, 4> Array4;
61  typedef TA::Array<T, 2> Array2;
62 
63  const Array4& Bmatrix;
64 
65  CabsSingles_(const Array4& B) : Bmatrix(B){
66  }
67 
72  void operator()(const Array2& C, Array2& BC) {
73  BC("x,B'") = Bmatrix("x,B',y,A'") * C("y,A'");
74  }
75  };
76 
78  template <typename T>
79  struct DiagPrecond2 {
80  typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> EigenMatrixX;
81  DiagPrecond2(const EigenMatrixX& O1_mat,
82  const EigenMatrixX& O2_mat) :
83  O1_mat_(O1_mat), O2_mat_(O2_mat) {
84  }
85  template <typename Index> T operator()(const Index& i) {
86  return 1.0 / (- O1_mat_(i[0], i[0]) + O2_mat_(i[1], i[1]));
87  }
88 
89  private:
90  EigenMatrixX O1_mat_;
91  EigenMatrixX O2_mat_;
92  };
93 
94  std::shared_ptr <SingleReference_R12Intermediates<double>> singles_r12intrmds_;
95  bool extra_basis_;
96 
97  // compute CABS singles correction using Fock operator as H0
98  double CabsSinglesFock();
99  // compute CABS singles correction using two-body operators in H0
100  double CabsSinglesDyall(const std::string &h0);
101  };
102 
103 }
104 
105 #endif
106 #endif // end of header guard CABS_SINGLE
107 
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

Generated at Sun Jan 26 2020 23:23:59 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.