28 #ifndef _chemistry_qc_ccr12_ccr12_info_h
29 #define _chemistry_qc_ccr12_ccr12_info_h
33 #include <util/misc/compute.h>
34 #include <util/group/memory.h>
35 #include <util/group/message.h>
36 #include <util/group/thread.h>
37 #include <chemistry/qc/basis/obint.h>
38 #include <chemistry/qc/basis/tbint.h>
39 #include <chemistry/qc/scf/scf.h>
40 #include <chemistry/qc/mbptr12/mbptr12.h>
41 #include <chemistry/qc/mbptr12/r12wfnworld.h>
42 #include <chemistry/qc/mbptr12/r12int_eval.h>
43 #include <chemistry/qc/ccr12/tensor.h>
44 #include <chemistry/qc/ccr12/tensorextrap.h>
55 const std::string theory_;
56 const std::string perturbative_;
88 void compute_source_integrals_rhf();
89 void compute_source_integrals_uhf();
90 void compute_source_integrals_rhf_r12();
96 void compute_corr_space();
127 void offset_vd2_gen(
bool need_cabs,
bool need_xx);
131 std::vector<long> sym_;
132 std::vector<long> range_;
133 std::vector<long> spin_;
134 std::vector<long> alpha_;
135 std::vector<long> offset_;
136 long noab_, nvab_, ncab_;
148 std::vector<unsigned int> mosyma_,mosymb_;
149 std::vector<unsigned int> cabssyma_,cabssymb_;
154 std::vector<double> orbital_evl_sorted_;
155 std::vector<long> orbital_spin_sorted_;
156 std::vector<long> orbital_sym_sorted_;
157 std::vector<long> momap_;
160 void set_naocc(
int i,
int j){naoa_=i; naob_=j;};
161 void set_navir(
int i,
int j){nava_=i; navb_=j;};
162 void set_ncabs(
int i,
int j){nria_=i; nrib_=j;};
163 void set_mosym(std::vector<unsigned int> i, std::vector<unsigned int> j){mosyma_=i; mosymb_=j;};
164 void set_cabssym(std::vector<unsigned int> i, std::vector<unsigned int> j){cabssyma_=i; cabssymb_=j;};
165 void set_fixed(
bool fixed){fixed_=fixed;};
166 void determine_tilesizes();
167 int determine_tilesize_each(
int,
int,
int, std::vector<unsigned int>&,
bool,
int&,
int);
168 void determine_maxtilesize(
double);
169 void print_tile_info();
171 void orbital_energies();
174 void transpose(
double* dest,
const double* source,
const int dim1,
const int dim2,
const double factor);
175 void transpose_1(
double* dest,
const double* source,
const int dim1,
const int dim2);
185 void retrieve_B_and_X_ii();
188 void retrieve_B_and_X_ip();
195 const Ref<SCF>,
int,
int,
int,
long,
long,
int,
int,
196 std::string,std::string,
int);
199 void print(std::ostream&);
201 double magnetic_moment()
const {
return ref_->magnetic_moment(); }
206 const Ref<SCF> ref(){
return ref_;};
207 bool fixed()
const {
return fixed_;};
208 long nirrep()
const {
return (
long)nirrep_;};
209 int nirrep_int()
const {
return nirrep_;};
210 int nfzc()
const {
return nfzc_;};
211 int nfzv()
const {
return nfzv_;};
212 int naoa()
const {
return naoa_;};
213 int nava()
const {
return nava_;};
214 int naob()
const {
return naob_;};
215 int navb()
const {
return navb_;};
216 int nria()
const {
return nria_;};
217 int nrib()
const {
return nrib_;};
218 int mosyma(
int i)
const {
return static_cast<int>(mosyma_[i]);};
219 int mosymb(
int i)
const {
return static_cast<int>(mosymb_[i]);};
220 int cabssyma(
int i)
const {
return static_cast<int>(cabssyma_[i]);};
221 int cabssymb(
int i)
const {
return static_cast<int>(cabssymb_[i]);};
225 long noab()
const {
return noab_;};
226 long nvab()
const {
return nvab_;};
227 long ncab()
const {
return ncab_;};
228 long nab()
const {
return noab_+nvab_+ncab_;};
229 bool restricted()
const {
return restricted_;};
231 long maxtilesize()
const {
return (
long)maxtilesize_; };
232 long get_sym(
long tile)
const {
return sym_[tile];};
233 long get_range(
long tile)
const {
return range_[tile];};
234 long get_spin(
long tile)
const {
return spin_[tile];};
235 long get_offset(
long tile)
const {
return offset_[tile];};
236 long get_alpha(
long tile)
const {
return alpha_[tile];};
237 double get_orb_energy(
long orb)
const {
return orbital_evl_sorted_[orb];};
239 Ref<Tensor> f1()
const {
return d_f1;};
240 Ref<Tensor> v2()
const {
return d_v2;};
241 Ref<Tensor> t1()
const {
return d_t1;};
242 Ref<Tensor> t2()
const {
return d_t2;};
243 Ref<Tensor> gt2()
const {
return d_gt2;};
244 Ref<Tensor> t3()
const {
return d_t3;};
245 Ref<Tensor> t4()
const {
return d_t4;};
247 Ref<Tensor> fr2()
const {
return d_fr2;};
248 Ref<Tensor> fd2()
const {
return d_fd2;};
249 Ref<Tensor> vr2()
const {
return d_vr2;};
250 Ref<Tensor> vd2()
const {
return d_vd2;};
251 Ref<Tensor> xs2()
const {
return d_xs2;};
252 Ref<Tensor> bs2()
const {
return d_bs2;};
253 Ref<Tensor> ps2()
const {
return d_ps2;};
255 Ref<Tensor> vd2_gen()
const {
return d_vd2_gen; };
257 Ref<Tensor> qy()
const {
return d_qy;};
258 Ref<Tensor> qx()
const {
return d_qx;};
259 Ref<Tensor> ly()
const {
return d_ly;};
260 Ref<Tensor> lx()
const {
return d_lx;};
262 Ref<Tensor> lambda1()
const {
return d_lambda1;};
263 Ref<Tensor> lambda2()
const {
return d_lambda2;};
264 Ref<Tensor> glambda2()
const {
return d_glambda2;};
265 Ref<Tensor> lambda3()
const {
return d_lambda3;};
267 const Ref<MemoryGrp>& mem()
const {
return mem_;};
268 long irrep_f()
const {
return irrep_f_;};
269 long irrep_v()
const {
return irrep_v_;};
270 long irrep_t()
const {
return irrep_t_;};
271 long irrep_e()
const {
return irrep_e_;};
272 long irrep_y()
const {
return irrep_y_;};
276 void restricted_2(
const long,
const long,
long&,
long& )
const;
277 void restricted_4(
const long,
const long,
const long,
const long,
long&,
long&,
long&,
long&)
const;
278 void restricted_6(
const long,
const long,
const long,
const long,
const long,
const long,
279 long&,
long&,
long&,
long&,
long&,
long&)
const;
280 void restricted_8(
const long,
const long,
const long,
const long,
const long,
const long,
const long,
const long,
281 long&,
long&,
long&,
long&,
long&,
long&,
long&,
long&)
const;
282 void sort_indices0(
const double* a,
double* b,
const double facter)
const {*b=facter*(*a);};
283 void sort_indices2(
const double*,
double*,
const long,
const long,
284 const int,
const int,
const double)
const;
285 void sort_indices4(
const double*,
double*,
const long,
const long,
const long,
const long,
286 const int,
const int,
const int,
const int,
const double)
const;
287 void sort_indices6(
const double*,
double*,
const long,
const long,
const long,
const long,
const long,
const long,
288 const int,
const int,
const int,
const int,
const int,
const int,
const double)
const;
289 void sort_indices8(
const double*,
double*,
const long,
const long,
const long,
const long,
const long,
const long,
const long,
const long,
290 const int,
const int,
const int,
const int,
const int,
const int,
const int,
const int,
const double)
const;
291 void sort_indices_acc6(
const double*,
double*,
const long,
const long,
const long,
const long,
const long,
const long,
292 const int,
const int,
const int,
const int,
const int,
const int,
const double)
const;
293 void sort_indices_acc8(
const double*,
double*,
const long,
const long,
const long,
const long,
const long,
const long,
const long,
const long,
294 const int,
const int,
const int,
const int,
const int,
const int,
const int,
const int,
const double)
const;
295 void smith_dgemm(
const long,
const long,
const long,
const double,
const double*,
const long,
296 const double*,
const long,
const double,
double*,
const long)
const;
301 bool need_t2()
const {
return need_t2_;};
302 bool need_t3()
const {
return need_t3_;};
303 bool need_t4()
const {
return need_t4_;};
304 bool need_w1()
const {
return need_w1_;};
305 bool need_w2()
const {
return need_w2_;};
306 bool need_gt2()
const {
return need_gt2_;};
307 bool need_FAA()
const {
return need_FAA_;};
308 bool need_VpA()
const {
return need_VpA_;};
312 double get_e(
const Ref<Tensor>&);
313 void jacobi_t1(
const Ref<Tensor>& r1){jacobi_t1_(r1,d_t1);};
314 void jacobi_t1_(
const Ref<Tensor>&,Ref<Tensor>&);
315 void jacobi_t2(
const Ref<Tensor>& r2){jacobi_t2_(r2,d_t2);};
316 void jacobi_t2_(
const Ref<Tensor>&,Ref<Tensor>&);
317 void jacobi_t3(
const Ref<Tensor>& r3){jacobi_t3_(r3,d_t3);};
318 void jacobi_t3_(
const Ref<Tensor>&,Ref<Tensor>&);
319 void jacobi_t4(
const Ref<Tensor>& r4){jacobi_t4_(r4,d_t4);};
320 void jacobi_t4_(
const Ref<Tensor>&,Ref<Tensor>&);
321 void jacobi_t2_and_gt2(
const Ref<Tensor>& r2,
const Ref<Tensor>& gr2) {jacobi_t2_and_gt2_(r2,d_t2,gr2,d_gt2);};
322 void jacobi_t2_and_gt2_(
const Ref<Tensor>&,Ref<Tensor>&,
const Ref<Tensor>&,Ref<Tensor>&);
324 void jacobi_lambda1(
const Ref<Tensor>& lr1) {jacobi_l1_(lr1,d_lambda1);};
325 void jacobi_l1_(
const Ref<Tensor>&,Ref<Tensor>&);
326 void jacobi_lambda2(
const Ref<Tensor>& lr2) {jacobi_l2_(lr2,d_lambda2);};
327 void jacobi_l2_(
const Ref<Tensor>&,Ref<Tensor>&);
334 double energy_lagrangian_r3(
const Ref<Tensor>&)
const;
338 Ref<SCExtrapData> edata(Ref<Tensor> t){
return new TensorExtrapData(t);};
339 Ref<SCExtrapError> eerr(Ref<Tensor> t) {
return new TensorExtrapError(t);};
343 void offset_t2(Ref<Tensor>&,
bool);
344 void offset_gt2(Ref<Tensor>&,
bool);
345 void offset_t3(Ref<Tensor>&,
bool);
346 void offset_t4(Ref<Tensor>&,
bool);
347 void offset_e(Ref<Tensor>&);
349 void offset_x_gen(Ref<Tensor>& t,
const bool need_xx,
const bool lprint =
false);
360 void offset_l1(Ref<Tensor>&);
361 void offset_l2(Ref<Tensor>&);
365 void guess_t2_r12(Ref<Tensor>& d_t2_, Ref<Tensor>& d_gt2_);
366 void guess_lambda1(Ref<Tensor>& d_lambda1_);
367 void guess_lambda1() {guess_lambda1(d_lambda1);};
368 void guess_lambda2(Ref<Tensor>& d_lambda2_);
369 void guess_lambda2() {guess_lambda2(d_lambda2);};
370 void guess_glambda2(Ref<Tensor>& d_glambda2_);
371 void guess_glambda2() {guess_glambda2(d_glambda2);};
377 void fill_in_vr_and_vd();
378 void fill_in_fr_and_fd();
379 void fill_in_vd2_gen(
bool need_cabs,
bool need_xx);
383 long momap(
long i)
const {
return momap_[i];};
391 RefSymmSCMatrix B_ip() {
return B_ip_; };
392 RefSymmSCMatrix X_ip() {
return X_ip_; };
395 Ref<OrbitalSpace> corr_space() {
return corr_space_; };
398 void denom_contraction(
const Ref<Tensor>&, Ref<Tensor>&);
399 void prediagon(RefDiagSCMatrix& eigvals, RefSCMatrix& eigvecs);
400 RefSCMatrix lmatrix() {
return lmatrix_; };
401 RefDiagSCMatrix bdiag() {
return bdiag_; };