Psi4
soscf.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 
47 #ifndef SOSCF_H
48 #define SOSCF_H
49 
51 #include "psi4/libmints/typedefs.h"
52 #include <map>
53 
54 namespace psi {
55 
57 class JK;
58 class IntegralTransform;
59 class PSIO;
60 class DF_Helper;
61 
62 class SOMCSCF {
63 
64 public:
65 
72  SOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO, SharedMatrix H);
73 
74  virtual ~SOMCSCF(void);
75 
80  void set_memory(size_t memory) { memory_ = memory; }
81 
86  void set_ras(std::vector<Dimension> ras_spaces);
87 
93 
100  void set_AO_IFock(SharedMatrix IFock);
106  SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order = 2);
107 
115 
121  double rhf_energy(SharedMatrix C);
122 
132  void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir,
133  SharedMatrix OPDM, SharedMatrix TPDM);
134 
139  void set_occ_fock(SharedMatrix occ_Fock);
140 
146 
153 
159 
164  SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true);
165 
170 
176  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
177 
178 
187 
194 
198  double gradient_rms();
199 
204  void zero_redundant(SharedMatrix vector);
205 
206  double current_total_energy() { return (energy_drc_ + energy_ci_); }
207  double current_docc_energy() { return energy_drc_; }
208  double current_ci_energy() { return energy_ci_; }
209  SharedMatrix current_AFock() { return matrices_["AFock"]; }
210  SharedMatrix current_IFock() { return matrices_["IFock"]; }
212  {
213  }
214 
215 protected:
216 
218  bool casscf_;
219  bool has_fzc_;
221  size_t memory_;
222 
224  double energy_drc_;
225  double energy_ci_;
226 
228  size_t nocc_;
229  size_t nact_;
230  size_t nvir_;
234 
235  size_t nirrep_;
236  size_t nmo_;
237  size_t nso_;
238  size_t nao_;
241 
242  // Non-redunant rotatations
245 
247  std::shared_ptr<JK> jk_;
248 
250  std::map<std::string, SharedMatrix > matrices_;
251 
253  std::vector<Dimension> ras_spaces_;
254  void check_ras();
255 
257  void zero_act(SharedMatrix vector);
258  void zero_ras(SharedMatrix vector);
259 
260  // Transform the integrals
261  virtual void transform(bool approx_only);
262 
263  // Grab actMO (dense)
264  virtual void set_act_MO();
265 
266 
267 }; // SOMCSCF class
268 
269 
275 class DFSOMCSCF : public SOMCSCF {
276 
277 public:
284  DFSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<DF_Helper> df, SharedMatrix AOTOSO,
285  SharedMatrix H);
286 
287  virtual ~DFSOMCSCF();
288 
289 protected:
290 
291  std::shared_ptr<DF_Helper> dfh_;
292  virtual void transform(bool approx_only);
293  virtual void set_act_MO();
294  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
296 
297 }; // DFSOMCSCF class
298 
304 class DiskSOMCSCF : public SOMCSCF {
305 
306 public:
312  DiskSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<IntegralTransform> ints, SharedMatrix AOTOSO, SharedMatrix H);
313 
314  virtual ~DiskSOMCSCF();
315 
316 protected:
317 
318  std::shared_ptr<IntegralTransform> ints_;
319  std::shared_ptr<PSIO> psio_;
320  virtual void transform(bool approx_only);
321  virtual void set_act_MO();
322  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
324 
325 }; // DiskSOMCSCF class
326 
333 class IncoreSOMCSCF : public SOMCSCF {
334 
335 public:
341  IncoreSOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO, SharedMatrix H);
342 
343  virtual ~IncoreSOMCSCF();
344  virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar);
345 
346 protected:
347 
348  virtual void set_act_MO();
349  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
351 
355 
356 };
357 
358 
359 } // Namespace psi
360 
361 
362 #endif
void zero_ras(SharedMatrix vector)
Definition: soscf.cc:790
size_t nao_
Definition: soscf.h:238
size_t memory_
Definition: soscf.h:221
virtual void set_eri_tensors(SharedMatrix, SharedMatrix)
Definition: soscf.h:211
int * U
Definition: stringlist.cc:66
Dimension noapi_
Definition: soscf.h:243
SharedMatrix gradient()
Definition: soscf.cc:768
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:972
DiskSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< IntegralTransform > ints, SharedMatrix AOTOSO, SharedMatrix H)
DiskSOMCSCF class.
Definition: soscf.cc:1109
void zero_redundant(SharedMatrix vector)
Definition: soscf.cc:770
std::shared_ptr< JK > jk_
Integral objects.
Definition: soscf.h:247
double energy_ci_
Definition: soscf.h:225
Dimension nsopi_
Definition: soscf.h:240
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:64
void zero_act(SharedMatrix vector)
Zero&#39;s out redundant rotations, will chose act or ras.
Definition: soscf.cc:777
double df[MAX_DF]
Definition: wavefunction.cc:62
size_t nso_
Definition: soscf.h:237
void set_occ_fock(SharedMatrix occ_Fock)
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1392
SOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
SOMCSCF class.
Definition: soscf.cc:50
virtual ~DFSOMCSCF()
Definition: soscf.cc:821
void set_memory(size_t memory)
Definition: soscf.h:80
SharedMatrix compute_AFock(SharedMatrix OPDM)
Definition: soscf.cc:502
virtual ~DiskSOMCSCF()
Definition: soscf.cc:1115
Dimension nmopi_
Definition: soscf.h:239
virtual void set_act_MO()
Definition: soscf.cc:1435
virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar)
Definition: soscf.cc:1445
double rhf_energy(SharedMatrix C)
Definition: soscf.cc:109
virtual void set_act_MO()
Definition: soscf.cc:70
void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir, SharedMatrix OPDM, SharedMatrix TPDM)
Definition: soscf.cc:162
IncoreSOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
IncoreSOMCSCF class.
Definition: soscf.cc:1388
virtual void transform(bool approx_only)
Definition: soscf.cc:1116
Definition: soscf.h:62
Dimension noccpi_
Definition: soscf.h:231
size_t nmo_
Definition: soscf.h:236
double current_docc_energy()
Definition: soscf.h:207
void set_frozen_orbitals(SharedMatrix Cfzc)
Definition: soscf.cc:85
std::vector< Dimension > ras_spaces_
RAS arrays.
Definition: soscf.h:253
SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order=2)
Definition: soscf.cc:132
std::shared_ptr< DF_Helper > dfh_
Definition: soscf.h:291
size_t nvir_
Definition: soscf.h:230
Definition: soscf.h:275
double gradient_rms()
Definition: soscf.cc:769
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1178
Dimension nactpi_
Definition: soscf.h:232
void set_ras(std::vector< Dimension > ras_spaces)
Definition: soscf.cc:71
DFSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< DF_Helper > df, SharedMatrix AOTOSO, SharedMatrix H)
End SOMCSCF class.
Definition: soscf.cc:816
SharedMatrix approx_solve()
Definition: soscf.cc:666
SharedMatrix Ck(SharedMatrix C, SharedMatrix x)
Definition: soscf.cc:155
virtual ~IncoreSOMCSCF()
Definition: soscf.cc:1391
size_t nact_
Definition: soscf.h:229
virtual void set_act_MO()
Definition: soscf.cc:1119
Definition: soscf.h:304
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:67
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1247
virtual ~SOMCSCF(void)
Definition: soscf.cc:60
Definition: dimension.h:38
bool compute_IFock_
Definition: soscf.h:220
bool casscf_
Parameters.
Definition: soscf.h:218
double energy_drc_
Doubles.
Definition: soscf.h:224
std::shared_ptr< IntegralTransform > ints_
Definition: soscf.h:318
SharedMatrix Hk(SharedMatrix x)
Definition: soscf.cc:527
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
size_t nirrep_
Definition: soscf.h:235
virtual void transform(bool approx_only)
Definition: soscf.cc:61
Definition: soscf.h:333
double current_total_energy()
Definition: soscf.h:206
void set_AO_IFock(SharedMatrix IFock)
Definition: soscf.cc:105
SharedMatrix mo_aaar_
Definition: soscf.h:354
std::map< std::string, SharedMatrix > matrices_
Map of matrices.
Definition: soscf.h:250
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:907
Dimension navpi_
Definition: soscf.h:244
SharedMatrix mo_aaaa_
Definition: soscf.h:353
bool has_fzc_
Definition: soscf.h:219
SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true)
Definition: soscf.cc:674
bool eri_tensor_set_
Definition: soscf.h:352
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1442
virtual void set_act_MO()
Definition: soscf.cc:898
SharedMatrix H_approx_diag()
Definition: soscf.cc:336
size_t nocc_
Orbital info.
Definition: soscf.h:228
SharedMatrix current_IFock()
Definition: soscf.h:210
SharedMatrix current_AFock()
Definition: soscf.h:209
double current_ci_energy()
Definition: soscf.h:208
virtual void transform(bool approx_only)
Definition: soscf.cc:822
void check_ras()
Definition: soscf.cc:75
std::shared_ptr< PSIO > psio_
Definition: soscf.h:319
Dimension nvirpi_
Definition: soscf.h:233