Permalink
Browse files

Use timer_on/timer_off in ccenergy

  • Loading branch information...
robertodr committed Sep 27, 2018
1 parent 7e5e4a0 commit 57e3c42d33fe7968009c3c5107a229d24cc2558c
@@ -80,9 +80,7 @@ void CCEnergyWavefunction::BT2() {
global_dpd_->buf4_close(&B);
global_dpd_->buf4_close(&tauIjAb);
} else if (params_.abcd == "OLD") {
#ifdef TIME_CCENERGY
timer_on("ABCD:old");
#endif
global_dpd_->buf4_init(&tauIjAb, PSIF_CC_TAMPS, 0, 0, 5, 0, 5, 0, "tauIjAb");
global_dpd_->buf4_init(&B, PSIF_CC_BINTS, 0, 5, 5, 5, 5, 0, "B <ab|cd>");
global_dpd_->buf4_init(&Z1, PSIF_CC_TMP0, 0, 5, 0, 5, 0, 0, "Z(Ab,Ij)");
@@ -91,13 +89,9 @@ void CCEnergyWavefunction::BT2() {
global_dpd_->buf4_close(&Z1);
global_dpd_->buf4_close(&B);
global_dpd_->buf4_close(&tauIjAb);
#ifdef TIME_CCENERGY
timer_off("ABCD:old");
#endif
} else if (params_.abcd == "NEW") {
#ifdef TIME_CCENERGY
timer_on("ABCD:new");
#endif
/* tau(-)(ij,ab) (i>j, a>b) = tau(ij,ab) - tau(ij,ba) */
global_dpd_->buf4_init(&tau_a, PSIF_CC_TAMPS, 0, 4, 9, 0, 5, 1, "tauIjAb");
global_dpd_->buf4_copy(&tau_a, PSIF_CC_TAMPS, "tau(-)(ij,ab)");
@@ -112,19 +106,15 @@ void CCEnergyWavefunction::BT2() {
global_dpd_->buf4_copy(&tau_a, PSIF_CC_TAMPS, "tau(+)(ij,ab)");
global_dpd_->buf4_close(&tau_a);
#ifdef TIME_CCENERGY
timer_on("ABCD:S");
#endif
global_dpd_->buf4_init(&tau_s, PSIF_CC_TAMPS, 0, 3, 8, 3, 8, 0, "tau(+)(ij,ab)");
global_dpd_->buf4_init(&B_s, PSIF_CC_BINTS, 0, 8, 8, 8, 8, 0, "B(+) <ab|cd> + <ab|dc>");
global_dpd_->buf4_init(&S, PSIF_CC_TMP0, 0, 8, 3, 8, 3, 0, "S(ab,ij)");
global_dpd_->contract444(&B_s, &tau_s, &S, 0, 0, 0.5, 0);
global_dpd_->buf4_close(&S);
global_dpd_->buf4_close(&B_s);
global_dpd_->buf4_close(&tau_s);
#ifdef TIME_CCENERGY
timer_off("ABCD:S");
#endif
/* tau_diag(ij,c) = 2 * tau(ij,cc)*/
global_dpd_->buf4_init(&tau, PSIF_CC_TAMPS, 0, 3, 8, 3, 8, 0, "tau(+)(ij,ab)");
@@ -182,33 +172,25 @@ void CCEnergyWavefunction::BT2() {
global_dpd_->free_dpd_block(tau_diag, tau.params->rowtot[0], moinfo_.nvirt);
global_dpd_->buf4_close(&tau);
#ifdef TIME_CCENERGY
timer_on("ABCD:A");
#endif
global_dpd_->buf4_init(&tau_a, PSIF_CC_TAMPS, 0, 4, 9, 4, 9, 0, "tau(-)(ij,ab)");
global_dpd_->buf4_init(&B_a, PSIF_CC_BINTS, 0, 9, 9, 9, 9, 0, "B(-) <ab|cd> - <ab|dc>");
global_dpd_->buf4_init(&A, PSIF_CC_TMP0, 0, 9, 4, 9, 4, 0, "A(ab,ij)");
global_dpd_->contract444(&B_a, &tau_a, &A, 0, 0, 0.5, 0);
global_dpd_->buf4_close(&A);
global_dpd_->buf4_close(&B_a);
global_dpd_->buf4_close(&tau_a);
#ifdef TIME_CCENERGY
timer_off("ABCD:A");
#endif
#ifdef TIME_CCENERGY
timer_on("ABCD:axpy");
#endif
global_dpd_->buf4_init(&S, PSIF_CC_TMP0, 0, 5, 0, 8, 3, 0, "S(ab,ij)");
global_dpd_->buf4_sort_axpy(&S, PSIF_CC_TAMPS, rspq, 0, 5, "New tIjAb", 1);
global_dpd_->buf4_close(&S);
global_dpd_->buf4_init(&A, PSIF_CC_TMP0, 0, 5, 0, 9, 4, 0, "A(ab,ij)");
global_dpd_->buf4_sort_axpy(&A, PSIF_CC_TAMPS, rspq, 0, 5, "New tIjAb", 1);
global_dpd_->buf4_close(&A);
#ifdef TIME_CCENERGY
timer_off("ABCD:axpy");
timer_off("ABCD:new");
#endif
}
} else if (params_.ref == 1) { /** ROHF **/
@@ -60,9 +60,7 @@ void CCEnergyWavefunction::Wmbej_build() {
dpdfile2 tIA, tia;
int Gmb, mb, Gj, Ge, Gf, nrows, ncols, nlinks;
#ifdef TIME_CCENERGY
timer_on("C->Wmbej");
#endif
/* W(mb,je) <-- <mb||ej> */
@@ -118,10 +116,8 @@ void CCEnergyWavefunction::Wmbej_build() {
global_dpd_->buf4_close(&C);
}
#ifdef TIME_CCENERGY
timer_off("C->Wmbej");
timer_on("F->Wmbej");
#endif
if (params_.ref == 0) { /** RHF **/
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
@@ -264,10 +260,8 @@ void CCEnergyWavefunction::Wmbej_build() {
global_dpd_->file2_close(&tia);
}
#ifdef TIME_CCENERGY
timer_off("F->Wmbej");
timer_on("E->Wmbej");
#endif
if (params_.ref == 0) { /** RHF **/
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
@@ -364,9 +358,7 @@ void CCEnergyWavefunction::Wmbej_build() {
global_dpd_->file2_close(&tia);
}
#ifdef TIME_CCENERGY
timer_off("E->Wmbej");
#endif
/* Convert to (ME,JB) for remaining terms */
@@ -432,9 +424,7 @@ void CCEnergyWavefunction::Wmbej_build() {
global_dpd_->buf4_close(&W);
}
#ifdef TIME_CCENERGY
timer_on("X->Wmbej");
#endif
if (params_.ref == 0) { /** RHF **/
global_dpd_->file2_init(&tIA, PSIF_CC_OEI, 0, 0, 1, "tIA");
@@ -767,9 +757,7 @@ void CCEnergyWavefunction::Wmbej_build() {
global_dpd_->file2_close(&tia);
}
#ifdef TIME_CCENERGY
timer_off("X->Wmbej");
#endif
}
} // namespace ccenergy
} // namespace psi
@@ -45,9 +45,7 @@ void CCEnergyWavefunction::Z_build() {
dpdbuf4 tauIJAB, tauijab, tauIjAb, tauIjbA, F_anti, F, tau;
int Gmb, Gij, mb, nrows, ncols;
#ifdef TIME_CCENERGY
timer_on("Z");
#endif
if (params_.ref == 0) { /** RHF **/
/* ZMbIj = <Mb|Ef> * tau(Ij,Ef) */
@@ -158,9 +156,7 @@ void CCEnergyWavefunction::Z_build() {
global_dpd_->buf4_close(&ZIjAm);
}
#ifdef TIME_CCENERGY
timer_off("Z");
#endif
}
} // namespace ccenergy
@@ -65,9 +65,7 @@ void CCEnergyWavefunction::cc2_Wabei_build() {
dpdbuf4 Z, Z1, Z2, Z3;
dpdbuf4 B, C, D, F, W;
#ifdef TIME_CCENERGY
timer_on("F->Wabei");
#endif
if (params_.ref == 0) { /** RHF **/
global_dpd_->buf4_init(&F, PSIF_CC_FINTS, 0, 11, 5, 11, 5, 0, "F <ai|bc>");
global_dpd_->buf4_copy(&F, PSIF_CC_TMP0, "CC2 WAbEi (Ei,Ab)");
@@ -113,10 +111,8 @@ void CCEnergyWavefunction::cc2_Wabei_build() {
global_dpd_->buf4_sort(&F, PSIF_CC_TMP0, psrq, 29, 25, "CC2 WaBeI (aB,eI)");
global_dpd_->buf4_close(&F);
}
#ifdef TIME_CCENERGY
timer_off("F->Wabei");
timer_on("B->Wabei");
#endif
if (params_.ref == 0) { /** RHF **/
global_dpd_->file2_init(&t1, PSIF_CC_OEI, 0, 0, 1, "tIA");
@@ -267,10 +263,8 @@ void CCEnergyWavefunction::cc2_Wabei_build() {
global_dpd_->file2_close(&tIA);
global_dpd_->file2_close(&tia);
}
#ifdef TIME_CCENERGY
timer_off("B->Wabei");
timer_on("Wabei_sort");
#endif
if (params_.ref == 0) { /* RHF */
global_dpd_->buf4_init(&W, PSIF_CC2_HET1, 0, 5, 11, 5, 11, 0, "CC2 WAbEi");
@@ -316,9 +310,7 @@ void CCEnergyWavefunction::cc2_Wabei_build() {
global_dpd_->buf4_sort(&W, PSIF_CC2_HET1, rspq, 25, 29, "CC2 WaBeI (eI,aB)");
global_dpd_->buf4_close(&W);
}
#ifdef TIME_CCENERGY
timer_off("Wabei_sort");
#endif
}
void CCEnergyWavefunction::purge_cc2_Wabei() {
@@ -35,6 +35,7 @@
#include "psi4/libdpd/dpd.h"
#include "Params.h"
#include "psi4/cc/ccwave.h"
#include "psi4/libqt/qt.h"
namespace psi {
namespace ccenergy {
@@ -43,34 +44,22 @@ void CCEnergyWavefunction::cc2_t2_build() {
DT2();
if ((params_.ref == 0) || params_.t2_coupled) { /** RHF or ROHF with coupled T2's **/
#ifdef TIME_CCENERGY
timer_on("fT2", "outfile");
#endif
timer_on("fT2");
cc2_faeT2();
cc2_fmiT2();
if (params_.print & 2) status("f -> T2", "outfile");
#ifdef TIME_CCENERGY
timer_off("fT2", "outfile");
#endif
timer_off("fT2");
}
#ifdef TIME_CCENERGY
timer_on("WmbijT2", "outfile");
#endif
timer_on("WmbijT2");
cc2_WmbijT2();
if (params_.print & 2) status("Wmbij -> T2", "outfile");
#ifdef TIME_CCENERGY
timer_off("WmbijT2", "outfile");
#endif
timer_off("WmbijT2");
#ifdef TIME_CCENERGY
timer_on("WabeiT2", "outfile");
#endif
timer_on("WabeiT2");
cc2_WabeiT2();
if (params_.print & 2) status("Wabei -> T2", "outfile");
#ifdef TIME_CCENERGY
timer_off("WabeiT2", "outfile");
#endif
timer_off("WabeiT2");
}
} // namespace ccenergy
} // namespace psi
@@ -100,10 +100,6 @@ double CCEnergyWavefunction::compute_energy() {
init_ioff();
title();
#ifdef TIME_CCENERGY
timer_on("CCEnergy");
#endif
get_moinfo();
get_params(options_);
@@ -218,16 +214,12 @@ double CCEnergyWavefunction::compute_energy() {
for (moinfo_.iter = 1; moinfo_.iter <= params_.maxiter; moinfo_.iter++) {
sort_amps();
#ifdef TIME_CCENERGY
timer_on("F build");
#endif
Fme_build();
Fae_build();
Fmi_build();
if (params_.print & 2) status("F intermediates", "outfile");
#ifdef TIME_CCENERGY
timer_off("F build");
#endif
t1_build();
if (params_.print & 2) status("T1 amplitudes", "outfile");
@@ -236,58 +228,35 @@ double CCEnergyWavefunction::compute_energy() {
cc2_Wmnij_build();
if (params_.print & 2) status("Wmnij", "outfile");
#ifdef TIME_CCENERGY
timer_on("Wmbij build");
#endif
cc2_Wmbij_build();
if (params_.print & 2) status("Wmbij", "outfile");
#ifdef TIME_CCENERGY
timer_off("Wmbij build");
#endif
#ifdef TIME_CCENERGY
timer_on("Wabei build");
#endif
cc2_Wabei_build();
if (params_.print & 2) status("Wabei", "outfile");
#ifdef TIME_CCENERGY
timer_off("Wabei build");
#endif
#ifdef TIME_CCENERGY
timer_on("T2 Build");
#endif
cc2_t2_build();
if (params_.print & 2) status("T2 amplitudes", "outfile");
#ifdef TIME_CCENERGY
timer_off("T2 Build");
#endif
}
else {
#ifdef TIME_CCENERGY
} else {
timer_on("Wmbej build");
#endif
Wmbej_build();
if (params_.print & 2) status("Wmbej", "outfile");
#ifdef TIME_CCENERGY
timer_off("Wmbej build");
#endif
Z_build();
if (params_.print & 2) status("Z", "outfile");
Wmnij_build();
if (params_.print & 2) status("Wmnij", "outfile");
#ifdef TIME_CCENERGY
timer_on("T2 Build");
#endif
t2_build();
if (params_.print & 2) status("T2 amplitudes", "outfile");
#ifdef TIME_CCENERGY
timer_off("T2 Build");
#endif
if (params_.wfn == "CC3" || params_.wfn == "EOM_CC3") {
/* step1: build cc3 intermediates, Wabei, Wmnie, Wmbij, Wamef */
@@ -352,9 +321,7 @@ double CCEnergyWavefunction::compute_energy() {
if (params_.aobasis != "NONE") dpd_close(1);
dpd_close(0);
cleanup();
#ifdef TIME_CCENERGY
timer_off("CCEnergy");
#endif
free(ioff_);
exit_io();
return Failure;
@@ -510,10 +477,6 @@ double CCEnergyWavefunction::compute_energy() {
cleanup();
#ifdef TIME_CCENERGY
timer_off("CCEnergy");
#endif
energy_ = moinfo_.ecc + moinfo_.eref;
name_ = "CCSD";
Process::environment.globals["CURRENT ENERGY"] = moinfo_.ecc + moinfo_.eref;
@@ -541,7 +504,7 @@ double CCEnergyWavefunction::compute_energy() {
void CCEnergyWavefunction::init_io() {
params_.just_energy = 0;
params_.just_residuals = 0;
tstart();
timer_on("CCEnergy");
for (int i = PSIF_CC_MIN; i <= PSIF_CC_MAX; i++) psio_open(i, 1);
}
@@ -558,7 +521,7 @@ void CCEnergyWavefunction::exit_io() {
for (i = PSIF_CC_MIN; i < PSIF_CC_TMP; i++) psio_close(i, 1);
for (i = PSIF_CC_TMP; i <= PSIF_CC_TMP11; i++) psio_close(i, 0); /* delete CC_TMP files */
for (i = PSIF_CC_TMP11 + 1; i <= PSIF_CC_MAX; i++) psio_close(i, 1);
tstop();
timer_off("CCEnergy");
}
void CCEnergyWavefunction::init_ioff() {
Oops, something went wrong.

0 comments on commit 57e3c42

Please sign in to comment.