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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 
46 #ifndef SOSCF_H
47 #define SOSCF_H
48 
49 #include "psi4/libmints/typedefs.h"
50 #include <map>
51 
52 namespace psi {
53 
55 class JK;
56 class DFERI;
57 class IntegralTransform;
58 class PSIO;
59 
60 class SOMCSCF {
61 
62 public:
63 
70  // SOMCSCF(std::shared_ptr<JK> jk, SharedMatrix H, bool casscf);
71  SOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO,
72  SharedMatrix H);
73 
74  virtual ~SOMCSCF(void);
75 
80  void set_ras(std::vector<Dimension> ras_spaces);
81 
87 
94  void set_AO_IFock(SharedMatrix IFock);
100  SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order = 2);
101 
109 
115  double rhf_energy(SharedMatrix C);
116 
126  void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir,
127  SharedMatrix OPDM, SharedMatrix TPDM);
128 
133  void set_occ_fock(SharedMatrix occ_Fock);
134 
140 
147 
153 
158  SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true);
159 
164 
170  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
171 
172 
181 
188 
192  double gradient_rms();
193 
198  void zero_redundant(SharedMatrix vector);
199 
200  double current_total_energy() { return (energy_drc_ + energy_ci_); }
201  double current_docc_energy() { return energy_drc_; }
202  double current_ci_energy() { return energy_ci_; }
203  SharedMatrix current_AFock() { return matrices_["AFock"]; }
204  SharedMatrix current_IFock() { return matrices_["IFock"]; }
206  {
207  }
208 
209 protected:
210 
212  bool casscf_;
213  bool has_fzc_;
215 
217  double energy_drc_;
218  double energy_ci_;
219 
221  size_t nocc_;
222  size_t nact_;
223  size_t nvir_;
227 
228  size_t nirrep_;
229  size_t nmo_;
230  size_t nso_;
231  size_t nao_;
234 
235  // Non-redunant rotatations
238 
240  std::shared_ptr<JK> jk_;
241 
243  std::map<std::string, SharedMatrix > matrices_;
244 
246  std::vector<Dimension> ras_spaces_;
247  void check_ras();
248 
250  void zero_act(SharedMatrix vector);
251  void zero_ras(SharedMatrix vector);
252 
253  // Transform the integrals
254  virtual void transform(bool approx_only);
255 
256  // Grab actMO (dense)
257  virtual void set_act_MO();
258 
259 
260 }; // SOMCSCF class
261 
262 
268 class DFSOMCSCF : public SOMCSCF {
269 
270 public:
277  DFSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<DFERI> df, SharedMatrix AOTOSO,
278  SharedMatrix H);
279 
280  virtual ~DFSOMCSCF();
281 
282 protected:
283 
284  std::shared_ptr<DFERI> dferi_;
285  virtual void transform(bool approx_only);
286  virtual void set_act_MO();
287  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
289 
290 }; // DFSOMCSCF class
291 
297 class DiskSOMCSCF : public SOMCSCF {
298 
299 public:
305  DiskSOMCSCF(std::shared_ptr<JK> jk, std::shared_ptr<IntegralTransform> ints, SharedMatrix AOTOSO, SharedMatrix H);
306 
307  virtual ~DiskSOMCSCF();
308 
309 protected:
310 
311  std::shared_ptr<IntegralTransform> ints_;
312  std::shared_ptr<PSIO> psio_;
313  virtual void transform(bool approx_only);
314  virtual void set_act_MO();
315  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
317 
318 }; // DiskSOMCSCF class
319 
326 class IncoreSOMCSCF : public SOMCSCF {
327 
328 public:
334  IncoreSOMCSCF(std::shared_ptr<JK> jk, SharedMatrix AOTOSO, SharedMatrix H);
335 
336  virtual ~IncoreSOMCSCF();
337  virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar);
338 
339 protected:
340 
341  virtual void set_act_MO();
342  virtual SharedMatrix compute_Q(SharedMatrix TPDM);
344 
348 
349 };
350 
351 
352 } // Namespace psi
353 
354 
355 #endif
void zero_ras(SharedMatrix vector)
Definition: soscf.cc:828
size_t nao_
Definition: soscf.h:231
virtual void set_eri_tensors(SharedMatrix, SharedMatrix)
Definition: soscf.h:205
int * U
Definition: stringlist.cc:65
Dimension noapi_
Definition: soscf.h:236
SharedMatrix gradient()
Definition: soscf.cc:799
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1002
DiskSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< IntegralTransform > ints, SharedMatrix AOTOSO, SharedMatrix H)
DiskSOMCSCF class.
Definition: soscf.cc:1138
void zero_redundant(SharedMatrix vector)
Definition: soscf.cc:807
std::shared_ptr< JK > jk_
Integral objects.
Definition: soscf.h:240
double energy_ci_
Definition: soscf.h:218
Dimension nsopi_
Definition: soscf.h:233
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:67
void zero_act(SharedMatrix vector)
Zero&#39;s out redundant rotations, will chose act or ras.
Definition: soscf.cc:815
double df[MAX_DF]
Definition: wavefunction.cc:61
size_t nso_
Definition: soscf.h:230
void set_occ_fock(SharedMatrix occ_Fock)
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1448
SOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
SOMCSCF class.
Definition: soscf.cc:48
virtual ~DFSOMCSCF()
Definition: soscf.cc:860
SharedMatrix compute_AFock(SharedMatrix OPDM)
Definition: soscf.cc:524
virtual ~DiskSOMCSCF()
Definition: soscf.cc:1146
Dimension nmopi_
Definition: soscf.h:232
virtual void set_act_MO()
Definition: soscf.cc:1492
virtual void set_eri_tensors(SharedMatrix aaaa, SharedMatrix aaar)
Definition: soscf.cc:1505
std::shared_ptr< DFERI > dferi_
Definition: soscf.h:284
double rhf_energy(SharedMatrix C)
Definition: soscf.cc:122
virtual void set_act_MO()
Definition: soscf.cc:75
void update(SharedMatrix Cocc, SharedMatrix Cact, SharedMatrix Cvir, SharedMatrix OPDM, SharedMatrix TPDM)
Definition: soscf.cc:176
IncoreSOMCSCF(std::shared_ptr< JK > jk, SharedMatrix AOTOSO, SharedMatrix H)
IncoreSOMCSCF class.
Definition: soscf.cc:1439
virtual void transform(bool approx_only)
Definition: soscf.cc:1149
Definition: soscf.h:60
Dimension noccpi_
Definition: soscf.h:224
size_t nmo_
Definition: soscf.h:229
double current_docc_energy()
Definition: soscf.h:201
void set_frozen_orbitals(SharedMatrix Cfzc)
Definition: soscf.cc:96
DFSOMCSCF(std::shared_ptr< JK > jk, std::shared_ptr< DFERI > df, SharedMatrix AOTOSO, SharedMatrix H)
End SOMCSCF class.
Definition: soscf.cc:854
std::vector< Dimension > ras_spaces_
RAS arrays.
Definition: soscf.h:246
SharedMatrix form_rotation_matrix(SharedMatrix x, size_t order=2)
Definition: soscf.cc:146
size_t nvir_
Definition: soscf.h:223
Definition: soscf.h:268
double gradient_rms()
Definition: soscf.cc:803
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:1215
Dimension nactpi_
Definition: soscf.h:225
void set_ras(std::vector< Dimension > ras_spaces)
Definition: soscf.cc:79
SharedMatrix approx_solve()
Definition: soscf.cc:694
SharedMatrix Ck(SharedMatrix C, SharedMatrix x)
Definition: soscf.cc:169
virtual ~IncoreSOMCSCF()
Definition: soscf.cc:1445
size_t nact_
Definition: soscf.h:222
virtual void set_act_MO()
Definition: soscf.cc:1153
Definition: soscf.h:297
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:71
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1285
virtual ~SOMCSCF(void)
Definition: soscf.cc:60
Definition: dimension.h:39
bool compute_IFock_
Definition: soscf.h:214
bool casscf_
Parameters.
Definition: soscf.h:212
double energy_drc_
Doubles.
Definition: soscf.h:217
std::shared_ptr< IntegralTransform > ints_
Definition: soscf.h:311
SharedMatrix Hk(SharedMatrix x)
Definition: soscf.cc:549
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
size_t nirrep_
Definition: soscf.h:228
virtual void transform(bool approx_only)
Definition: soscf.cc:63
Definition: soscf.h:326
double current_total_energy()
Definition: soscf.h:200
void set_AO_IFock(SharedMatrix IFock)
Definition: soscf.cc:117
SharedMatrix mo_aaar_
Definition: soscf.h:347
std::map< std::string, SharedMatrix > matrices_
Map of matrices.
Definition: soscf.h:243
virtual SharedMatrix compute_Q(SharedMatrix TPDM)
Definition: soscf.cc:940
Dimension navpi_
Definition: soscf.h:237
SharedMatrix mo_aaaa_
Definition: soscf.h:346
bool has_fzc_
Definition: soscf.h:213
SharedMatrix solve(int max_iter=5, double conv=1.e-10, bool print=true)
Definition: soscf.cc:703
bool eri_tensor_set_
Definition: soscf.h:345
virtual SharedMatrix compute_Qk(SharedMatrix TPDM, SharedMatrix U, SharedMatrix Uact)
Definition: soscf.cc:1501
virtual void set_act_MO()
Definition: soscf.cc:926
SharedMatrix H_approx_diag()
Definition: soscf.cc:355
size_t nocc_
Orbital info.
Definition: soscf.h:221
SharedMatrix current_IFock()
Definition: soscf.h:204
SharedMatrix current_AFock()
Definition: soscf.h:203
double current_ci_energy()
Definition: soscf.h:202
virtual void transform(bool approx_only)
Definition: soscf.cc:863
void check_ras()
Definition: soscf.cc:84
std::shared_ptr< PSIO > psio_
Definition: soscf.h:312
Dimension nvirpi_
Definition: soscf.h:226