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 
50 #include "psi4/libmints/typedefs.h"
51 #include <map>
52 
53 namespace psi {
54 
56 class JK;
57 class DFERI;
58 class IntegralTransform;
59 class PSIO;
60 
61 class SOMCSCF {
62 
63 public:
64 
71  SOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO, SharedMatrix H);
72 
73  virtual ~SOMCSCF(void);
74 
79  void set_memory(size_t memory) { memory_ = memory; }
80 
85  void set_ras(std::vector<Dimension> ras_spaces);
86 
92 
99  void set_AO_IFock(SharedMatrix IFock);
105  SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order = 2);
106 
114 
120  double rhf_energy(SharedMatrix C);
121 
131  void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir,
132  SharedMatrix OPDM, SharedMatrix TPDM);
133 
138  void set_occ_fock(SharedMatrix occ_Fock);
139 
145 
152 
158 
163  SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true);
164 
169 
175  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
176 
177 
186 
193 
197  double gradient_rms();
198 
203  void zero_redundant(SharedMatrix vector);
204 
205  double current_total_energy() { return (energy_drc_ + energy_ci_); }
206  double current_docc_energy() { return energy_drc_; }
207  double current_ci_energy() { return energy_ci_; }
208  SharedMatrix current_AFock() { return matrices_["AFock"]; }
209  SharedMatrix current_IFock() { return matrices_["IFock"]; }
211  {
212  }
213 
214 protected:
215 
217  bool casscf_;
218  bool has_fzc_;
220  size_t memory_;
221 
223  double energy_drc_;
224  double energy_ci_;
225 
227  size_t nocc_;
228  size_t nact_;
229  size_t nvir_;
233 
234  size_t nirrep_;
235  size_t nmo_;
236  size_t nso_;
237  size_t nao_;
240 
241  // Non-redunant rotatations
244 
246  std::shared_ptr<JK> jk_;
247 
249  std::map<std::string, SharedMatrix > matrices_;
250 
252  std::vector<Dimension> ras_spaces_;
253  void check_ras();
254 
256  void zero_act(SharedMatrix vector);
257  void zero_ras(SharedMatrix vector);
258 
259  // Transform the integrals
260  virtual void transform(bool approx_only);
261 
262  // Grab actMO (dense)
263  virtual void set_act_MO();
264 
265 
266 }; // SOMCSCF class
267 
268 
274 class DFSOMCSCF : public SOMCSCF {
275 
276 public:
283  DFSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<DFERI> df, SharedMatrix AOTOSO,
284  SharedMatrix H);
285 
286  virtual ~DFSOMCSCF();
287 
288 protected:
289 
290  std::shared_ptr<DFERI> dferi_;
291  virtual void transform(bool approx_only);
292  virtual void set_act_MO();
293  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
295 
296 }; // DFSOMCSCF class
297 
303 class DiskSOMCSCF : public SOMCSCF {
304 
305 public:
311  DiskSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<IntegralTransform> ints, SharedMatrix AOTOSO, SharedMatrix H);
312 
313  virtual ~DiskSOMCSCF();
314 
315 protected:
316 
317  std::shared_ptr<IntegralTransform> ints_;
318  std::shared_ptr<PSIO> psio_;
319  virtual void transform(bool approx_only);
320  virtual void set_act_MO();
321  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
323 
324 }; // DiskSOMCSCF class
325 
332 class IncoreSOMCSCF : public SOMCSCF {
333 
334 public:
340  IncoreSOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO, SharedMatrix H);
341 
342  virtual ~IncoreSOMCSCF();
343  virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar);
344 
345 protected:
346 
347  virtual void set_act_MO();
348  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
350 
354 
355 };
356 
357 
358 } // Namespace psi
359 
360 
361 #endif
void zero_ras(SharedMatrix vector)
Definition: soscf.cc:829
size_t nao_
Definition: soscf.h:237
size_t memory_
Definition: soscf.h:220
virtual void set_eri_tensors(SharedMatrix, SharedMatrix)
Definition: soscf.h:210
int * U
Definition: stringlist.cc:66
Dimension noapi_
Definition: soscf.h:242
SharedMatrix gradient()
Definition: soscf.cc:800
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1016
DiskSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< IntegralTransform > ints, SharedMatrix AOTOSO, SharedMatrix H)
DiskSOMCSCF class.
Definition: soscf.cc:1162
void zero_redundant(SharedMatrix vector)
Definition: soscf.cc:808
std::shared_ptr< JK > jk_
Integral objects.
Definition: soscf.h:246
double energy_ci_
Definition: soscf.h:224
Dimension nsopi_
Definition: soscf.h:239
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:68
void zero_act(SharedMatrix vector)
Zero&#39;s out redundant rotations, will chose act or ras.
Definition: soscf.cc:816
double df[MAX_DF]
Definition: wavefunction.cc:63
size_t nso_
Definition: soscf.h:236
void set_occ_fock(SharedMatrix occ_Fock)
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1472
SOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
SOMCSCF class.
Definition: soscf.cc:49
virtual ~DFSOMCSCF()
Definition: soscf.cc:861
void set_memory(size_t memory)
Definition: soscf.h:79
SharedMatrix compute_AFock(SharedMatrix OPDM)
Definition: soscf.cc:525
virtual ~DiskSOMCSCF()
Definition: soscf.cc:1170
Dimension nmopi_
Definition: soscf.h:238
virtual void set_act_MO()
Definition: soscf.cc:1516
virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar)
Definition: soscf.cc:1529
std::shared_ptr< DFERI > dferi_
Definition: soscf.h:290
double rhf_energy(SharedMatrix C)
Definition: soscf.cc:123
virtual void set_act_MO()
Definition: soscf.cc:76
void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir, SharedMatrix OPDM, SharedMatrix TPDM)
Definition: soscf.cc:177
IncoreSOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
IncoreSOMCSCF class.
Definition: soscf.cc:1463
virtual void transform(bool approx_only)
Definition: soscf.cc:1173
Definition: soscf.h:61
Dimension noccpi_
Definition: soscf.h:230
size_t nmo_
Definition: soscf.h:235
double current_docc_energy()
Definition: soscf.h:206
void set_frozen_orbitals(SharedMatrix Cfzc)
Definition: soscf.cc:97
DFSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< DFERI > df, SharedMatrix AOTOSO, SharedMatrix H)
End SOMCSCF class.
Definition: soscf.cc:855
std::vector< Dimension > ras_spaces_
RAS arrays.
Definition: soscf.h:252
SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order=2)
Definition: soscf.cc:147
size_t nvir_
Definition: soscf.h:229
Definition: soscf.h:274
double gradient_rms()
Definition: soscf.cc:804
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1239
Dimension nactpi_
Definition: soscf.h:231
void set_ras(std::vector< Dimension > ras_spaces)
Definition: soscf.cc:80
SharedMatrix approx_solve()
Definition: soscf.cc:695
SharedMatrix Ck(SharedMatrix C, SharedMatrix x)
Definition: soscf.cc:170
virtual ~IncoreSOMCSCF()
Definition: soscf.cc:1469
size_t nact_
Definition: soscf.h:228
virtual void set_act_MO()
Definition: soscf.cc:1177
Definition: soscf.h:303
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:72
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1309
virtual ~SOMCSCF(void)
Definition: soscf.cc:61
Definition: dimension.h:40
bool compute_IFock_
Definition: soscf.h:219
bool casscf_
Parameters.
Definition: soscf.h:217
double energy_drc_
Doubles.
Definition: soscf.h:223
std::shared_ptr< IntegralTransform > ints_
Definition: soscf.h:317
SharedMatrix Hk(SharedMatrix x)
Definition: soscf.cc:550
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
size_t nirrep_
Definition: soscf.h:234
virtual void transform(bool approx_only)
Definition: soscf.cc:64
Definition: soscf.h:332
double current_total_energy()
Definition: soscf.h:205
void set_AO_IFock(SharedMatrix IFock)
Definition: soscf.cc:118
SharedMatrix mo_aaar_
Definition: soscf.h:353
std::map< std::string, SharedMatrix > matrices_
Map of matrices.
Definition: soscf.h:249
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:941
Dimension navpi_
Definition: soscf.h:243
SharedMatrix mo_aaaa_
Definition: soscf.h:352
bool has_fzc_
Definition: soscf.h:218
SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true)
Definition: soscf.cc:704
bool eri_tensor_set_
Definition: soscf.h:351
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1525
virtual void set_act_MO()
Definition: soscf.cc:927
SharedMatrix H_approx_diag()
Definition: soscf.cc:356
size_t nocc_
Orbital info.
Definition: soscf.h:227
SharedMatrix current_IFock()
Definition: soscf.h:209
SharedMatrix current_AFock()
Definition: soscf.h:208
double current_ci_energy()
Definition: soscf.h:207
virtual void transform(bool approx_only)
Definition: soscf.cc:864
void check_ras()
Definition: soscf.cc:85
std::shared_ptr< PSIO > psio_
Definition: soscf.h:318
Dimension nvirpi_
Definition: soscf.h:232