Psi4
jk_independent_impl.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
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 2 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 along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _jk_independent_impl_h
29 #define _jk_independent_impl_h
30 
31 using namespace psi;
32 
33 template<class JDriver, class KDriver>
35 {
36  /*
37  if (do_J_)
38  j_driver_.initialize();
39 
40  if (do_K_ && do_separately_)
41  k_driver_.initialize();
42 */
43 }
44 
45 
46 template<class JDriver, class KDriver>
48 {
49 
50  //printf("compute_JK independent.\n");
51 
52  if (do_J_)
53  {
54  std::cout << "Doing independent J computation\n";
55 
56  timer_on("Independent_J");
57  j_driver_.Update(D_ao_);
58  j_driver_.Compute();
59  timer_off("Independent_J");
60  //J_ao_ = j_driver_.J();
61  J_ = j_driver_.J();
62 
63  //outfile->Printf( "J_ao in jk_independent\n");
64  //J_ao_[0]->print(outfile);
65  if (!do_separately_ && do_K_) {
66  std::cout << "Doing independent K computation with J driver.\n";
67  //K_ao_ = j_driver_.K();
68  //outfile->Printf( "K_ao in jk_independent\n");
69  //K_ao_[0]->print(outfile);
70  K_ = j_driver_.K();
71  }
72  }
73 
74  if (do_K_ && do_separately_)
75  {
76  std::cout << "Doing independent K computation\n";
77  timer_on("Independent_K");
78  k_driver_.Update(D_ao_);
79  k_driver_.Compute();
80  timer_off("Independent_K");
81  //K_ao_ = k_driver_.K();
82  K_ = k_driver_.K();
83  }
84 
85 }
86 
87 template<class JDriver, class KDriver>
89 {
90  /*
91  if (do_J_)
92  j_driver_.finalize();
93 
94  if (do_K_ && do_separately_)
95  k_driver_.finalize();
96  */
97 }
98 
99 template<class JDriver, class KDriver>
101 {
102  /*
103  if (do_J_)
104  j_driver_.common_init();
105 
106  if (do_K_ && do_separately_)
107  k_driver_.common_init();
108  */
109 }
110 
111 template<class JDriver, class KDriver>
112 JKIndependent<JDriver, KDriver>::JKIndependent(std::shared_ptr<BasisSet> primary,
113  bool do_separately)
114 :
115 JK(primary),
116 j_driver_(primary, D_ao_),
117 k_driver_(primary, D_ao_),
118 do_separately_(do_separately)
119 {
120 
121  j_driver_.set_do_J(do_J_);
122  j_driver_.set_do_K(do_separately_ ? false : do_K_);
123 
124  k_driver_.set_do_J(false);
125  k_driver_.set_do_K(do_separately_ ? do_K_ : false);
126 
127 }
128 
129 template<class JDriver, class KDriver>
131 {
132  // should all be taken care of automatically
133 }
134 
135 template<class JDriver, class KDriver>
137 {
138 
139  if (print_) {
140  outfile->Printf( " ==> Independent J and K computations <==\n\n");
141  outfile->Printf( "Coulomb computation: \n");
142 
143  j_driver_.print_header();
144 
145  outfile->Printf( "Exchange computation: \n");
146 
147  k_driver_.print_header();
148 
149  }
150 }
151 
152 #endif
bool do_separately_
Definition: jk_independent.h:68
virtual ~JKIndependent()
Destructor.
Definition: jk_independent_impl.h:130
virtual void postiterations()
Delete integrals, files, etc.
Definition: jk_independent_impl.h:88
virtual void print_header() const
Definition: jk_independent_impl.h:136
JDriver j_driver_
Definition: jk_independent.h:63
virtual void compute_JK()
Compute J/K for current C/D.
Definition: jk_independent_impl.h:47
bool do_J_
Do J matrices? Defaults to true.
Definition: jk.h:252
bool do_K_
Do K matrices? Defaults to true.
Definition: jk.h:254
void timer_on(const char *key)
Definition: timer.cc:239
KDriver k_driver_
Definition: jk_independent.h:64
virtual void preiterations()
Setup integrals, files, etc.
Definition: jk_independent_impl.h:34
void timer_off(const char *key)
Definition: timer.cc:315
void common_init()
Common initialization.
Definition: jk_independent_impl.h:100
std::shared_ptr< PsiOutStream > outfile
Definition: core.cc:99
Definition: jk.h:228
JKIndependent(std::shared_ptr< BasisSet > primary, bool do_separately)
Definition: jk_independent_impl.h:112