Psi4
ccwave.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 CCWAVE_H
30 #define CCWAVE_H
31 
32 #include <array>
33 
35 #include "psi4/libdpd/dpd.h"
36 
37 #include "ccenergy/MOInfo.h"
38 #include "ccenergy/Params.h"
39 #include "ccenergy/Local.h"
40 
41 namespace psi {
42 class Options;
43 struct dpdfile2;
44 struct dpdbuf4;
45 struct iwlbuf;
46 } // namespace psi
47 
48 namespace psi {
49 namespace ccenergy {
50 
52  public:
53  CCEnergyWavefunction(std::shared_ptr<Wavefunction> reference_wavefunction, Options &options);
54  virtual ~CCEnergyWavefunction();
55 
56  double compute_energy();
57 
58  private:
59  /* setup, info and teardown */
60  void init();
61  void init_io();
62  void exit_io();
63  void cleanup();
64  void status(const char *, std::string);
65  void title();
66 
67  /* calculation info */
68  void get_moinfo();
69  void get_params(Options &);
70 
71  /* amplitude handling */
72  void init_amps();
73  void sort_amps();
74  void tsave();
75  void ccdump();
76  void spinad_amps();
77  void amp_write();
78  void checkpoint();
79 
80  /* intermediates */
81  void update();
82  void Fae_build();
83  void Fmi_build();
84  void Fme_build();
85  void Wmnij_build();
86  void Wmbej_build();
87  void purge_Wabei();
88  void purge_Wmnij();
89  void purge_Wmnie();
90  void purge_Wmbij();
91  void purge_Wamef();
92  void FaetT2();
93  void FmitT2();
94  void WmnijT2();
95  void WmbejT2();
96  void BT2();
97  void CT2();
98  void DT2();
99  void ET2();
100  void FT2();
101  void ZT2();
102  void dijabT2();
103  void t1_build();
104  void tau_build();
105  void taut_build();
106  void Z_build();
107  void Y_build();
108  void X_build();
109  void t2_build();
110  int converged(double);
111 
112  /* DPD cache */
113  void init_priority_list();
114  int **cacheprep_uhf(int level, int *cachefiles);
115  int **cacheprep_rhf(int level, int *cachefiles);
116  void cachedone_rhf(int **cachelist);
117  void cachedone_uhf(int **cachelist);
118 
119  /* Brueckner */
120  int rotate();
121  double **fock_build(double **D);
122 
123  /* CC2 / CC3 */
124  void cc2_fmiT2();
125  void cc2_faeT2();
126  void cc2_WmbijT2();
127  void cc2_WabeiT2();
128  void cc2_WabijT2();
129  void cc2_Wmnij_build();
130  void cc2_Wmbij_build();
131  void cc2_Wabei_build();
132  void cc2_t2_build();
133  void FT2_CC2();
134  void purge_cc2_Wmnij();
135  void purge_cc2_Wmbij();
136  void purge_cc2_Wabei();
137  void t1_ijab();
138  void cc3_Wmnie();
139  void cc3_Wamef();
140  void cc3_Wmnij();
141  void cc3_Wmbij();
142  void cc3_Wabei();
143  void cc3();
144 
145  /* energies */
146  double energy();
147  double mp2_energy();
148  double uhf_mp2_energy();
149  double rhf_mp2_energy();
150  void one_step();
151  void denom();
152  void pair_energies(double **epair_aa, double **epair_ab);
153  void print_pair_energies(double *emp2_aa, double *emp2_ab, double *ecc_aa, double *ecc_ab);
154 
155  void form_df_ints(Options &options, int **cachelist, int *cachefiles);
156 
157  /* diagnostics */
158  void analyze();
159  double diagnostic();
160  double d1diag();
161  double new_d1diag();
162  double new_d1diag_t1_rohf();
163  double d2diag();
164  double d1diag_t1_rhf();
165  double d1diag_t1_rohf();
166  double d2diag_rhf();
167 
168  /* local correlation */
169  void lmp2();
170  void local_filter_T1(dpdfile2 *T1);
171  void local_filter_T2(dpdbuf4 *T2);
172  void local_init();
173  void local_done();
174 
175  /* AO basis */
176  void BT2_AO();
177  void halftrans(dpdbuf4 *Buf1, int dpdnum1, dpdbuf4 *Buf2, int dpdnum2, double ***C1, double ***C2, int nirreps,
178  int **mo_row, int **so_row, int *mospi_left, int *mospi_right, int *sospi, int type, double alpha,
179  double beta);
180  int AO_contribute(struct iwlbuf *InBuf, dpdbuf4 *tau1_AO, dpdbuf4 *tau2_AO);
181 
182  double rhf_energy();
183  double uhf_energy();
184  double rohf_energy();
185  void rhf_fock_build(double **fock, double **D);
186  void uhf_fock_build(double **fock_a, double **fock_b, double **D_a, double **D_b);
187 
188  /* DIIS */
189  void diis(int iter);
190  void diis_RHF(int);
191  void diis_ROHF(int);
192  void diis_UHF(int);
193  void diis_invert_B(double **B, double *C, int dimension, double tolerance);
194 
195  /* member variables */
199  std::array<dpd_file4_cache_entry, 113> cache_priority_list_;
200 };
201 
202 } // namespace ccenergy
203 } // namespace psi
204 
205 #endif // CCWAVE_H
void Z_build()
Definition: Z.cc:43
MOInfo moinfo_
Definition: ccwave.h:196
Definition: ccenergy/Params.h:43
Options & options() const
Definition: wavefunction.cc:572
void diis_ROHF(int)
Definition: diis_ROHF.cc:62
void ZT2()
Definition: ZT2.cc:42
void update()
Definition: ccenergy/update.cc:45
void t1_ijab()
Definition: t1_ijab.cc:43
void init_io()
Definition: ccenergy.cc:482
void Fae_build()
Definition: Fae.cc:45
void cc2_Wmbij_build()
Definition: ccenergy/cc2_Wmbij.cc:47
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: ccenergy.cc:78
void cc3_Wabei()
Definition: cc3_Wabei.cc:59
void print_pair_energies(double *emp2_aa, double *emp2_ab, double *ecc_aa, double *ecc_ab)
Definition: pair_energies.cc:138
void Wmnij_build()
Definition: Wmnij.cc:44
Definition: iwl.h:47
int rotate()
Definition: rotate.cc:64
void local_done()
Definition: cc/ccenergy/local.cc:84
void status(const char *, std::string)
Definition: ccenergy/status.cc:40
void init()
Definition: ccenergy.cc:76
CCEnergyWavefunction(std::shared_ptr< Wavefunction > reference_wavefunction, Options &options)
Definition: ccenergy.cc:68
void get_moinfo()
Definition: cc/ccenergy/get_moinfo.cc:63
int converged(double)
Definition: ccenergy/converged.cc:45
int ** cacheprep_rhf(int level, int *cachefiles)
Definition: ccenergy/cache.cc:116
void purge_cc2_Wabei()
Definition: ccenergy/cc2_Wabei.cc:315
void analyze()
Definition: ccenergy/analyze.cc:45
void taut_build()
Definition: ccenergy/taut.cc:43
void init_priority_list()
Definition: priority.cc:43
Enter brief description of file here.
double d1diag_t1_rohf()
Definition: d1diag.cc:143
void local_filter_T1(dpdfile2 *T1)
Definition: cc/ccenergy/local.cc:86
void cc2_WmbijT2()
Definition: cc2_WmbijT2.cc:42
void cc3_Wmbij()
Definition: cc3_Wmbij.cc:54
void FaetT2()
Definition: FaetT2.cc:42
int AO_contribute(struct iwlbuf *InBuf, dpdbuf4 *tau1_AO, dpdbuf4 *tau2_AO)
Definition: cc/ccenergy/AO_contribute.cc:48
double d1diag_t1_rhf()
Definition: d1diag.cc:58
void DT2()
Definition: DT2.cc:42
double new_d1diag()
Definition: new_d1diag.cc:154
void purge_Wmnie()
Definition: cc3_Wmnie.cc:221
double uhf_energy()
Definition: ccenergy/energy.cc:140
double ** fock_build(double **D)
void title()
Definition: ccenergy.cc:489
void cc3()
Definition: cc3.cc:50
void purge_Wmbij()
Definition: cc3_Wmbij.cc:482
void cachedone_rhf(int **cachelist)
Definition: ccenergy/cache.cc:723
void diis_RHF(int)
Definition: diis_RHF.cc:62
double d1diag()
Definition: d1diag.cc:205
void purge_Wmnij()
Definition: cc3_Wmnij.cc:298
void checkpoint()
Definition: ccenergy.cc:504
void form_df_ints(Options &options, int **cachelist, int *cachefiles)
Definition: form_df_ints.cc:52
void WmnijT2()
Definition: WmnijT2.cc:43
Local local_
Definition: ccwave.h:198
void FT2_CC2()
Definition: FT2_cc2.cc:40
Definition: ccenergy/MOInfo.h:43
Enter brief description of file here.
void t2_build()
Definition: t2.cc:45
void FT2()
Definition: FT2.cc:45
void init_amps()
Definition: ccenergy/init_amps.cc:47
void cc2_faeT2()
Definition: cc2_faeT2.cc:42
Enter brief description of file here.
void get_params(Options &)
Definition: ccenergy/get_params.cc:54
void purge_cc2_Wmbij()
Definition: ccenergy/cc2_Wmbij.cc:492
void dijabT2()
Definition: dijabT2.cc:44
void denom()
Definition: ccenergy/denom.cc:48
void pair_energies(double **epair_aa, double **epair_ab)
Definition: pair_energies.cc:54
void cc2_Wmnij_build()
Definition: cc2_Wmnij.cc:49
Definition: ccenergy/Local.h:42
void cc3_Wmnie()
Definition: cc3_Wmnie.cc:51
void BT2()
Definition: BT2.cc:48
void one_step()
Definition: ccenergy.cc:510
void local_init()
Definition: cc/ccenergy/local.cc:69
Definition: liboptions.h:353
void uhf_fock_build(double **fock_a, double **fock_b, double **D_a, double **D_b)
Definition: fock_build.cc:174
double d2diag()
Definition: d2diag.cc:178
Definition: libdpd/dpd.h:140
void cachedone_uhf(int **cachelist)
Definition: ccenergy/cache.cc:721
double rohf_energy()
Definition: ccenergy/energy.cc:87
void cc2_WabeiT2()
Definition: cc2_WabeiT2.cc:44
void tau_build()
Definition: ccenergy/tau.cc:43
void cleanup()
Definition: cc/ccenergy/get_moinfo.cc:285
void cc2_fmiT2()
Definition: cc2_fmiT2.cc:42
std::shared_ptr< Wavefunction > reference_wavefunction() const
Returns the reference wavefunction.
Definition: wavefunction.cc:608
double rhf_energy()
Definition: ccenergy/energy.cc:56
Simple wavefunction base class.
Definition: wavefunction.h:85
void Fmi_build()
Definition: Fmi.cc:43
void local_filter_T2(dpdbuf4 *T2)
Definition: cc/ccenergy/local.cc:182
void FmitT2()
Definition: FmitT2.cc:42
void diis_invert_B(double **B, double *C, int dimension, double tolerance)
Definition: cc/ccenergy/diis.cc:75
void cc2_t2_build()
Definition: cc2_t2.cc:43
Definition: libdpd/dpd.h:105
void spinad_amps()
Definition: ccenergy/spinad_amps.cc:63
void cc3_Wamef()
Definition: cc3_Wamef.cc:51
void amp_write()
Definition: ccenergy/amp_write.cc:64
void cc2_Wabei_build()
Definition: ccenergy/cc2_Wabei.cc:59
double rhf_mp2_energy()
Definition: mp2_energy.cc:56
void exit_io()
Definition: ccenergy.cc:497
void tsave()
Definition: tsave.cc:42
Definition: pointgrp.h:109
Params params_
Definition: ccwave.h:197
void cc3_Wmnij()
Definition: cc3_Wmnij.cc:52
void diis(int iter)
Definition: cc/ccenergy/diis.cc:66
void lmp2()
Definition: lmp2.cc:76
void purge_cc2_Wmnij()
Definition: cc2_Wmnij.cc:323
void diis_UHF(int)
Definition: diis_UHF.cc:62
void Fme_build()
Definition: Fme.cc:42
void cc2_WabijT2()
Definition: cc2_WabijT2.cc:42
double diagnostic()
Definition: diagnostic.cc:45
void WmbejT2()
Definition: WmbejT2.cc:120
void ET2()
Definition: ET2.cc:43
void t1_build()
Definition: t1.cc:44
double new_d1diag_t1_rohf()
Definition: new_d1diag.cc:50
Enter brief description of file here.
void sort_amps()
Definition: ccenergy/sort_amps.cc:43
void Wmbej_build()
Definition: ccenergy/Wmbej.cc:57
virtual ~CCEnergyWavefunction()
Definition: ccenergy.cc:74
int ** cacheprep_uhf(int level, int *cachefiles)
Definition: ccenergy/cache.cc:58
double d2diag_rhf()
Definition: d2diag.cc:52
double mp2_energy()
Definition: mp2_energy.cc:44
void rhf_fock_build(double **fock, double **D)
Definition: fock_build.cc:52
void purge_Wamef()
Definition: cc3_Wamef.cc:201
double uhf_mp2_energy()
Definition: mp2_energy.cc:107
std::array< dpd_file4_cache_entry, 113 > cache_priority_list_
Definition: ccwave.h:199
void halftrans(dpdbuf4 *Buf1, int dpdnum1, dpdbuf4 *Buf2, int dpdnum2, double ***C1, double ***C2, int nirreps, int **mo_row, int **so_row, int *mospi_left, int *mospi_right, int *sospi, int type, double alpha, double beta)
Definition: ccenergy/halftrans.cc:63
void purge_Wabei()
Definition: cc3_Wabei.cc:1034
void CT2()
Definition: CT2.cc:77
void BT2_AO()
Definition: BT2_AO.cc:53
double energy()
Definition: ccenergy/energy.cc:44