MPQC  3.0.0-alpha
psicc.h
1 //
2 // psicc.h
3 //
4 // Copyright (C) 2002 Edward Valeev
5 //
6 // Author: Edward Valeev <evaleev@vt.edu>
7 // Maintainer: EV
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit 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 Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _chemistry_qc_psi_psicc_h
29 #define _chemistry_qc_psi_psicc_h
30 
31 #include <chemistry/qc/psi/psiwfn.h>
32 #include <chemistry/qc/wfn/spin.h>
33 #include <math/distarray4/distarray4.h>
34 
35 namespace sc {
36 
39 
40  class PsiCC : public PsiCorrWavefunction {
41 
42  Ref<OrbitalSpace> occ_act_sb_[NSpinCases1];
43  Ref<OrbitalSpace> vir_act_sb_[NSpinCases1];
44  RefSCMatrix T1_[NSpinCases1];
45  RefSCMatrix T2_[NSpinCases2];
46  Ref<DistArray4> T2_da4_[NSpinCases2];
47  RefSCMatrix Tau2_[NSpinCases2];
48  RefSCMatrix Lambda1_[NSpinCases1];
49  RefSCMatrix Lambda2_[NSpinCases2];
50  Ref<DistArray4> Lambda2_da4_[NSpinCases2];
51 
52  Ref<OrbitalSpace> occ_sb_[NSpinCases1];
53 
54  protected:
55  // set to true if want to run only if Psi3 and MPQC orbitals match exactly up to a phase
56  static const bool use_sparsemap_only_ = false;
57 
59  RefSCMatrix T1(SpinCase1 spin, const std::string& L);
61  RefSCMatrix T2(SpinCase2 spin, const std::string& L);
63  Ref<DistArray4> T2_distarray4(SpinCase2 spin, const std::string& L);
64 
65  // get the T1 amplitudes (frozen core size) from
66  // non frozen core PSI CCSD density calculation as compute_1rdm = true
67  RefSCMatrix T1_fzc(SpinCase1 spin, const std::string& dpdlabel);
68  // get the T2 amplitudes (frozen core size) from
69  // non frozen core PSI CCSD density calculation as compute_1rdm = true
70  Ref<DistArray4> T2_distarray4_fzc(SpinCase2 spin12,
71  const std::string& dpdlabel);
72 
73  // read PSI3 ccsd one-particle density of spincase spin
74  RefSCMatrix Onerdm(SpinCase1 spin);
75  // read PSI3 relaxation 1e density of spincase spin
76  RefSCMatrix Onerdm_relax_X(SpinCase1 spin);
77  // test
78  RefSCMatrix Onerdm_relax_D(SpinCase1 spin);
79 // void compute_onerdm_relax(RefSCMatrix& Dorbs_alpha,
80 // RefSCMatrix& Dorbs_beta);
81 
82 #if 0
85  transform_T1(
86  const SparseMOIndexMap& occ_act_map,
87  const SparseMOIndexMap& vir_act_map,
88  const RefSCMatrix& T1,
92  transform_T2(
93  const SparseMOIndexMap& occ1_act_map,
94  const SparseMOIndexMap& occ2_act_map,
95  const SparseMOIndexMap& vir1_act_map,
96  const SparseMOIndexMap& vir2_act_map,
97  const RefSCMatrix& T2,
101  transform_T1(
102  const RefSCMatrix& occ_act_tform,
103  const RefSCMatrix& vir_act_tform,
104  const RefSCMatrix& T1,
105  const Ref<SCMatrixKit>& kit = SCMatrixKit::default_matrixkit()) const;
108  transform_T2(
109  const RefSCMatrix& occ1_act_tform,
110  const RefSCMatrix& occ2_act_tform,
111  const RefSCMatrix& vir1_act_tform,
112  const RefSCMatrix& vir2_act_tform,
113  const RefSCMatrix& T2,
114  const Ref<SCMatrixKit>& kit = SCMatrixKit::default_matrixkit()) const;
115 #endif
116  void compare_T2(const RefSCMatrix& T2, const RefSCMatrix& T2_ref, SpinCase2 spin12,
118  unsigned int no1, unsigned int no2, unsigned int nv1,
119  unsigned int nv2, double zero = 1e-8) const;
120 
122  void dpd_start();
124  void dpd_stop();
125 
127  const Ref<OrbitalSpace>& occ_act_sb(SpinCase1 spin);
129  const Ref<OrbitalSpace>& vir_act_sb(SpinCase1 spin);
130 
132  const Ref<OrbitalSpace>& occ_sb(SpinCase1 spin);
133 
134  int maxiter_; //< max number of CC iterations
135  static const int default_maxiter = 50;
136 
137  bool diis_;
138  int diis_nvector_;
139 
140  public:
141  PsiCC(const Ref<KeyVal>&);
142  PsiCC(StateIn&);
143  ~PsiCC();
144  void save_data_state(StateOut&);
145 
147  virtual const RefSCMatrix& T1(SpinCase1 spin1);
149  virtual const RefSCMatrix& T2(SpinCase2 spin2);
152  virtual Ref<DistArray4> T2_da4(SpinCase2 spin2, std::string dpdkey = "t");
154  virtual const RefSCMatrix& Tau2(SpinCase2 spin2);
156  virtual const RefSCMatrix& Lambda1(SpinCase1 spin1);
158  virtual const RefSCMatrix& Lambda2(SpinCase2 spin2);
160  virtual Ref<DistArray4> Lambda2_da4(SpinCase2 spin2);
161 
162  void obsolete();
163  };
164 
167 
168  class PsiCCSD : public PsiCC {
169  protected:
170  void write_input(int conv);
171  double pccsd_alpha_;
172  double pccsd_beta_;
173  double pccsd_gamma_;
174  public:
175  PsiCCSD(const Ref<KeyVal>&);
176  PsiCCSD(StateIn&);
177  ~PsiCCSD();
178  void save_data_state(StateOut&);
179  bool analytic_gradient_implemented() const;
180  };
181 
184 
185  class PsiCCSD_T : public PsiCC {
186  protected:
187  void write_input(int conv);
188  public:
189  PsiCCSD_T(const Ref<KeyVal>&);
190  PsiCCSD_T(StateIn&);
191  ~PsiCCSD_T();
192 
193  void save_data_state(StateOut&);
194  };
195 
198  class PsiCC2 : public PsiCC {
199  protected:
200  void write_input(int conv);
201  public:
202  PsiCC2(const Ref<KeyVal>&);
203  PsiCC2(StateIn&);
204  ~PsiCC2();
205 
206  void save_data_state(StateOut&);
207  };
208 
209 
212  class PsiCC3 : public PsiCC {
213  protected:
214  void write_input(int conv);
215  public:
216  PsiCC3(const Ref<KeyVal>&);
217  PsiCC3(StateIn&);
218  ~PsiCC3();
219 
220  void save_data_state(StateOut&);
221  };
222 
223 } // namespace
224 
225 #endif /* header guard */
sc::PsiCCSD
PsiCCSD is a concrete implementation of Psi CCSD wave function.
Definition: psicc.h:168
sc::PsiCC::T1
RefSCMatrix T1(SpinCase1 spin, const std::string &L)
read in T1-like quantity of spincase spin using DPD label L
sc::RefSCMatrix
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition: matrix.h:135
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::PsiCC::Lambda2_da4
virtual Ref< DistArray4 > Lambda2_da4(SpinCase2 spin2)
return T amplitudes of rank 2. The amplitudes are expressed in terms of Psi3 orbitals (symmetry-block...
sc::PsiCC::Lambda2
virtual const RefSCMatrix & Lambda2(SpinCase2 spin2)
return Lambda amplitudes of rank 2
sc::PsiCC::Lambda1
virtual const RefSCMatrix & Lambda1(SpinCase1 spin1)
return Lambda amplitudes of rank 1
sc::PsiCC::dpd_stop
void dpd_stop()
stop Psi3 DPD library
sc::PsiCC::T2
RefSCMatrix T2(SpinCase2 spin, const std::string &L)
read in T2-like quantity of spincase spin using DPD label L
sc::PsiCCSD_T::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::PsiCCSD::write_input
void write_input(int conv)
Prepares a complete Psi input file. The input file is assumed to have been opened.
sc::PsiCC2::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::PsiCC::vir_act_sb
const Ref< OrbitalSpace > & vir_act_sb(SpinCase1 spin)
return active virtual orbital space (symmetry-blocked)
sc::PsiCC::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::PsiCC::dpd_start
void dpd_start()
initialize Psi3 DPD library
sc::PsiCC3::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::PsiCCSD_T
PsiCCSD_T is a concrete implementation of Psi CCSD(T) wave function.
Definition: psicc.h:185
sc::StateIn
Definition: statein.h:79
sc::PsiCCSD_T::write_input
void write_input(int conv)
Prepares a complete Psi input file. The input file is assumed to have been opened.
sc::PsiCC2
PsiCC2 is a concrete implementation of Psi ground-state CC2 wave function.
Definition: psicc.h:198
sc::SCMatrixKit::default_matrixkit
static SCMatrixKit * default_matrixkit()
This returns the default matrix kit.
sc::PsiCC3::write_input
void write_input(int conv)
Prepares a complete Psi input file. The input file is assumed to have been opened.
sc::PsiCC::obsolete
void obsolete()
Marks all results as being out of date.
sc::StateOut
Definition: stateout.h:71
sc::PsiCC::compare_T2
void compare_T2(const RefSCMatrix &T2, const RefSCMatrix &T2_ref, SpinCase2 spin12, unsigned int no1, unsigned int no2, unsigned int nv1, unsigned int nv2, double zero=1e-8) const
compare T2 and T2_ref (check that elements < zero are in the same place and elements > soft_zero have...
sc::PsiCCSD::analytic_gradient_implemented
bool analytic_gradient_implemented() const
must overload this in a derived class if analytic gradient can be computed
sc::PsiCC::occ_act_sb
const Ref< OrbitalSpace > & occ_act_sb(SpinCase1 spin)
return active occupied orbital space (symmetry-blocked)
sc::PsiCC::T2_distarray4
Ref< DistArray4 > T2_distarray4(SpinCase2 spin, const std::string &L)
read in T2-like quantity of spincase spin using DPD label L
sc::PsiCC2::write_input
void write_input(int conv)
Prepares a complete Psi input file. The input file is assumed to have been opened.
sc::PsiCC3
PsiCC3 is a concrete implementation of Psi ground-state CC3 wave function.
Definition: psicc.h:212
sc::PsiCorrWavefunction
PsiCorrWavefunction is a Psi correlated wave function.
Definition: psiwfn.h:140
sc::PsiCC
PsiCC is a Psi coupled cluster wave function.
Definition: psicc.h:40
sc::PsiCCSD::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::PsiCC::occ_sb
const Ref< OrbitalSpace > & occ_sb(SpinCase1 spin)
return occupied orbital space (symmetry-blocked)
sc::PsiCC::T2_da4
virtual Ref< DistArray4 > T2_da4(SpinCase2 spin2, std::string dpdkey="t")
return T amplitudes of rank 2.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::PsiCC::Tau2
virtual const RefSCMatrix & Tau2(SpinCase2 spin2)
return Tau2 amplitudes. The amplitudes are expressed in terms of Psi3 orbitals (symmetry-blocked).

Generated at Sun Jan 26 2020 23:23:59 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.