From 600709a1216991a40a94d618071543ee8c9fef4a Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Fri, 28 Jul 2023 11:32:36 -0700 Subject: [PATCH] cc2 --- exachem/cc/cc2/cc2.cmake | 5 +- exachem/cc/cc2/cc2_canonical.cpp | 99 ++++++++++++++++++-------------- methods/ExaChem.cpp | 26 +++++++-- 3 files changed, 80 insertions(+), 50 deletions(-) diff --git a/exachem/cc/cc2/cc2.cmake b/exachem/cc/cc2/cc2.cmake index 5e61807..3b32fc5 100644 --- a/exachem/cc/cc2/cc2.cmake +++ b/exachem/cc/cc2/cc2.cmake @@ -3,6 +3,9 @@ include(TargetMacros) set(CC2_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../exachem/cc/cc2) set(CC2_SRCS - ${CC2_SRCDIR}/cc2_canonical.cpp + ${CC2_SRCDIR}/cd_cc2.cpp + ${CC2_SRCDIR}/cd_cc2_cs.cpp + ${CC2_SRCDIR}/cd_cc2_os.cpp + #${CC2_SRCDIR}/cc2_canonical.cpp ) diff --git a/exachem/cc/cc2/cc2_canonical.cpp b/exachem/cc/cc2/cc2_canonical.cpp index dba606b..91c3b4b 100644 --- a/exachem/cc/cc2/cc2_canonical.cpp +++ b/exachem/cc/cc2/cc2_canonical.cpp @@ -122,49 +122,60 @@ void cc2_t2(Scheduler& sch, const TiledIndexSpace& MO, Tensor& i0, const Tens // clang-format off sch.allocate(pp, hh, pphh, phhh, pphp, hphp, hphh, hhhh, hhhp) - (i0(a, b, i, j) = v2(a, b, i, j)) // V_(a, b, i, j) we follow notation - (pp(b, c) = f1(b, c)) // +p(a/b)[f(b, c)+f(k, c)*t1(b, k)]*t2(a, c, i, j) - (pp(b, c) += f1(k, c) * t1(b, k)) - (pphh(a, b, i, j) = pp(b, c) * t2(a, c, i, j)) - (i0(a, b, i, j) += pphh(a, b, i, j)) - (i0(a, b, i, j) += -1.0* pphh(b, a, i, j)) // p(a/b) - (hh(k, j) = f1(k, j)) // -p(i/j)[f(k, j)+ f(k, c)*t1(c, j)]*t2(a, b, i, k) - (hh(k, j) += f1(k, c) * t1(c, j)) - (pphh(a, b, i, j) = hh(k, j) * t2(a, b, i, k)) - (i0(a, b, i, j) += -1.0 * pphh(a, b, i, j)) - (i0(a, b, i, j) += pphh(a, b, j, i)) - (pphh(a, b, i, j) = v2(a, b, i, c) * t1(c, j)) - (i0(a, b, i, j) += pphh(a, b, i, j) ) // p(i/j)v2(a, b, i, c)*t1(c, j)) - (i0(a, b, i, j) += -1.0* pphh(a, b, j, i) ) - (pphh(a, b, i, j) = v2(a, k, i, j) * t1(b, k)) - (i0(a, b, i, j) += -1.0* pphh(a, b, i, j) ) // v2(a, k, i, j)&t1(b, k)) - (i0(a, b, i, j) += pphh(b, a, i, j) ) // p(a/b) - (phhh(a, l, i, j) = v2(k, l, i, j) * t1(a, k)) // v2(k, l, i, j)*t1(a, k)*t1(b, l) - (i0(a, b, i, j) += phhh(a, l, i, j) * t1(b, l)) - (pphp(a, b, i, d) = v2(a, b, c, d) * t1(c, i)) // v(a, b, c, d)*t1(c, i)*t1(d, j) - (i0(a, b, i, j) += pphp(a, b, i, d) * t1(d, j)) - (phhh(a, k, i, j) = v2(a, k, i, c) * t1(c, j)) // -p(ij/ab) v2(a, k, i, c)*t1(c, j)*t1(b, k) - (pphh(a, b, i, j) = phhh(a, k, i, j) * t1(b, k)) - (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) - (i0(a, b, i, j) += 1.0* pphh(a, b, j, i)) // p(ij) - (i0(a, b, i, j) += 1.0* pphh(b, a, i, j)) // p(ab) - (i0(a, b, i, j) += -1.0* pphh(b, a, j, i)) // p(ij/ab) - (hphp(k, a, j, d) = v2(k, a, c, d) * t1(c, j)) //-p(ij/ab)v2(k, a, c, d)*t1(c, j)*t1(b, k)*t1(d, i) - (hphh(k, a, j, i) = hphp(k, a, j, d) * t1(d, i)) - (pphh(a, b, i, j) = hphh(k, a, j, i) * t1(b, k)) - (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) - (i0(a, b, i, j) += 1.0* pphh(a, b, j, i)) - (i0(a, b, i, j) += 1.0* pphh(b, a, i, j)) - (i0(a, b, i, j) += -1.0* pphh(b, a, j, i)) - (hhhh(k, l, i, j) = v2(k, l, c, j) * t1(c, i)) // p(ij)v2(k, l, c, j)*t1(c, i)*t1(a, k)*t1(b, l) - (phhh(a, l, i, j) = hhhh(k, l, i, j) * t1(a, k)) - (pphh(a, b, i, j) = phhh(a, l, i, j) * t1(b, l)) - (i0(a, b, i, j) += pphh(a, b, i, j)) - (i0(a, b, i, j) += -1.0* pphh(a, b, j, i)) - (hhhp(k, l, i, d) = v2(k, l, c, d) * t1(c, i)) // v2(k, l, c, d)*t1(c, i)*t1(d, j)*t1(a, k)*t1(b, l) - (hhhh(k, l, i, j) = hhhp(k, l, i, d) * t1(d, j)) - (phhh(a, l, i, j) = hhhh(k, l, i, j) * t1(a, k)) - (i0(a, b, i, j) += phhh(a, l, i, j) * t1(b, l)) + // V_(a, b, i, j) we follow notation + (i0(a, b, i, j) = v2(a, b, i, j)) + (pphh(a, b, i, j) = f1(b, c) * t2(a, c, i, j)) + // +p(a/b)[f(b, c)+f(k, c)*t1(b, k)]*t2(a, c, i, j) + (i0(a, b, i, j) += pphh(a, b, i, j)) + (i0(a, b, i, j) +=-1.0* pphh(b, a, i, j)) + (pp(b, c) = f1(k, c) * t1(b, k)) + (pphh(a, b, i, j) = pp(b, c) * t2(a, c, i, j)) + (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) + (i0(a, b, i, j) += 1.0* pphh(b, a, i, j)) // p(a/b) + (pphh(a, b, i, j) = f1(k, j) * t2(a, b, i, k)) + (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) + // -p(i/j)[f(k, j)+ f(k, c)*t1(c, j)]*t2(a, b, i, k) + (i0(a, b, i, j) += 1.0* pphh(a, b, j, i)) + (hh(k, j) = f1(k, c) * t1(c, j)) + (pphh(a, b, i, j) = hh(k, j) * t2(a, b, i, k)) + (i0(a, b, i, j) += -1.0 * pphh(a, b, i, j)) + (i0(a, b, i, j) += pphh(a, b, j, i)) + (pphh(a, b, i, j) = v2(a, b, i, c) * t1(c, j)) + (i0(a, b, i, j) += pphh(a, b, i, j) ) // p(i/j)v2(a, b, i, c)*t1(c, j)) + (i0(a, b, i, j) += -1.0* pphh(a, b, j, i) ) + (pphh(a, b, i, j) = v2(a, k, i, j) * t1(b, k)) + (i0(a, b, i, j) += -1.0* pphh(a, b, i, j) ) // v2(a, k, i, j)&t1(b, k)) + (i0(a, b, i, j) += pphh(b, a, i, j) ) // p(a/b) + (phhh(a, l, i, j) = v2(k, l, i, j) * t1(a, k)) // v2(k, l, i, j)*t1(a, k)*t1(b, l) + (i0(a, b, i, j) += phhh(a, l, i, j) * t1(b, l)) + (pphp(a, b, i, d) = v2(a, b, c, d) * t1(c, i)) + // v(a, b, c, d)*t1(c, i)*t1(d, j) + (pphh(a, b, i, j) = pphp(a, b, i, d) * t1(d, j)) + (i0(a, b, i, j) += pphh(a, b, i, j)) + // -p(ij/ab) v2(a, k, i, c)*t1(c, j)*t1(b, k) + (phhh(a, k, i, j) = v2(a, k, i, c) * t1(c, j)) + (pphh(a, b, i, j) = phhh(a, k, i, j) * t1(b, k)) + (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) + (i0(a, b, i, j) += 1.0* pphh(a, b, j, i)) // p(ij) + (i0(a, b, i, j) += 1.0* pphh(b, a, i, j)) // p(ab) + (i0(a, b, i, j) += -1.0* pphh(b, a, j, i)) // p(ij/ab) + //-p(ab)v2(k, a, c, d)*t1(c, j)*t1(b, k)*t1(d, i) + (hphp(k, a, j, d) = v2(k, a, c, d) * t1(c, j)) + (hphh(k, a, j, i) = hphp(k, a, j, d) * t1(d, i)) + (pphh(a, b, i, j) = hphh(k, a, j, i) * t1(b, k)) + (i0(a, b, i, j) += -1.0* pphh(a, b, i, j)) + (i0(a, b, i, j) += 1.0* pphh(b, a, i, j)) + // p(ij)v2(k, l, c, j)*t1(c, i)*t1(a, k)*t1(b, l) + (hhhh(k, l, i, j) = v2(k, l, c, j) * t1(c, i)) + (phhh(a, l, i, j) = hhhh(k, l, i, j) * t1(a, k)) + (pphh(a, b, i, j) = phhh(a, l, i, j) * t1(b, l)) + (i0(a, b, i, j) += pphh(a, b, i, j)) + (i0(a, b, i, j) += -1.0* pphh(a, b, j, i)) + // v2(k, l, c, d)*t1(c, i)*t1(d, j)*t1(a, k)*t1(b, l) + (hhhp(k, l, i, d) = v2(k, l, c, d) * t1(c, i)) + (hhhh(k, l, i, j) = hhhp(k, l, i, d) * t1(d, j)) + (phhh(a, l, i, j) = hhhh(k, l, i, j) * t1(a, k)) + (i0(a, b, i, j) += phhh(a, l, i, j) * t1(b, l)) .deallocate(pp, hh, pphh, phhh, pphp, hphp, hphh, hhhh, hhhp); // sch.execute(); // clang-format on @@ -294,7 +305,7 @@ void cc2_canonical_driver(std::string filename, OptionsMap options_map) { AO_tis, scf_conv] = hartree_fock_driver(ec, filename, options_map); CCSDOptions& ccsd_options = sys_data.options_map.ccsd_options; - bool debug = ccsd_options.debug; + auto debug = ccsd_options.debug; if(rank == 0) ccsd_options.print(); if(rank == 0) diff --git a/methods/ExaChem.cpp b/methods/ExaChem.cpp index a9a6685..228a7e9 100644 --- a/methods/ExaChem.cpp +++ b/methods/ExaChem.cpp @@ -19,7 +19,7 @@ void rt_eom_cd_ccsd_driver(std::string filename, OptionsMap options_map); #include "exachem/fci/fci.hpp" #endif -void cc2_canonical_driver(std::string filename, OptionsMap options_map); +void cd_cc2_driver(std::string filename, OptionsMap options_map); void ducc_driver(std::string filename, OptionsMap options_map); int main(int argc, char* argv[]) { @@ -27,7 +27,7 @@ int main(int argc, char* argv[]) { if(argc < 2) tamm_terminate("Please provide an input file!"); - std::string filename = std::string(argv[1]); + std::string filename = fs::canonical(std::string(argv[1])); std::ifstream testinput(filename); if(!testinput) tamm_terminate("Input file provided [" + filename + "] does not exist!"); @@ -35,8 +35,9 @@ int main(int argc, char* argv[]) { auto current_time_t = std::chrono::system_clock::to_time_t(current_time); auto cur_local_time = localtime(¤t_time_t); - const auto rank = ProcGroup::world_rank(); - if(rank == 0) cout << endl << "Date: " << std::put_time(cur_local_time, "%c") << endl << endl; + const auto rank = ProcGroup::world_rank(); + ProcGroup pg = ProcGroup::create_world_coll(); + ExecutionContext ec{pg, DistributionKind::nw, MemoryManagerKind::ga}; // read geometry from a json file json jinput; @@ -48,6 +49,20 @@ int main(int argc, char* argv[]) { if(options_map.options.output_file_prefix.empty()) options_map.options.output_file_prefix = getfilename(filename); + if(rank == 0) { + // TODO: tamm,ga,exachem git tags + cout << endl << "date: " << std::put_time(cur_local_time, "%c") << endl; + cout << "program: " << fs::canonical(argv[0]) << endl; + cout << "input: " << filename << endl; + cout << "nnodes: " << ec.nnodes() << ", "; + cout << "nproc: " << ec.nnodes() * ec.ppn() << endl; + cout << "prefix: " << options_map.options.output_file_prefix << endl << endl; + ec.print_mem_info(); + cout << endl << endl; + cout << "Input file provided" << endl << std::string(20, '-') << endl; + std::cout << jinput.dump(2) << std::endl; + } + // if(rank == 0) { // std::ofstream res_file(getfilename(filename)+".json"); // res_file << std::setw(2) << jinput << std::endl; @@ -65,6 +80,7 @@ int main(int argc, char* argv[]) { task.ccsd_lambda, task.eom_ccsd, task.fcidump, + task.rteom_cc2, task.rteom_ccsd, task.gfccsd, task.dlpno_ccsd.first, @@ -88,7 +104,7 @@ int main(int argc, char* argv[]) { else if(task.cd_2e) cd_2e_driver(filename, options_map); else if(task.ccsd) cd_ccsd(filename, options_map); else if(task.ccsd_t) ccsd_t_driver(filename, options_map); - else if(task.cc2) cc2_canonical_driver(filename, options_map); + else if(task.cc2) cd_cc2_driver(filename, options_map); else if(task.ccsd_lambda) ccsd_lambda_driver(filename, options_map); else if(task.eom_ccsd) eom_ccsd_driver(filename, options_map); else if(task.ducc) ducc_driver(filename, options_map);