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 DFERI;
59 class IntegralTransform;
60 class PSIO;
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<DFERI> df, SharedMatrix AOTOSO,
285  SharedMatrix H);
286 
287  virtual ~DFSOMCSCF();
288 
289 protected:
290 
291  std::shared_ptr<DFERI> dferi_;
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:832
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:803
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1019
DiskSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< IntegralTransform > ints, SharedMatrix AOTOSO, SharedMatrix H)
DiskSOMCSCF class.
Definition: soscf.cc:1165
void zero_redundant(SharedMatrix vector)
Definition: soscf.cc:811
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:71
void zero_act(SharedMatrix vector)
Zero&#39;s out redundant rotations, will chose act or ras.
Definition: soscf.cc:819
double df[MAX_DF]
Definition: wavefunction.cc:61
size_t nso_
Definition: soscf.h:237
void set_occ_fock(SharedMatrix occ_Fock)
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1475
SOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
SOMCSCF class.
Definition: soscf.cc:52
virtual ~DFSOMCSCF()
Definition: soscf.cc:864
void set_memory(size_t memory)
Definition: soscf.h:80
SharedMatrix compute_AFock(SharedMatrix OPDM)
Definition: soscf.cc:528
virtual ~DiskSOMCSCF()
Definition: soscf.cc:1173
Dimension nmopi_
Definition: soscf.h:239
virtual void set_act_MO()
Definition: soscf.cc:1519
virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar)
Definition: soscf.cc:1532
std::shared_ptr< DFERI > dferi_
Definition: soscf.h:291
double rhf_energy(SharedMatrix C)
Definition: soscf.cc:126
virtual void set_act_MO()
Definition: soscf.cc:79
void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir, SharedMatrix OPDM, SharedMatrix TPDM)
Definition: soscf.cc:180
IncoreSOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
IncoreSOMCSCF class.
Definition: soscf.cc:1466
virtual void transform(bool approx_only)
Definition: soscf.cc:1176
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:100
DFSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< DFERI > df, SharedMatrix AOTOSO, SharedMatrix H)
End SOMCSCF class.
Definition: soscf.cc:858
std::vector< Dimension > ras_spaces_
RAS arrays.
Definition: soscf.h:253
SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order=2)
Definition: soscf.cc:150
size_t nvir_
Definition: soscf.h:230
Definition: soscf.h:275
double gradient_rms()
Definition: soscf.cc:807
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1242
Dimension nactpi_
Definition: soscf.h:232
void set_ras(std::vector< Dimension > ras_spaces)
Definition: soscf.cc:83
SharedMatrix approx_solve()
Definition: soscf.cc:698
SharedMatrix Ck(SharedMatrix C, SharedMatrix x)
Definition: soscf.cc:173
virtual ~IncoreSOMCSCF()
Definition: soscf.cc:1472
size_t nact_
Definition: soscf.h:229
virtual void set_act_MO()
Definition: soscf.cc:1180
Definition: soscf.h:304
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:75
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1312
virtual ~SOMCSCF(void)
Definition: soscf.cc:64
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:553
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:67
Definition: soscf.h:333
double current_total_energy()
Definition: soscf.h:206
void set_AO_IFock(SharedMatrix IFock)
Definition: soscf.cc:121
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:944
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:707
bool eri_tensor_set_
Definition: soscf.h:352
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1528
virtual void set_act_MO()
Definition: soscf.cc:930
SharedMatrix H_approx_diag()
Definition: soscf.cc:359
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:867
void check_ras()
Definition: soscf.cc:88
std::shared_ptr< PSIO > psio_
Definition: soscf.h:319
Dimension nvirpi_
Definition: soscf.h:233