Psi4
sort.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-2018 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_bin_psimrcc_ccsort_h
30 #define _psi_src_bin_psimrcc_ccsort_h
31 
37 #include <iostream>
38 #include <map>
39 #include <vector>
40 
41 namespace psi {
42 
43 class IntegralTransform;
44 
45 namespace psimrcc {
46 
47 class CCMatrix;
48 
49 #include "matrix_types.h"
50 
51 #ifndef INDEX
52 #define INDEX(i, j) ((i > j) ? (ioff[(i)] + (j)) : (ioff[(j)] + (i)))
53 #endif
54 #define four(i, j, k, l) INDEX(INDEX(i, j), INDEX(k, l))
55 
57 
62 class CCSort {
63  public:
64  CCSort(SharedWavefunction ref_wfn, SortAlgorithm algorithm);
65  ~CCSort();
66 
67  private:
68  void init();
69  void cleanup();
70 
71  // // In-core algorithm
72  // void build_integrals_in_core();
73  // void frozen_core_energy_in_core();
74  // void sort_integrals_in_core();
75  // void form_two_electron_integrals_in_core(MatrixMap::iterator& iter);
76  // void form_fock_in_core(MatrixMap::iterator& iter);
77  // double add_fock_two_in_core(int p, int q, int k, bool exchange);
78 
79  // Out-of-core algorithm
82  void sort_integrals_out_of_core(int first_irrep, int last_irrep, MatrixBlks& to_be_processed);
83  void form_fock_one_out_of_core(MatrixBlks& to_be_processed);
86  double add_fock_two_out_of_core(int p, int q, int k, bool exchange);
87  void setup_out_of_core_list(MatMapIt& mat_it, int& mat_irrep, MatMapIt& mat_end, MatrixBlks& to_be_processed);
88  void dump_integrals_to_disk(MatrixBlks& to_be_processed);
89 
90  // MRPT2 algorithm
95  void form_two_electron_integrals_mrpt2(MatrixMap::iterator& iter);
96  void form_fock_mrpt2(MatrixMap::iterator& iter);
97  double add_fock_two_mrpt2(int p, int q, int k, bool exchange);
98 
99  // Data
101  int nfzc;
102  double efzc;
104 };
105 
106 extern CCSort* sorter;
107 
108 } // namespace psimrcc
109 } // namespace psi
110 
111 #endif // _psi_src_bin_psimrcc_ccsort_h
void allocate_and_sort_integrals_mrpt2()
Definition: sort_mrpt2.cc:73
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:86
void setup_out_of_core_list(MatMapIt &mat_it, int &mat_irrep, MatMapIt &mat_end, MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:99
Definition: psimrcc/matrix.h:49
~CCSort()
Definition: sort.cc:112
double add_fock_two_mrpt2(int p, int q, int k, bool exchange)
Definition: sort_mrpt2.cc:192
void form_two_electron_integrals_mrpt2(MatrixMap::iterator &iter)
Definition: sort_mrpt2.cc:200
double fraction_of_memory_for_sorting
Definition: sort.h:100
void dump_integrals_to_disk(MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:266
void init()
Definition: sort.cc:117
Grabs the MO integrals from CCTransform and fills the CCMatrix objects in CCBLAS. ...
Definition: sort.h:62
void form_fock_out_of_core(CCMatrix *Matrix, int h)
Definition: sort_out_of_core.cc:163
std::map< std::string, psi::psimrcc::CCMatrix * >::iterator MatMapIt
Definition: sort.h:35
std::vector< std::pair< psi::psimrcc::CCMatrix *, int > > MatrixBlks
Definition: sort.h:36
void frozen_core_energy_out_of_core()
Definition: sort_out_of_core.cc:250
void build_integrals_mrpt2(IntegralTransform *ints)
Definition: sort_mrpt2.cc:47
Definition: sort.h:56
void form_two_electron_integrals_out_of_core(CCMatrix *Matrix, int h)
Definition: sort_out_of_core.cc:209
double efzc
Definition: sort.h:102
double add_fock_two_out_of_core(int p, int q, int k, bool exchange)
Definition: sort_out_of_core.cc:242
void sort_integrals_out_of_core(int first_irrep, int last_irrep, MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:135
Makes using matrices just a little easier.
Definition: libmints/matrix.h:59
void build_integrals_out_of_core()
Definition: sort_out_of_core.cc:52
void form_fock_one_out_of_core(MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:142
CCSort * sorter
Definition: psimrcc/main.cc:79
int * frozen_core
Definition: sort.h:103
void cleanup()
Definition: sort.cc:134
SortAlgorithm
Definition: sort.h:56
Definition: sort.h:56
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
Definition: integraltransform.h:59
void frozen_core_energy_mrpt2()
Definition: sort_mrpt2.cc:55
void form_fock_mrpt2(MatrixMap::iterator &iter)
Definition: sort_mrpt2.cc:95
int nfzc
Definition: sort.h:101
CCSort(SharedWavefunction ref_wfn, SortAlgorithm algorithm)
Definition: sort.cc:57
void allocate_amplitudes_mrpt2()
Definition: sort_mrpt2.cc:85