1 // 2 // BAGEL - Brilliantly Advanced General Electronic Structure Library 3 // Filename: moint.h 4 // Copyright (C) 2012 Toru Shiozaki 5 // 6 // Author: Toru Shiozaki <shiozaki@northwestern.edu> 7 // Maintainer: Shiozaki group 8 // 9 // This file is part of the BAGEL package. 10 // 11 // This program is free software: you can redistribute it and/or modify 12 // it under the terms of the GNU General Public License as published by 13 // the Free Software Foundation, either version 3 of the License, or 14 // (at your option) any later version. 15 // 16 // This program 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 General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program. If not, see <http://www.gnu.org/licenses/>. 23 // 24 25 // A base class for electorn Correlation methods 26 // Certain kinds of MO integrals are formed. 27 // - aaii (assumes DF - TODO half transformed DF vector might be available..) 28 // 29 30 #ifndef __SRC_SMITH_MOINT_H 31 #define __SRC_SMITH_MOINT_H 32 33 #include <stddef.h> 34 #include <memory> 35 #include <stdexcept> 36 #include <src/smith/smith_info.h> 37 #include <src/smith/tensor.h> 38 #include <src/scf/hf/fock.h> 39 #include <src/util/math/algo.h> 40 41 namespace bagel { 42 namespace SMITH { 43 44 // the template parameter T specifies the storage type 45 46 template<typename DataType> 47 class K2ext { 48 protected: 49 using MatType = typename std::conditional<std::is_same<DataType,double>::value,Matrix,ZMatrix>::type; 50 51 std::shared_ptr<const SMITH_Info<DataType>> info_; 52 std::shared_ptr<const MatType> coeff_; 53 std::vector<IndexRange> blocks_; 54 std::shared_ptr<Tensor_<DataType>> data_; 55 56 // some handwritten drivers init()57 void init() { assert(false); } 58 59 public: 60 K2ext(std::shared_ptr<const SMITH_Info<DataType>> r, std::shared_ptr<const MatType> c, const std::vector<IndexRange>& b); 61 tensor()62 std::shared_ptr<Tensor_<DataType>> tensor() { return data_; } 63 }; 64 template<> void K2ext<double>::init(); 65 template<> void K2ext<std::complex<double>>::init(); 66 extern template class K2ext<double>; 67 extern template class K2ext<std::complex<double>>; 68 69 70 template<typename DataType> 71 class MOFock { 72 protected: 73 using MatType = typename std::conditional<std::is_same<DataType,double>::value,Matrix,ZMatrix>::type; 74 75 std::shared_ptr<const SMITH_Info<DataType>> info_; 76 std::shared_ptr<const MatType> coeff_; 77 std::vector<IndexRange> blocks_; 78 std::shared_ptr<Tensor_<DataType>> data_; 79 std::shared_ptr<Tensor_<DataType>> h1_; 80 81 double core_energy_; 82 init()83 void init() { assert(false); } 84 85 public: 86 MOFock(std::shared_ptr<const SMITH_Info<DataType>> r, const std::vector<IndexRange>& b); 87 88 // fock operator tensor()89 std::shared_ptr<Tensor_<DataType>> tensor() { return data_; } 90 // core Fock operator minus diagonal part of the two-body integrals h1()91 std::shared_ptr<Tensor_<DataType>> h1() { return h1_; } 92 coeff()93 std::shared_ptr<const MatType> coeff() const { return coeff_; } core_energy()94 double core_energy() const { return core_energy_; } 95 }; 96 template<> void MOFock<double>::init(); 97 template<> void MOFock<std::complex<double>>::init(); 98 extern template class MOFock<double>; 99 extern template class MOFock<std::complex<double>>; 100 101 102 } 103 } 104 105 #endif 106 107