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"
38 
39 long int Position(long int i,long int j);
40 
41 namespace psi{ namespace fnocc{
42 
44  public:
45 
46  CoupledCluster(std::shared_ptr<Wavefunction> reference_wavefunction,Options &options);
48 
49  double compute_energy();
50 
51  protected:
52 
53  int iter;
55 
56  void common_init();
57  void finalize();
58 
60  bool t2_on_disk;
61 
64  int ccmethod;
65 
68 
70  void DefineTasks();
71  void DefineLinearTasks();
72  void DefineQuadraticTasks();
74 
76  struct CCTaskParams{
78  };
80 
82  struct CCTask{
84  double flopcount;
85  char*name;
86  };
88 
91 
93  void SCS_MP2();
95 
97  void SCS_CCSD();
99 
103  double et;
104 
106  void mp4_triples();
107  double emp4_t;
108 
109  void WriteBanner();
110  void WriteOptions();
111 
113  virtual void AllocateMemory();
114 
122 
134 
141 
143  void MP2();
144 
146  void MP4_SDQ();
147 
151 
153  void UpdateT1(long int iter);
154  void UpdateT1_mp4(long int iter);
155 
157  void UpdateT2(long int iter);
158  void UpdateT2_mp4(long int iter);
159 
161  double CheckEnergy();
162 
164  void I2ijkl(CCTaskParams params);
166  void Vabcd1(CCTaskParams params);
167  void Vabcd2(CCTaskParams params);
168  void Vabcd(CCTaskParams params);
169  void K(CCTaskParams params);
171 
173  void DIIS(double*c,long int nvec,long int n,int replace_diis_iter);
174  void DIISOldVector(long int iter,int diis_iter,int replace_diis_iter);
175  double DIISErrorVector(int diis_iter,int replace_diis_iter,int iter);
176  void DIISNewAmplitudes(int diis_iter,int&replace_diis_iter);
177  long int maxdiis;
178  double*diisvec;
179 
182 
184  long int memory;
185 
187  long int maxiter;
188 
190  double e_conv;
191 
193  double r_conv;
194 
196  double *eps;
197 
199  double escf;
200 
203 
205  double*tb,*t1;
206 
208  double *w1,*I1,*I1p;
209 
211  void DefineTilingCPU();
215 };
216 
217 // DF CC class
219 
220  public:
223 
224  double compute_energy();
225 
226  protected:
227  void finalize();
228 
231 
232  void WriteBanner();
233 
235  virtual void AllocateMemory();
236 
238  void UpdateT1();
239 
241  virtual void UpdateT2();
242 
244  virtual void Vabcd1();
245 
247  double*Abij,*Sbij;
248 
250  virtual double CheckEnergy();
251 
254  long int nQ;
255  long int nQ_scf;
256  double*Qov,*Qvv,*Qoo;
257  void ThreeIndexIntegrals();
258 
260  double * Ca_L, * Ca_R, **Ca;
261  double *Fij, *Fab, *Fia, *Fai;
263 
265  virtual void T1Integrals();
267  virtual void T1Fock();
268 
270  virtual void CCResidual();
271 
273  virtual void SCS_MP2();
274 
276  virtual void SCS_CCSD();
277 };
278 
279 // coupled pair class
281 
282  public:
283  CoupledPair(std::shared_ptr<psi::Wavefunction>wfn,Options&options);
284  ~CoupledPair();
285 
286  double compute_energy();
287 
288  protected:
289 
292 
294  void finalize();
295 
297  void PairEnergy();
298  double * pair_energy;
299 
301  char * cepa_type;
303 
305  double CheckEnergy();
306 
308  double VariationalEnergy();
309  double evar;
310 
312  void UpdateT1();
313 
315  void UpdateT2();
316 
318  void SCS_CEPA();
319 
321  void OPDM();
322 
324  void WriteBanner();
325 };
326 
327 }}
328 
329 #endif
long int maxelem
Definition: ccsd.h:213
long int ndoccact
basic parameters
Definition: ccsd.h:181
double CheckEnergy()
check energy
Definition: coupled_pair.cc:717
double emp2_ss
Definition: ccsd.h:94
long int ncctasks
Definition: ccsd.h:73
void CPU_t1_vmeai_linear(CCTaskParams params)
Definition: linear.cc:46
long int nfzc
Definition: ccsd.h:181
long int lastov2tile
Definition: ccsd.h:212
void CPU_I2p_abci_refactored_term1_linear(CCTaskParams params)
Definition: linear.cc:155
bool ischolesky_
3-index integrals for density fitting.
Definition: ccsd.h:253
void WriteBanner()
banner
Definition: coupled_pair.cc:94
double eccsd
Definition: ccsd.h:98
Options & options() const
Definition: wavefunction.cc:396
double * Qvv
Definition: ccsd.h:256
double eccsd_ss
Definition: ccsd.h:98
double * Fij
Definition: ccsd.h:261
void I2iabj_linear(CCTaskParams params)
linear diagrams for mp4
Definition: linear.cc:556
virtual void AllocateMemory()
allocate memory
Definition: df_ccsd.cc:529
void DefineTasks()
define qci/cc/mp tasks
Definition: ccsd.cc:2017
void SCS_CCSD()
SCS-CCSD function and variables.
Definition: ccsd.cc:1898
long int nov2tiles
Definition: ccsd.h:214
CCTask * CCSubTasklist2
Definition: ccsd.h:87
double * I1
Definition: ccsd.h:208
void I2piajk_linear(CCTaskParams params)
Definition: linear.cc:411
void UpdateT1()
update t1 amplitudes
Definition: df_ccsd.cc:721
SharedMatrix H
Definition: ccsd.h:262
bool mp2_only
which cc method?
Definition: ccsd.h:63
double et
Definition: ccsd.h:103
virtual double CheckEnergy()
check energy
Definition: df_ccsd.cc:493
void DIISNewAmplitudes(int diis_iter, int &replace_diis_iter)
Definition: fnocc/diis.cc:203
long int lasttile
Definition: ccsd.h:213
CoupledPair(std::shared_ptr< psi::Wavefunction >wfn, Options &options)
Definition: coupled_pair.cc:59
long int tilesize
Definition: ccsd.h:213
double eccsd_os
Definition: ccsd.h:98
double * Fab
Definition: ccsd.h:261
void UpdateT1(long int iter)
Update t1.
Definition: ccsd.cc:1872
CCTask * LTasklist
Definition: ccsd.h:87
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: ccsd.cc:162
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:68
CCTaskParams * CCParams
Definition: ccsd.h:79
void UpdateT2(long int iter)
Update t2.
Definition: ccsd.cc:1819
double * Fia
Definition: ccsd.h:261
double * pair_energy
Definition: ccsd.h:298
long int nvirt_no
Definition: ccsd.h:181
virtual void CCResidual()
evaluate cc diagrams
Definition: df_cc_residual.cc:52
int ccmethod
Definition: ccsd.h:64
~CoupledCluster()
Definition: ccsd.cc:77
double CheckEnergy()
evaluate energy
Definition: ccsd.cc:1975
void I2piajk(CCTaskParams params)
Definition: ccsd.cc:1304
void(psi::fnocc::CoupledCluster::* func)(CCTaskParams)
Definition: ccsd.h:83
PsiReturnType
Definition: psi4-dec.h:49
long int memory
available memory
Definition: ccsd.h:184
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:187
long int nvirt
Definition: ccsd.h:181
bool isccsd
Definition: ccsd.h:63
void CPU_t1_vmeni_linear(CCTaskParams params)
Definition: linear.cc:71
double emp2_os_fac
Definition: ccsd.h:94
long int ovtilesize
Definition: ccsd.h:212
void Vabcd2_linear(CCTaskParams params)
Definition: linear.cc:498
virtual void Vabcd1()
v^4 CC diagram
Definition: df_ccsd.cc:796
double emp4_t
Definition: ccsd.h:107
double * tempv
Definition: ccsd.h:202
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:181
double * t1
Definition: ccsd.h:205
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:1235
void PairEnergy()
pair energies
Definition: coupled_pair.cc:453
SharedMatrix Ca() const
Returns the alpha electrons MO coefficients.
Definition: wavefunction.cc:466
char * cepa_type
what kind of coupled pair method?
Definition: ccsd.h:301
double emp4_q_ss
Definition: ccsd.h:150
virtual void T1Integrals()
generate t1-transformed 3-index integrals
Definition: df_t1_transformation.cc:225
void CPU_t1_vmaef(CCTaskParams params)
Definition: ccsd.cc:914
PsiReturnType CCSDIterations()
solve qcisd/ccsd equations
Definition: ccsd.cc:385
virtual void UpdateT2()
update t2 amplitudes
Definition: df_ccsd.cc:740
void UpdateT2()
update t2 amplitudes
Definition: coupled_pair.cc:488
double * eps
orbital energies
Definition: ccsd.h:196
int iter
Definition: ccsd.h:53
double * Sbij
Definition: ccsd.h:247
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:214
void Vabcd2(CCTaskParams params)
Definition: ccsd.cc:1450
CCTask * QTasklist
Definition: ccsd.h:87
CCTaskParams * QParams
Definition: ccsd.h:79
void DefineLinearTasks()
Definition: linear.cc:696
double emp2_ss_fac
Definition: ccsd.h:94
Definition: ccsd.h:43
long int ntiles
Definition: ccsd.h:214
CCTask * CCTasklist
Definition: ccsd.h:87
double * tb
t1 and t2 buffers
Definition: ccsd.h:205
double emp3_os
components of mp3 and mp4 energies
Definition: ccsd.h:149
~DFCoupledCluster()
Definition: df_ccsd.cc:64
PsiReturnType lowmemory_triples()
Definition: lowmemory_triples.cc:41
CCTaskParams * LParams
Definition: ccsd.h:79
double * Abij
workspace buffers.
Definition: ccsd.h:247
SharedWavefunction fnocc(SharedWavefunction, Options &)
Definition: fnocc.cc:37
long int ov2tilesize
Definition: ccsd.h:212
void CPU_I1pij_I1ia_lessmem_quadratic(CCTaskParams params)
Definition: quadratic.cc:126
void K(CCTaskParams params)
Definition: ccsd.cc:1521
void WriteBanner()
Definition: df_ccsd.cc:249
bool mp4_only
Definition: ccsd.h:63
bool t2_on_disk
is t2 on disk or held in main memory?
Definition: ccsd.h:60
long int maxdiis
Definition: ccsd.h:177
long int lastovtile
Definition: ccsd.h:212
double escf
reference energy
Definition: ccsd.h:199
void OPDM()
compute opdm - only valid for cisd, acpf, aqcc, and cepa(0)
Definition: fnocc/opdm.cc:42
double emp4_q_os
Definition: ccsd.h:150
long int ndocc
Definition: ccsd.h:181
bool isLowMemory
flag for low-memory triples algorithm
Definition: ccsd.h:67
double * w1
buffers for singles residual and a couple of tiny intermediates
Definition: ccsd.h:208
void DefineTilingCPU()
define tiling
Definition: ccsd.cc:641
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:149
double * Qov
Definition: ccsd.h:256
long int nQ_scf
Definition: ccsd.h:255
Definition: liboptions.h:360
void CPU_I2p_abci_refactored_term2(CCTaskParams params)
Definition: ccsd.cc:1086
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:239
double * Fai
Definition: ccsd.h:261
DFCoupledCluster(SharedWavefunction ref_wfn, Options &options)
Definition: df_ccsd.cc:58
double emp3
Definition: ccsd.h:149
double emp3_ss
Definition: ccsd.h:149
double flopcount
Definition: ccsd.h:84
int nso() const
Returns the number of SOs.
Definition: wavefunction.h:353
double evar
Definition: ccsd.h:309
double eccsd_ss_fac
Definition: ccsd.h:98
CCTaskParams * CCSubParams1
Definition: ccsd.h:79
void CPU_t1_vmaef_linear(CCTaskParams params)
Definition: linear.cc:100
task parameters - not used currently
Definition: ccsd.h:76
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:260
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:94
void common_init()
Definition: ccsd.cc:84
bool mp3_only
Definition: ccsd.h:63
std::shared_ptr< Wavefunction > reference_wavefunction() const
Returns the reference wavefunction.
Definition: wavefunction.cc:450
void SCS_CEPA()
scs functions
Definition: coupled_pair.cc:601
long int nQ
Definition: ccsd.h:254
double emp4_sd_ss
Definition: ccsd.h:149
double emp4_sd
Definition: ccsd.h:149
PsiReturnType CCSDIterations()
CCSD iterations.
Definition: df_ccsd.cc:269
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:94
void I2iabj_quadratic(CCTaskParams params)
linear diagrams for mp4
Definition: quadratic.cc:292
double * diisvec
Definition: ccsd.h:178
void SCS_MP2()
SCS-MP2 function and variables.
Definition: ccsd.cc:1937
double * integrals
workspace buffers.
Definition: ccsd.h:202
virtual void AllocateMemory()
allocate memory
Definition: ccsd.cc:731
long int nltasks
Definition: ccsd.h:73
double * Qoo
Definition: ccsd.h:256
void MP4_SDQ()
mp4(sdq)
Definition: ccsd.cc:2076
long int nmotemp
Definition: ccsd.h:181
double * tempt
Definition: ccsd.h:202
long int Position(long int i, long int j)
Definition: fnocc/blas.cc:35
void Vabcd1(CCTaskParams params)
Definition: ccsd.cc:1382
int nmo() const
Returns the number of MOs.
Definition: wavefunction.h:355
PsiReturnType triples()
cc or qci (t)
Definition: fnocc/triples.cc:41
CCTaskParams * CCSubParams2
Definition: ccsd.h:79
CCTask * CCSubTasklist1
Definition: ccsd.h:87
void CPU_I1pij_I1ia_lessmem(CCTaskParams params)
Definition: ccsd.cc:1122
void CPU_I1ab_quadratic(CCTaskParams params)
Definition: quadratic.cc:53
double r_conv
amplitude convergence
Definition: ccsd.h:193
EXTERN struct Params params
Definition: ccdensity/globals.h:54
double * Ca_L
more 3-index stuff for t1-transformed integrals
Definition: ccsd.h:260
double * I1p
Definition: ccsd.h:208
void finalize()
Definition: ccsd.cc:154
void I2iajb_quadratic(CCTaskParams params)
Definition: quadratic.cc:402
Definition: ccsd.h:280
double emp4_q
Definition: ccsd.h:150
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:52
void TwoJminusK(CCTaskParams params)
Definition: ccsd.cc:1651
void CPU_t1_vmeni(CCTaskParams params)
Definition: ccsd.cc:883
void CPU_t1_vmeai(CCTaskParams params)
some cc/qci diagrams
Definition: ccsd.cc:856
double e_conv
energy convergence
Definition: ccsd.h:190
virtual void SCS_MP2()
SCS-MP2 function and variables.
Definition: df_scs.cc:94
void CPU_I1ab(CCTaskParams params)
Definition: ccsd.cc:969
Definition: ccsd.h:218
double eccsd_os_fac
Definition: ccsd.h:98
void UpdateT2_mp4(long int iter)
Definition: linear.cc:221
cc/qci/mp task
Definition: ccsd.h:82
int cepa_level
Definition: ccsd.h:302
double compute_energy()
Compute energy. Subclasses override this function to compute its energy.
Definition: coupled_pair.cc:138
long int nqtasks
Definition: ccsd.h:73
void finalize()
free memory
Definition: coupled_pair.cc:756
char * name
Definition: ccsd.h:85
void mp4_triples()
mp4 triples
void I2ijkl_linear(CCTaskParams params)
Definition: linear.cc:372
int brueckner_iter
Definition: ccsd.h:54
void WriteOptions()
Definition: ccsd.cc:366
void WriteBanner()
Definition: ccsd.cc:344