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-2017 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 
42 namespace psi{
43 
44 class IntegralTransform;
45 
46 namespace psimrcc{
47 
48 class CCMatrix;
49 
50 #include "matrix_types.h"
51 
52 #ifndef INDEX
53 #define INDEX(i,j) ((i>j) ? (ioff[(i)]+(j)) : (ioff[(j)]+(i)))
54 #endif
55 #define four(i,j,k,l) INDEX(INDEX(i,j),INDEX(k,l))
56 
58 
63 class CCSort{
64 public:
65  CCSort(SharedWavefunction ref_wfn, SortAlgorithm algorithm);
66  ~CCSort();
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 }} /* End Namespaces */
109 
110 #endif // _psi_src_bin_psimrcc_ccsort_h
std::map< std::string, psi::psimrcc::CCMatrix * >::iterator MatMapIt
Definition: sort.h:35
void allocate_and_sort_integrals_mrpt2()
Definition: sort_mrpt2.cc:74
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:87
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:100
Definition: psimrcc/matrix.h:48
~CCSort()
Definition: sort.cc:119
double add_fock_two_mrpt2(int p, int q, int k, bool exchange)
Definition: sort_mrpt2.cc:194
void form_two_electron_integrals_mrpt2(MatrixMap::iterator &iter)
Definition: sort_mrpt2.cc:204
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:278
void init()
Definition: sort.cc:127
Grabs the MO integrals from CCTransform and fills the CCMatrix objects in CCBLAS. ...
Definition: sort.h:63
void form_fock_out_of_core(CCMatrix *Matrix, int h)
Definition: sort_out_of_core.cc:169
void frozen_core_energy_out_of_core()
Definition: sort_out_of_core.cc:261
void build_integrals_mrpt2(IntegralTransform *ints)
Definition: sort_mrpt2.cc:46
Definition: sort.h:57
void form_two_electron_integrals_out_of_core(CCMatrix *Matrix, int h)
Definition: sort_out_of_core.cc:215
double efzc
Definition: sort.h:102
std::vector< std::pair< psi::psimrcc::CCMatrix *, int > > MatrixBlks
Definition: sort.h:36
double add_fock_two_out_of_core(int p, int q, int k, bool exchange)
Definition: sort_out_of_core.cc:251
void sort_integrals_out_of_core(int first_irrep, int last_irrep, MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:139
Makes using matrices just a little easier.
Definition: libmints/matrix.h:66
void build_integrals_out_of_core()
Definition: sort_out_of_core.cc:51
void form_fock_one_out_of_core(MatrixBlks &to_be_processed)
Definition: sort_out_of_core.cc:147
CCSort * sorter
Definition: psimrcc/main.cc:79
int * frozen_core
Definition: sort.h:103
void cleanup()
Definition: sort.cc:146
SortAlgorithm
Definition: sort.h:57
Definition: sort.h:57
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
Definition: integraltransform.h:58
void frozen_core_energy_mrpt2()
Definition: sort_mrpt2.cc:55
void form_fock_mrpt2(MatrixMap::iterator &iter)
Definition: sort_mrpt2.cc:98
int nfzc
Definition: sort.h:101
CCSort(SharedWavefunction ref_wfn, SortAlgorithm algorithm)
Definition: sort.cc:56
void allocate_amplitudes_mrpt2()
Definition: sort_mrpt2.cc:87