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 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 CCSD_H
30 #define CCSD_H
31 
32 #include "psi4/psi4-dec.h"
33 #include "psi4/libiwl/iwl.h"
34 #include "psi4/libpsio/psio.hpp"
35 #include "psi4/libpsio/psio.h"
37 #include "psi4/psifiles.h"
39 
40 long int Position(long int i,long int j);
41 
42 namespace psi{ namespace fnocc{
43 
45  public:
46 
47  CoupledCluster(std::shared_ptr<Wavefunction> reference_wavefunction,Options &options);
49 
50  double compute_energy();
51 
52  protected:
53 
54  int iter;
56 
57  void common_init();
58  void finalize();
59 
61  bool t2_on_disk;
62 
65  int ccmethod;
66 
69 
71  void DefineTasks();
72  void DefineLinearTasks();
73  void DefineQuadraticTasks();
75 
77  struct CCTaskParams{
79  };
81 
83  struct CCTask{
85  double flopcount;
86  char*name;
87  };
89 
92 
94  void SCS_MP2();
96 
98  void SCS_CCSD();
100 
104  double et;
105 
107  void mp4_triples();
108  double emp4_t;
109 
110  void WriteBanner();
111  void WriteOptions();
112 
114  virtual void AllocateMemory();
115 
123 
135 
142 
144  void MP2();
145 
147  void MP4_SDQ();
148 
152 
154  void UpdateT1(long int iter);
155  void UpdateT1_mp4(long int iter);
156 
158  void UpdateT2(long int iter);
159  void UpdateT2_mp4(long int iter);
160 
162  double CheckEnergy();
163 
165  void I2ijkl(CCTaskParams params);
167  void Vabcd1(CCTaskParams params);
168  void Vabcd2(CCTaskParams params);
169  void Vabcd(CCTaskParams params);
170  void K(CCTaskParams params);
172 
174  void DIIS(double*c,long int nvec,long int n,int replace_diis_iter);
175  void DIISOldVector(long int iter,int diis_iter,int replace_diis_iter);
176  double DIISErrorVector(int diis_iter,int replace_diis_iter,int iter);
177  void DIISNewAmplitudes(int diis_iter,int&replace_diis_iter);
178  long int maxdiis;
179  double*diisvec;
180 
183 
185  long int memory;
186 
188  long int maxiter;
189 
191  double e_conv;
192 
194  double r_conv;
195 
197  double *eps;
198 
200  double escf;
201 
204 
206  double*tb,*t1;
207 
209  double *w1,*I1,*I1p;
210 
212  void DefineTilingCPU();
216 };
217 
218 // DF CC class
220 
221  public:
224 
225  double compute_energy();
226 
227  protected:
228  void finalize();
229 
232 
233  void WriteBanner();
234 
236  virtual void AllocateMemory();
237 
239  void UpdateT1();
240 
242  virtual void UpdateT2();
243 
245  virtual void Vabcd1();
246 
248  double*Abij,*Sbij;
249 
251  virtual double CheckEnergy();
252 
255  long int nQ;
256  long int nQ_scf;
257  double*Qov,*Qvv,*Qoo;
258  void ThreeIndexIntegrals();
259 
261  double * Ca_L, * Ca_R, **Ca;
262  double *Fij, *Fab, *Fia, *Fai;
264 
266  virtual void T1Integrals();
268  virtual void T1Fock();
269 
271  virtual void CCResidual();
272 
274  virtual void SCS_MP2();
275 
277  virtual void SCS_CCSD();
278 };
279 
280 // coupled pair class
282 
283  public:
284  CoupledPair(std::shared_ptr<psi::Wavefunction>wfn,Options&options);
285  ~CoupledPair();
286 
287  double compute_energy();
288 
289  protected:
290 
293 
295  void finalize();
296 
298  void PairEnergy();
299  double * pair_energy;
300 
302  char * cepa_type;
304 
306  double CheckEnergy();
307 
309  double VariationalEnergy();
310  double evar;
311 
313  void UpdateT1();
314 
316  void UpdateT2();
317 
319  void SCS_CEPA();
320 
322  void OPDM();
323 
325  void WriteBanner();
326 };
327 
328 }}
329 
330 #endif
long int maxelem
Definition: ccsd.h:214
long int ndoccact
basic parameters
Definition: ccsd.h:182
double CheckEnergy()
check energy
Definition: coupled_pair.cc:720
double emp2_ss
Definition: ccsd.h:95
long int ncctasks
Definition: ccsd.h:74
void CPU_t1_vmeai_linear(CCTaskParams params)
Definition: linear.cc:46
long int nfzc
Definition: ccsd.h:182
long int lastov2tile
Definition: ccsd.h:213
void CPU_I2p_abci_refactored_term1_linear(CCTaskParams params)
Definition: linear.cc:155
bool ischolesky_
3-index integrals for density fitting.
Definition: ccsd.h:254
void WriteBanner()
banner
Definition: coupled_pair.cc:97
double eccsd
Definition: ccsd.h:99
Options & options() const
Definition: wavefunction.cc:412
double * Qvv
Definition: ccsd.h:257
double eccsd_ss
Definition: ccsd.h:99
double * Fij
Definition: ccsd.h:262
void I2iabj_linear(CCTaskParams params)
linear diagrams for mp4
Definition: linear.cc:556
virtual void AllocateMemory()
allocate memory
Definition: df_ccsd.cc:533
void DefineTasks()
define qci/cc/mp tasks
Definition: ccsd.cc:2023
void SCS_CCSD()
SCS-CCSD function and variables.
Definition: ccsd.cc:1904
long int nov2tiles
Definition: ccsd.h:215
CCTask * CCSubTasklist2
Definition: ccsd.h:88
double * I1
Definition: ccsd.h:209
void I2piajk_linear(CCTaskParams params)
Definition: linear.cc:411
void UpdateT1()
update t1 amplitudes
Definition: df_ccsd.cc:725
SharedMatrix H
Definition: ccsd.h:263
bool mp2_only
which cc method?
Definition: ccsd.h:64
double et
Definition: ccsd.h:104
virtual double CheckEnergy()
check energy
Definition: df_ccsd.cc:497
void DIISNewAmplitudes(int diis_iter, int &replace_diis_iter)
Definition: fnocc/diis.cc:203
long int lasttile
Definition: ccsd.h:214
CoupledPair(std::shared_ptr< psi::Wavefunction >wfn, Options &options)
Definition: coupled_pair.cc:62
long int tilesize
Definition: ccsd.h:214
double eccsd_os
Definition: ccsd.h:99
double * Fab
Definition: ccsd.h:262
void UpdateT1(long int iter)
Update t1.
Definition: ccsd.cc:1878
CCTask * LTasklist
Definition: ccsd.h:88
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: ccsd.cc:165
void MP2()
mp2
Definition: fnocc/mp2.cc:58
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: df_ccsd.cc:69
CCTaskParams * CCParams
Definition: ccsd.h:80
void UpdateT2(long int iter)
Update t2.
Definition: ccsd.cc:1825
double * Fia
Definition: ccsd.h:262
double * pair_energy
Definition: ccsd.h:299
long int nvirt_no
Definition: ccsd.h:182
virtual void CCResidual()
evaluate cc diagrams
Definition: df_cc_residual.cc:54
int ccmethod
Definition: ccsd.h:65
~CoupledCluster()
Definition: ccsd.cc:80
double CheckEnergy()
evaluate energy
Definition: ccsd.cc:1981
void I2piajk(CCTaskParams params)
Definition: ccsd.cc:1310
void(psi::fnocc::CoupledCluster::* func)(CCTaskParams)
Definition: ccsd.h:84
PsiReturnType
Definition: psi4-dec.h:46
long int memory
available memory
Definition: ccsd.h:185
virtual void T1Fock()
generate t1-transformed Fock matrix
Definition: df_t1_transformation.cc:53
Definition: pointgrp.h:106
long int maxiter
maximum number of iterations
Definition: ccsd.h:188
long int nvirt
Definition: ccsd.h:182
bool isccsd
Definition: ccsd.h:64
void CPU_t1_vmeni_linear(CCTaskParams params)
Definition: linear.cc:71
double emp2_os_fac
Definition: ccsd.h:95
long int ovtilesize
Definition: ccsd.h:213
void Vabcd2_linear(CCTaskParams params)
Definition: linear.cc:498
virtual void Vabcd1()
v^4 CC diagram
Definition: df_ccsd.cc:800
double emp4_t
Definition: ccsd.h:108
double * tempv
Definition: ccsd.h:203
PsiReturnType CEPAIterations()
coupled pair iterations
Definition: coupled_pair.cc:244
CoupledCluster(std::shared_ptr< Wavefunction > reference_wavefunction, Options &options)
Definition: ccsd.cc:72
long int nfzv
Definition: ccsd.h:182
double * t1
Definition: ccsd.h:206
void DefineQuadraticTasks()
Definition: linear.cc:721
double DIISErrorVector(int diis_iter, int replace_diis_iter, int iter)
Definition: fnocc/diis.cc:166
void I2ijkl(CCTaskParams params)
the n^6 cc/qci diagrams
Definition: ccsd.cc:1241
void PairEnergy()
pair energies
Definition: coupled_pair.cc:456
SharedMatrix Ca() const
Returns the alpha electrons MO coefficients.
Definition: wavefunction.cc:481
char * cepa_type
what kind of coupled pair method?
Definition: ccsd.h:302
double emp4_q_ss
Definition: ccsd.h:151
virtual void T1Integrals()
generate t1-transformed 3-index integrals
Definition: df_t1_transformation.cc:225
void CPU_t1_vmaef(CCTaskParams params)
Definition: ccsd.cc:920
PsiReturnType CCSDIterations()
solve qcisd/ccsd equations
Definition: ccsd.cc:391
virtual void UpdateT2()
update t2 amplitudes
Definition: df_ccsd.cc:744
void UpdateT2()
update t2 amplitudes
Definition: coupled_pair.cc:491
double * eps
orbital energies
Definition: ccsd.h:197
int iter
Definition: ccsd.h:54
double * Sbij
Definition: ccsd.h:248
void DIISOldVector(long int iter, int diis_iter, int replace_diis_iter)
Definition: fnocc/diis.cc:128
void UpdateT1_mp4(long int iter)
Definition: linear.cc:193
long int novtiles
Definition: ccsd.h:215
void Vabcd2(CCTaskParams params)
Definition: ccsd.cc:1456
CCTask * QTasklist
Definition: ccsd.h:88
CCTaskParams * QParams
Definition: ccsd.h:80
void DefineLinearTasks()
Definition: linear.cc:696
double emp2_ss_fac
Definition: ccsd.h:95
Definition: ccsd.h:44
long int ntiles
Definition: ccsd.h:215
CCTask * CCTasklist
Definition: ccsd.h:88
double * tb
t1 and t2 buffers
Definition: ccsd.h:206
double emp3_os
components of mp3 and mp4 energies
Definition: ccsd.h:150
~DFCoupledCluster()
Definition: df_ccsd.cc:65
PsiReturnType lowmemory_triples()
Definition: lowmemory_triples.cc:44
CCTaskParams * LParams
Definition: ccsd.h:80
double * Abij
workspace buffers.
Definition: ccsd.h:248
SharedWavefunction fnocc(SharedWavefunction, Options &)
Definition: fnocc.cc:39
long int ov2tilesize
Definition: ccsd.h:213
void CPU_I1pij_I1ia_lessmem_quadratic(CCTaskParams params)
Definition: quadratic.cc:126
void K(CCTaskParams params)
Definition: ccsd.cc:1527
void WriteBanner()
Definition: df_ccsd.cc:253
bool mp4_only
Definition: ccsd.h:64
bool t2_on_disk
is t2 on disk or held in main memory?
Definition: ccsd.h:61
long int maxdiis
Definition: ccsd.h:178
long int lastovtile
Definition: ccsd.h:213
double escf
reference energy
Definition: ccsd.h:200
void OPDM()
compute opdm - only valid for cisd, acpf, aqcc, and cepa(0)
Definition: fnocc/opdm.cc:43
double emp4_q_os
Definition: ccsd.h:151
long int ndocc
Definition: ccsd.h:182
bool isLowMemory
flag for low-memory triples algorithm
Definition: ccsd.h:68
double * w1
buffers for singles residual and a couple of tiny intermediates
Definition: ccsd.h:209
void DefineTilingCPU()
define tiling
Definition: ccsd.cc:647
double VariationalEnergy()
check energy for coupled pair methods that have an energy functional
Definition: coupled_pair.cc:644
double emp4_sd_os
Definition: ccsd.h:150
double * Qov
Definition: ccsd.h:257
long int nQ_scf
Definition: ccsd.h:256
Definition: liboptions.h:355
void CPU_I2p_abci_refactored_term2(CCTaskParams params)
Definition: ccsd.cc:1092
virtual void SCS_CCSD()
SCS-CCSD function and variables.
Definition: df_scs.cc:53
~CoupledPair()
Definition: coupled_pair.cc:93
void UpdateT1()
update t1 amplitudes
Definition: coupled_pair.cc:563
void I2ijkl_quadratic(CCTaskParams params)
Definition: quadratic.cc:239
double * Fai
Definition: ccsd.h:262
DFCoupledCluster(SharedWavefunction ref_wfn, Options &options)
Definition: df_ccsd.cc:59
double emp3
Definition: ccsd.h:150
double emp3_ss
Definition: ccsd.h:150
double flopcount
Definition: ccsd.h:85
int nso() const
Returns the number of SOs.
Definition: wavefunction.h:351
double evar
Definition: ccsd.h:310
double eccsd_ss_fac
Definition: ccsd.h:99
CCTaskParams * CCSubParams1
Definition: ccsd.h:80
void CPU_t1_vmaef_linear(CCTaskParams params)
Definition: linear.cc:100
task parameters - not used currently
Definition: ccsd.h:77
void DIIS(double *c, long int nvec, long int n, int replace_diis_iter)
DIIS functions.
Definition: fnocc/diis.cc:43
void Vabcd(CCTaskParams params)
double * Ca_R
Definition: ccsd.h:261
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
std::shared_ptr< Wavefunction > wfn
Definition: dx_write.cc:60
double emp2_os
Definition: ccsd.h:95
void common_init()
Definition: ccsd.cc:87
bool mp3_only
Definition: ccsd.h:64
std::shared_ptr< Wavefunction > reference_wavefunction() const
Returns the reference wavefunction.
Definition: wavefunction.cc:465
void SCS_CEPA()
scs functions
Definition: coupled_pair.cc:604
long int nQ
Definition: ccsd.h:255
double emp4_sd_ss
Definition: ccsd.h:150
double emp4_sd
Definition: ccsd.h:150
PsiReturnType CCSDIterations()
CCSD iterations.
Definition: df_ccsd.cc:273
void I2iajb_linear(CCTaskParams params)
Definition: linear.cc:610
Simple wavefunction base class.
Definition: wavefunction.h:84
void Vabcd1_linear(CCTaskParams params)
Definition: linear.cc:442
double emp2
Definition: ccsd.h:95
void I2iabj_quadratic(CCTaskParams params)
linear diagrams for mp4
Definition: quadratic.cc:292
double * diisvec
Definition: ccsd.h:179
void SCS_MP2()
SCS-MP2 function and variables.
Definition: ccsd.cc:1943
double * integrals
workspace buffers.
Definition: ccsd.h:203
virtual void AllocateMemory()
allocate memory
Definition: ccsd.cc:737
long int nltasks
Definition: ccsd.h:74
double * Qoo
Definition: ccsd.h:257
void MP4_SDQ()
mp4(sdq)
Definition: ccsd.cc:2082
long int nmotemp
Definition: ccsd.h:182
double * tempt
Definition: ccsd.h:203
long int Position(long int i, long int j)
Definition: fnocc/blas.cc:35
void Vabcd1(CCTaskParams params)
Definition: ccsd.cc:1388
int nmo() const
Returns the number of MOs.
Definition: wavefunction.h:353
PsiReturnType triples()
cc or qci (t)
Definition: fnocc/triples.cc:45
CCTaskParams * CCSubParams2
Definition: ccsd.h:80
CCTask * CCSubTasklist1
Definition: ccsd.h:88
void CPU_I1pij_I1ia_lessmem(CCTaskParams params)
Definition: ccsd.cc:1128
void CPU_I1ab_quadratic(CCTaskParams params)
Definition: quadratic.cc:53
double r_conv
amplitude convergence
Definition: ccsd.h:194
EXTERN struct Params params
Definition: ccdensity/globals.h:55
double * Ca_L
more 3-index stuff for t1-transformed integrals
Definition: ccsd.h:261
double * I1p
Definition: ccsd.h:209
void finalize()
Definition: ccsd.cc:157
void I2iajb_quadratic(CCTaskParams params)
Definition: quadratic.cc:402
Definition: ccsd.h:281
double emp4_q
Definition: ccsd.h:151
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
void TwoJminusK(CCTaskParams params)
Definition: ccsd.cc:1657
void CPU_t1_vmeni(CCTaskParams params)
Definition: ccsd.cc:889
void CPU_t1_vmeai(CCTaskParams params)
some cc/qci diagrams
Definition: ccsd.cc:862
double e_conv
energy convergence
Definition: ccsd.h:191
virtual void SCS_MP2()
SCS-MP2 function and variables.
Definition: df_scs.cc:94
void CPU_I1ab(CCTaskParams params)
Definition: ccsd.cc:975
Definition: ccsd.h:219
double eccsd_os_fac
Definition: ccsd.h:99
void UpdateT2_mp4(long int iter)
Definition: linear.cc:221
cc/qci/mp task
Definition: ccsd.h:83
int cepa_level
Definition: ccsd.h:303
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: coupled_pair.cc:141
long int nqtasks
Definition: ccsd.h:74
void finalize()
free memory
Definition: coupled_pair.cc:759
char * name
Definition: ccsd.h:86
void mp4_triples()
mp4 triples
void I2ijkl_linear(CCTaskParams params)
Definition: linear.cc:372
int brueckner_iter
Definition: ccsd.h:55
void WriteOptions()
Definition: ccsd.cc:372
void WriteBanner()
Definition: ccsd.cc:350