Psi4
ccsd.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 CCSD_H
29 #define CCSD_H
30 
31 #include "psi4/psi4-dec.h"
32 #include "psi4/libiwl/iwl.h"
33 #include "psi4/libpsio/psio.hpp"
34 #include "psi4/libpsio/psio.h"
36 #include "psi4/psifiles.h"
37 
38 long int Position(long int i,long int j);
39 
40 namespace psi{ namespace fnocc{
41 
43  public:
44 
45  CoupledCluster(std::shared_ptr<Wavefunction> reference_wavefunction,Options &options);
47 
48  double compute_energy();
49 
50  protected:
51 
52  int iter;
54 
55  void common_init();
56  void finalize();
57 
59  bool t2_on_disk;
60 
63  int ccmethod;
64 
67 
69  void DefineTasks();
70  void DefineLinearTasks();
71  void DefineQuadraticTasks();
73 
75  struct CCTaskParams{
77  };
79 
81  struct CCTask{
83  double flopcount;
84  char*name;
85  };
87 
90 
92  void SCS_MP2();
94 
96  void SCS_CCSD();
98 
102  double et;
103 
105  void mp4_triples();
106  double emp4_t;
107 
108  void WriteBanner();
109  void WriteOptions();
110 
112  virtual void AllocateMemory();
113 
121 
133 
140 
142  void MP2();
143 
145  void MP4_SDQ();
146 
150 
152  void UpdateT1(long int iter);
153  void UpdateT1_mp4(long int iter);
154 
156  void UpdateT2(long int iter);
157  void UpdateT2_mp4(long int iter);
158 
160  double CheckEnergy();
161 
163  void I2ijkl(CCTaskParams params);
165  void Vabcd1(CCTaskParams params);
166  void Vabcd2(CCTaskParams params);
167  void Vabcd(CCTaskParams params);
168  void K(CCTaskParams params);
170 
172  void DIIS(double*c,long int nvec,long int n,int replace_diis_iter);
173  void DIISOldVector(long int iter,int diis_iter,int replace_diis_iter);
174  double DIISErrorVector(int diis_iter,int replace_diis_iter,int iter);
175  void DIISNewAmplitudes(int diis_iter,int&replace_diis_iter);
176  long int maxdiis;
177  double*diisvec;
178 
181 
183  long int memory;
184 
186  long int maxiter;
187 
189  double e_conv;
190 
192  double r_conv;
193 
195  double *eps;
196 
198  double escf;
199 
202 
204  double*tb,*t1;
205 
207  double *w1,*I1,*I1p;
208 
210  void DefineTilingCPU();
214 };
215 
216 // DF CC class
218 
219  public:
222 
223  double compute_energy();
224 
225  protected:
226  void finalize();
227 
230 
231  void WriteBanner();
232 
234  virtual void AllocateMemory();
235 
237  void UpdateT1();
238 
240  virtual void UpdateT2();
241 
243  virtual void Vabcd1();
244 
246  double*Abij,*Sbij;
247 
249  virtual double CheckEnergy();
250 
253  long int nQ;
254  long int nQ_scf;
255  double*Qov,*Qvv,*Qoo;
256  void ThreeIndexIntegrals();
257 
259  double * Ca_L, * Ca_R, **Ca;
260  double *Fij, *Fab, *Fia, *Fai;
262 
264  virtual void T1Integrals();
266  virtual void T1Fock();
267 
269  virtual void CCResidual();
270 
272  virtual void SCS_MP2();
273 
275  virtual void SCS_CCSD();
276 };
277 
278 // coupled pair class
280 
281  public:
282  CoupledPair(std::shared_ptr<psi::Wavefunction>wfn,Options&options);
283  ~CoupledPair();
284 
285  double compute_energy();
286 
287  protected:
288 
291 
293  void finalize();
294 
296  void PairEnergy();
297  double * pair_energy;
298 
300  char * cepa_type;
302 
304  double CheckEnergy();
305 
307  double VariationalEnergy();
308  double evar;
309 
311  void UpdateT1();
312 
314  void UpdateT2();
315 
317  void SCS_CEPA();
318 
320  void OPDM();
321 
323  void WriteBanner();
324 };
325 
326 }}
327 
328 #endif
long int maxelem
Definition: ccsd.h:212
long int ndoccact
basic parameters
Definition: ccsd.h:180
double CheckEnergy()
check energy
Definition: coupled_pair.cc:717
double emp2_ss
Definition: ccsd.h:93
long int ncctasks
Definition: ccsd.h:72
void CPU_t1_vmeai_linear(CCTaskParams params)
Definition: linear.cc:45
long int nfzc
Definition: ccsd.h:180
long int lastov2tile
Definition: ccsd.h:211
void CPU_I2p_abci_refactored_term1_linear(CCTaskParams params)
Definition: linear.cc:154
bool ischolesky_
3-index integrals for density fitting.
Definition: ccsd.h:252
void WriteBanner()
banner
Definition: coupled_pair.cc:94
double eccsd
Definition: ccsd.h:97
Options & options() const
Definition: wavefunction.cc:400
double * Qvv
Definition: ccsd.h:255
double eccsd_ss
Definition: ccsd.h:97
double * Fij
Definition: ccsd.h:260
void I2iabj_linear(CCTaskParams params)
linear diagrams for mp4
Definition: linear.cc:555
virtual void AllocateMemory()
allocate memory
Definition: df_ccsd.cc:522
void DefineTasks()
define qci/cc/mp tasks
Definition: ccsd.cc:2010
void SCS_CCSD()
SCS-CCSD function and variables.
Definition: ccsd.cc:1891
long int nov2tiles
Definition: ccsd.h:213
CCTask * CCSubTasklist2
Definition: ccsd.h:86
double * I1
Definition: ccsd.h:207
void I2piajk_linear(CCTaskParams params)
Definition: linear.cc:410
void UpdateT1()
update t1 amplitudes
Definition: df_ccsd.cc:714
SharedMatrix H
Definition: ccsd.h:261
bool mp2_only
which cc method?
Definition: ccsd.h:62
double et
Definition: ccsd.h:102
virtual double CheckEnergy()
check energy
Definition: df_ccsd.cc:486
void DIISNewAmplitudes(int diis_iter, int &replace_diis_iter)
Definition: fnocc/diis.cc:202
long int lasttile
Definition: ccsd.h:212
CoupledPair(std::shared_ptr< psi::Wavefunction >wfn, Options &options)
Definition: coupled_pair.cc:59
long int tilesize
Definition: ccsd.h:212
double eccsd_os
Definition: ccsd.h:97
double * Fab
Definition: ccsd.h:260
void UpdateT1(long int iter)
Update t1.
Definition: ccsd.cc:1865
CCTask * LTasklist
Definition: ccsd.h:86
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: ccsd.cc:162
void MP2()
mp2
Definition: fnocc/mp2.cc:57
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: df_ccsd.cc:68
CCTaskParams * CCParams
Definition: ccsd.h:78
void UpdateT2(long int iter)
Update t2.
Definition: ccsd.cc:1812
double * Fia
Definition: ccsd.h:260
double * pair_energy
Definition: ccsd.h:297
long int nvirt_no
Definition: ccsd.h:180
virtual void CCResidual()
evaluate cc diagrams
Definition: df_cc_residual.cc:52
int ccmethod
Definition: ccsd.h:63
~CoupledCluster()
Definition: ccsd.cc:77
double CheckEnergy()
evaluate energy
Definition: ccsd.cc:1968
void I2piajk(CCTaskParams params)
Definition: ccsd.cc:1297
void(psi::fnocc::CoupledCluster::* func)(CCTaskParams)
Definition: ccsd.h:82
PsiReturnType
Definition: psi4-dec.h:48
long int memory
available memory
Definition: ccsd.h:183
virtual void T1Fock()
generate t1-transformed Fock matrix
Definition: df_t1_transformation.cc:53
Definition: pointgrp.h:105
long int maxiter
maximum number of iterations
Definition: ccsd.h:186
long int nvirt
Definition: ccsd.h:180
bool isccsd
Definition: ccsd.h:62
void CPU_t1_vmeni_linear(CCTaskParams params)
Definition: linear.cc:70
double emp2_os_fac
Definition: ccsd.h:93
long int ovtilesize
Definition: ccsd.h:211
void Vabcd2_linear(CCTaskParams params)
Definition: linear.cc:497
virtual void Vabcd1()
v^4 CC diagram
Definition: df_ccsd.cc:789
double emp4_t
Definition: ccsd.h:106
double * tempv
Definition: ccsd.h:201
PsiReturnType CEPAIterations()
coupled pair iterations
Definition: coupled_pair.cc:241
CoupledCluster(std::shared_ptr< Wavefunction > reference_wavefunction, Options &options)
Definition: ccsd.cc:69
long int nfzv
Definition: ccsd.h:180
double * t1
Definition: ccsd.h:204
void DefineQuadraticTasks()
Definition: linear.cc:720
double DIISErrorVector(int diis_iter, int replace_diis_iter, int iter)
Definition: fnocc/diis.cc:165
void I2ijkl(CCTaskParams params)
the n^6 cc/qci diagrams
Definition: ccsd.cc:1228
void PairEnergy()
pair energies
Definition: coupled_pair.cc:453
SharedMatrix Ca() const
Returns the alpha electrons MO coefficients.
Definition: wavefunction.cc:463
char * cepa_type
what kind of coupled pair method?
Definition: ccsd.h:300
double emp4_q_ss
Definition: ccsd.h:149
virtual void T1Integrals()
generate t1-transformed 3-index integrals
Definition: df_t1_transformation.cc:225
void CPU_t1_vmaef(CCTaskParams params)
Definition: ccsd.cc:907
PsiReturnType CCSDIterations()
solve qcisd/ccsd equations
Definition: ccsd.cc:385
virtual void UpdateT2()
update t2 amplitudes
Definition: df_ccsd.cc:733
void UpdateT2()
update t2 amplitudes
Definition: coupled_pair.cc:488
double * eps
orbital energies
Definition: ccsd.h:195
int iter
Definition: ccsd.h:52
double * Sbij
Definition: ccsd.h:246
void DIISOldVector(long int iter, int diis_iter, int replace_diis_iter)
Definition: fnocc/diis.cc:127
void UpdateT1_mp4(long int iter)
Definition: linear.cc:192
long int novtiles
Definition: ccsd.h:213
void Vabcd2(CCTaskParams params)
Definition: ccsd.cc:1443
CCTask * QTasklist
Definition: ccsd.h:86
CCTaskParams * QParams
Definition: ccsd.h:78
void DefineLinearTasks()
Definition: linear.cc:695
double emp2_ss_fac
Definition: ccsd.h:93
Definition: ccsd.h:42
long int ntiles
Definition: ccsd.h:213
CCTask * CCTasklist
Definition: ccsd.h:86
double * tb
t1 and t2 buffers
Definition: ccsd.h:204
double emp3_os
components of mp3 and mp4 energies
Definition: ccsd.h:148
~DFCoupledCluster()
Definition: df_ccsd.cc:64
PsiReturnType lowmemory_triples()
Definition: lowmemory_triples.cc:40
CCTaskParams * LParams
Definition: ccsd.h:78
double * Abij
workspace buffers.
Definition: ccsd.h:246
SharedWavefunction fnocc(SharedWavefunction, Options &)
Definition: fnocc.cc:36
long int ov2tilesize
Definition: ccsd.h:211
void CPU_I1pij_I1ia_lessmem_quadratic(CCTaskParams params)
Definition: quadratic.cc:125
void K(CCTaskParams params)
Definition: ccsd.cc:1514
void WriteBanner()
Definition: df_ccsd.cc:249
bool mp4_only
Definition: ccsd.h:62
bool t2_on_disk
is t2 on disk or held in main memory?
Definition: ccsd.h:59
long int maxdiis
Definition: ccsd.h:176
long int lastovtile
Definition: ccsd.h:211
double escf
reference energy
Definition: ccsd.h:198
void OPDM()
compute opdm - only valid for cisd, acpf, aqcc, and cepa(0)
Definition: fnocc/opdm.cc:41
double emp4_q_os
Definition: ccsd.h:149
long int ndocc
Definition: ccsd.h:180
bool isLowMemory
flag for low-memory triples algorithm
Definition: ccsd.h:66
double * w1
buffers for singles residual and a couple of tiny intermediates
Definition: ccsd.h:207
void DefineTilingCPU()
define tiling
Definition: ccsd.cc:634
double VariationalEnergy()
check energy for coupled pair methods that have an energy functional
Definition: coupled_pair.cc:641
double emp4_sd_os
Definition: ccsd.h:148
double * Qov
Definition: ccsd.h:255
long int nQ_scf
Definition: ccsd.h:254
Definition: liboptions.h:359
void CPU_I2p_abci_refactored_term2(CCTaskParams params)
Definition: ccsd.cc:1079
virtual void SCS_CCSD()
SCS-CCSD function and variables.
Definition: df_scs.cc:53
~CoupledPair()
Definition: coupled_pair.cc:90
void UpdateT1()
update t1 amplitudes
Definition: coupled_pair.cc:560
void I2ijkl_quadratic(CCTaskParams params)
Definition: quadratic.cc:238
double * Fai
Definition: ccsd.h:260
DFCoupledCluster(SharedWavefunction ref_wfn, Options &options)
Definition: df_ccsd.cc:58
double emp3
Definition: ccsd.h:148
double emp3_ss
Definition: ccsd.h:148
double flopcount
Definition: ccsd.h:83
int nso() const
Returns the number of SOs.
Definition: wavefunction.h:354
double evar
Definition: ccsd.h:308
double eccsd_ss_fac
Definition: ccsd.h:97
CCTaskParams * CCSubParams1
Definition: ccsd.h:78
void CPU_t1_vmaef_linear(CCTaskParams params)
Definition: linear.cc:99
task parameters - not used currently
Definition: ccsd.h:75
void DIIS(double *c, long int nvec, long int n, int replace_diis_iter)
DIIS functions.
Definition: fnocc/diis.cc:42
void Vabcd(CCTaskParams params)
double * Ca_R
Definition: ccsd.h:259
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
std::shared_ptr< Wavefunction > wfn
Definition: dx_write.cc:59
double emp2_os
Definition: ccsd.h:93
void common_init()
Definition: ccsd.cc:84
bool mp3_only
Definition: ccsd.h:62
std::shared_ptr< Wavefunction > reference_wavefunction() const
Returns the reference wavefunction.
Definition: wavefunction.cc:453
void SCS_CEPA()
scs functions
Definition: coupled_pair.cc:601
long int nQ
Definition: ccsd.h:253
double emp4_sd_ss
Definition: ccsd.h:148
double emp4_sd
Definition: ccsd.h:148
PsiReturnType CCSDIterations()
CCSD iterations.
Definition: df_ccsd.cc:269
void I2iajb_linear(CCTaskParams params)
Definition: linear.cc:609
Simple wavefunction base class.
Definition: wavefunction.h:85
void Vabcd1_linear(CCTaskParams params)
Definition: linear.cc:441
double emp2
Definition: ccsd.h:93
void I2iabj_quadratic(CCTaskParams params)
linear diagrams for mp4
Definition: quadratic.cc:291
double * diisvec
Definition: ccsd.h:177
void SCS_MP2()
SCS-MP2 function and variables.
Definition: ccsd.cc:1930
double * integrals
workspace buffers.
Definition: ccsd.h:201
virtual void AllocateMemory()
allocate memory
Definition: ccsd.cc:724
long int nltasks
Definition: ccsd.h:72
double * Qoo
Definition: ccsd.h:255
void MP4_SDQ()
mp4(sdq)
Definition: ccsd.cc:2069
long int nmotemp
Definition: ccsd.h:180
double * tempt
Definition: ccsd.h:201
long int Position(long int i, long int j)
Definition: fnocc/blas.cc:34
void Vabcd1(CCTaskParams params)
Definition: ccsd.cc:1375
int nmo() const
Returns the number of MOs.
Definition: wavefunction.h:356
PsiReturnType triples()
cc or qci (t)
Definition: fnocc/triples.cc:40
CCTaskParams * CCSubParams2
Definition: ccsd.h:78
CCTask * CCSubTasklist1
Definition: ccsd.h:86
void CPU_I1pij_I1ia_lessmem(CCTaskParams params)
Definition: ccsd.cc:1115
void CPU_I1ab_quadratic(CCTaskParams params)
Definition: quadratic.cc:52
double r_conv
amplitude convergence
Definition: ccsd.h:192
EXTERN struct Params params
Definition: ccdensity/globals.h:53
double * Ca_L
more 3-index stuff for t1-transformed integrals
Definition: ccsd.h:259
double * I1p
Definition: ccsd.h:207
void finalize()
Definition: ccsd.cc:154
void I2iajb_quadratic(CCTaskParams params)
Definition: quadratic.cc:401
Definition: ccsd.h:279
double emp4_q
Definition: ccsd.h:149
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:50
void TwoJminusK(CCTaskParams params)
Definition: ccsd.cc:1644
void CPU_t1_vmeni(CCTaskParams params)
Definition: ccsd.cc:876
void CPU_t1_vmeai(CCTaskParams params)
some cc/qci diagrams
Definition: ccsd.cc:849
double e_conv
energy convergence
Definition: ccsd.h:189
virtual void SCS_MP2()
SCS-MP2 function and variables.
Definition: df_scs.cc:94
void CPU_I1ab(CCTaskParams params)
Definition: ccsd.cc:962
Definition: ccsd.h:217
double eccsd_os_fac
Definition: ccsd.h:97
void UpdateT2_mp4(long int iter)
Definition: linear.cc:220
cc/qci/mp task
Definition: ccsd.h:81
int cepa_level
Definition: ccsd.h:301
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: coupled_pair.cc:138
long int nqtasks
Definition: ccsd.h:72
void finalize()
free memory
Definition: coupled_pair.cc:756
char * name
Definition: ccsd.h:84
void mp4_triples()
mp4 triples
void I2ijkl_linear(CCTaskParams params)
Definition: linear.cc:371
int brueckner_iter
Definition: ccsd.h:53
void WriteOptions()
Definition: ccsd.cc:366
void WriteBanner()
Definition: ccsd.cc:344