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 
57 enum SortAlgorithm {out_of_core_sort,mrpt2_sort};
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
80  void build_integrals_out_of_core();
81  void frozen_core_energy_out_of_core();
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);
84  void form_fock_out_of_core(CCMatrix* Matrix, int h);
85  void form_two_electron_integrals_out_of_core(CCMatrix* Matrix, int h);
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
91  void build_integrals_mrpt2(IntegralTransform *ints);
92  void frozen_core_energy_mrpt2();
93  void allocate_and_sort_integrals_mrpt2();
94  void allocate_amplitudes_mrpt2();
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
100  double fraction_of_memory_for_sorting;
101  int nfzc;
102  double efzc;
103  int* frozen_core;
104 };
105 
106 extern CCSort *sorter;
107 
108 }} /* End Namespaces */
109 
110 #endif // _psi_src_bin_psimrcc_ccsort_h
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:87
std::vector< std::pair< psi::psimrcc::CCMatrix *, int > > MatrixBlks
Definition: matrix_types.h:35
CCSort * sorter
Definition: psimrcc/main.cc:79
std::map< std::string, psi::psimrcc::CCMatrix * >::iterator MatMapIt
Definition: matrix_types.h:34
void cleanup(void)
Definition: ccdensity/get_moinfo.cc:297
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:52