From 3553cba609c8c67b8f7f9bd386018b158495d099 Mon Sep 17 00:00:00 2001 From: Ajay Panyala Date: Mon, 8 Jul 2024 21:41:27 -0700 Subject: [PATCH] initial attempt to use scf as a library --- CMakeLists.txt | 2 +- exachem/CMakeLists.txt | 2 +- exachem/cc/ccsd/ccsd_util.hpp | 65 ++++- exachem/cc/ccsd_t/memory.cpp | 234 ------------------ exachem/cc/lambda/ccsd_lambda.hpp | 2 +- exachem/cc/lambda/ccsd_lambda_driver.cpp | 4 +- exachem/cholesky/cholesky_2e.hpp | 8 +- exachem/cholesky/cholesky_2e_driver.hpp | 2 +- exachem/cholesky/two_index_transform.hpp | 2 +- exachem/common/atom_info.hpp | 2 +- exachem/common/chemenv.cpp | 9 +- exachem/common/chemenv.hpp | 8 +- exachem/common/common.cmake | 7 +- exachem/common/cutils.cpp | 5 +- exachem/common/cutils.hpp | 7 +- exachem/common/ec_basis.cpp | 2 +- exachem/common/ec_basis.hpp | 2 +- exachem/common/ec_dplot.hpp | 2 +- exachem/common/ec_molden.cpp | 4 +- exachem/common/ec_molden.hpp | 6 +- exachem/common/ecatom.cpp | 3 +- exachem/common/ecatom.hpp | 6 +- exachem/common/fcidump.cpp | 2 +- exachem/common/fcidump.hpp | 3 +- exachem/common/initialize_system_data.cpp | 2 +- exachem/common/initialize_system_data.hpp | 4 +- exachem/common/options/input_options.hpp | 4 +- exachem/common/options/parse_ccsd_options.hpp | 8 +- exachem/common/options/parse_cd_options.hpp | 8 +- .../common/options/parse_common_options.hpp | 4 +- exachem/common/options/parse_fci_options.hpp | 8 +- exachem/common/options/parse_gw_options.hpp | 8 +- exachem/common/options/parse_options.hpp | 4 +- exachem/common/options/parse_scf_options.hpp | 6 +- exachem/common/options/parse_task_options.hpp | 8 +- exachem/common/options/parser_utils.hpp | 8 +- exachem/common/system_data.cpp | 2 +- exachem/common/system_data.hpp | 2 +- exachem/common/txt_utils.cpp | 2 +- exachem/fci/fci.hpp | 2 +- exachem/scf/scf.cmake | 8 +- exachem/scf/scf_common.cpp | 2 +- exachem/scf/scf_common.hpp | 10 +- exachem/scf/scf_compute.cpp | 2 +- exachem/scf/scf_compute.hpp | 8 +- exachem/scf/scf_gauxc.cpp | 2 +- exachem/scf/scf_gauxc.hpp | 12 +- exachem/scf/scf_guess.cpp | 2 +- exachem/scf/scf_guess.hpp | 4 +- exachem/scf/scf_hartree_fock.cpp | 15 +- exachem/scf/scf_hartree_fock.hpp | 18 +- exachem/scf/scf_iter.cpp | 2 +- exachem/scf/scf_iter.hpp | 6 +- exachem/scf/scf_main.cpp | 10 +- exachem/scf/scf_main.hpp | 4 +- exachem/scf/scf_matrix.cpp | 2 +- exachem/scf/scf_matrix.hpp | 2 +- exachem/scf/scf_outputs.cpp | 6 +- exachem/scf/scf_outputs.hpp | 15 +- exachem/scf/scf_restart.cpp | 4 +- exachem/scf/scf_restart.hpp | 11 +- exachem/scf/scf_taskmap.cpp | 2 +- exachem/scf/scf_vars.hpp | 2 +- inputs/scripts/xyz_to_exachem.py | 9 +- methods/CMakeLists.txt | 30 ++- methods/ExaChem.cpp | 11 +- 66 files changed, 257 insertions(+), 411 deletions(-) delete mode 100644 exachem/cc/ccsd_t/memory.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae623f..2e77278 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ set(BUILD_TESTS OFF) if(DEFINED MODULES AND (NOT "${MODULES}" STREQUAL "")) list(TRANSFORM MODULES TOUPPER) else() - set(MODULES "CC") + message(FATAL_ERROR "Modules not specified") endif() message(STATUS "MODULES TO BE BUILT = ${MODULES}") diff --git a/exachem/CMakeLists.txt b/exachem/CMakeLists.txt index 3216606..646833f 100644 --- a/exachem/CMakeLists.txt +++ b/exachem/CMakeLists.txt @@ -7,7 +7,7 @@ set(EXACHEM_LFLAGS ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -# include(${CMAKE_CURRENT_SOURCE_DIR}/scf/scf.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/scf/scf.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/common/common.cmake) # include(${CMAKE_CURRENT_SOURCE_DIR}/mp2/mp2.cmake) # include(${CMAKE_CURRENT_SOURCE_DIR}/cc/cd.cmake) diff --git a/exachem/cc/ccsd/ccsd_util.hpp b/exachem/cc/ccsd/ccsd_util.hpp index fcfa45f..ecc7c22 100644 --- a/exachem/cc/ccsd/ccsd_util.hpp +++ b/exachem/cc/ccsd/ccsd_util.hpp @@ -10,7 +10,7 @@ // clang-format off #include "cc/ccse_tensors.hpp" #include "cc/diis.hpp" -#include "scf/scf_main.hpp" +#include "exachem/scf/scf_main.hpp" #include "cholesky/cholesky_2e_driver.hpp" // clang-format on @@ -67,3 +67,66 @@ void ccsd_stats(ExecutionContext& ec, double hf_energy, double residual, double template void cc_print(ChemEnv& chem_env, Tensor d_t1, Tensor d_t2, std::string files_prefix); + +template +struct V2Tensors_SE { + CCSE_Tensors v2ijab; + CCSE_Tensors v2iajb; + CCSE_Tensors v2ijka; + CCSE_Tensors v2ijkl; + CCSE_Tensors v2iabc; + CCSE_Tensors v2abcd; + + void allocate(Scheduler& sch, const TiledIndexSpace& MO) { + const TiledIndexSpace& O = MO("occ"); + const TiledIndexSpace& V = MO("virt"); + v2ijab = CCSE_Tensors{MO, {O, O, V, V}, "ijab", {"aaaa", "abab", "bbbb"}}; + v2iajb = CCSE_Tensors{MO, {O, V, O, V}, "iajb", {"aaaa", "abab", "bbbb"}}; + v2ijka = CCSE_Tensors{MO, {O, O, O, V}, "ijka", {"aaaa", "abab", "bbbb"}}; + v2ijkl = CCSE_Tensors{MO, {O, O, O, O}, "ijkl", {"aaaa", "abab", "bbbb"}}; + v2iabc = CCSE_Tensors{MO, {O, V, V, V}, "iabc", {"aaaa", "abab", "bbbb"}}; + v2abcd = CCSE_Tensors{MO, {V, V, V, V}, "abcd", {"aaaa", "abab", "bbbb"}}; + CCSE_Tensors::allocate_list(sch, v2ijab, v2iajb, v2ijka, v2ijkl, v2iabc, v2abcd); + } + + void init(Scheduler& sch, const TiledIndexSpace& MO, + exachem::cholesky_2e::V2Tensors& v2tensors) { + auto [p1_va, p2_va, p3_va, p4_va] = MO.labels<4>("virt_alpha"); + auto [p1_vb, p2_vb, p3_vb, p4_vb] = MO.labels<4>("virt_beta"); + auto [h1_oa, h2_oa, h3_oa, h4_oa] = MO.labels<4>("occ_alpha"); + auto [h1_ob, h2_ob, h3_ob, h4_ob] = MO.labels<4>("occ_beta"); + + // clang-format off + sch( v2ijab("aaaa")(h1_oa,h2_oa,p1_va,p2_va) = 1.0 * v2tensors.v2ijab(h1_oa,h2_oa,p1_va,p2_va) ) + ( v2ijab("abab")(h1_oa,h2_ob,p1_va,p2_vb) = 1.0 * v2tensors.v2ijab(h1_oa,h2_ob,p1_va,p2_vb) ) + ( v2ijab("bbbb")(h1_ob,h2_ob,p1_vb,p2_vb) = 1.0 * v2tensors.v2ijab(h1_ob,h2_ob,p1_vb,p2_vb) ); + + sch( v2iajb("aaaa")(h1_oa,p1_va,h2_oa,p2_va) = 1.0 * v2tensors.v2iajb(h1_oa,p1_va,h2_oa,p2_va) ) + ( v2iajb("abab")(h1_oa,p1_vb,h2_oa,p2_vb) = 1.0 * v2tensors.v2iajb(h1_oa,p1_vb,h2_oa,p2_vb) ) + ( v2iajb("bbbb")(h1_ob,p1_vb,h2_ob,p2_vb) = 1.0 * v2tensors.v2iajb(h1_ob,p1_vb,h2_ob,p2_vb) ); + + sch( v2ijka("aaaa")(h1_oa,h2_oa,h3_oa,p1_va) = 1.0 * v2tensors.v2ijka(h1_oa,h2_oa,h3_oa,p1_va) ) + ( v2ijka("abab")(h1_oa,h2_ob,h3_oa,p1_vb) = 1.0 * v2tensors.v2ijka(h1_oa,h2_ob,h3_oa,p1_vb) ) + ( v2ijka("bbbb")(h1_ob,h2_ob,h3_ob,p1_vb) = 1.0 * v2tensors.v2ijka(h1_ob,h2_ob,h3_ob,p1_vb) ); + + sch( v2ijkl("aaaa")(h1_oa,h2_oa,h3_oa,h4_oa) = 1.0 * v2tensors.v2ijkl(h1_oa,h2_oa,h3_oa,h4_oa) ) + ( v2ijkl("abab")(h1_oa,h2_ob,h3_oa,h4_ob) = 1.0 * v2tensors.v2ijkl(h1_oa,h2_ob,h3_oa,h4_ob) ) + ( v2ijkl("bbbb")(h1_ob,h2_ob,h3_ob,h4_ob) = 1.0 * v2tensors.v2ijkl(h1_ob,h2_ob,h3_ob,h4_ob) ); + + sch( v2iabc("aaaa")(h1_oa,p2_va,p3_va,p4_va) = 1.0 * v2tensors.v2iabc(h1_oa,p2_va,p3_va,p4_va) ) + ( v2iabc("abab")(h1_oa,p2_vb,p3_va,p4_vb) = 1.0 * v2tensors.v2iabc(h1_oa,p2_vb,p3_va,p4_vb) ) + ( v2iabc("bbbb")(h1_ob,p2_vb,p3_vb,p4_vb) = 1.0 * v2tensors.v2iabc(h1_ob,p2_vb,p3_vb,p4_vb) ); + + sch( v2abcd("aaaa")(p1_va,p2_va,p3_va,p4_va) = 1.0 * v2tensors.v2abcd(p1_va,p2_va,p3_va,p4_va) ) + ( v2abcd("abab")(p1_va,p2_vb,p3_va,p4_vb) = 1.0 * v2tensors.v2abcd(p1_va,p2_vb,p3_va,p4_vb) ) + ( v2abcd("bbbb")(p1_vb,p2_vb,p3_vb,p4_vb) = 1.0 * v2tensors.v2abcd(p1_vb,p2_vb,p3_vb,p4_vb) ); + + // clang-format on + + sch.execute(); + } + + void deallocate(Scheduler& sch) { + CCSE_Tensors::deallocate_list(sch, v2ijab, v2iajb, v2ijka, v2ijkl, v2iabc, v2abcd); + } +}; diff --git a/exachem/cc/ccsd_t/memory.cpp b/exachem/cc/ccsd_t/memory.cpp deleted file mode 100644 index 19b12ab..0000000 --- a/exachem/cc/ccsd_t/memory.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * ExaChem: Open Source Exascale Computational Chemistry Software. - * - * Copyright 2023 NWChemEx-Project. - * Copyright 2023-2024 Pacific Northwest National Laboratory, Battelle Memorial Institute. - * - * See LICENSE.txt for details - */ - -#include "ccsd_t_common.hpp" -#include -#include -#include -using namespace std; - -static map> free_list_gpu, free_list_host; -static map live_ptrs_gpu, live_ptrs_host; - -static void clearGpuFreeList() { - for(map>::iterator it = free_list_gpu.begin(); it != free_list_gpu.end(); - ++it) { - for(set::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { -#if defined(USE_CUDA) - CUDA_SAFE(cudaFree(*it2)); -#elif defined(USE_HIP) - HIP_SAFE(hipFree(*it2)); -#elif defined(USE_DPCPP) - sycl::free(*it2, tamm::GPUStreamPool::getInstance().getStream().first); -#endif - } - } - free_list_gpu.clear(); -} - -static void clearHostFreeList() { - for(map>::iterator it = free_list_host.begin(); it != free_list_host.end(); - ++it) { - for(set::iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) { -#if defined(USE_CUDA) - CUDA_SAFE(cudaFreeHost(*it2)); -#elif defined(USE_HIP) - HIP_SAFE(hipHostFree(*it2)); -#elif defined(USE_DPCPP) - sycl::free(*it2, tamm::GPUStreamPool::getInstance().getStream().first); -#else - free(*it2); -#endif - } - } - free_list_host.clear(); -} - -static size_t num_resurrections = 0; // num_morecore=0; - -static void* moreDeviceMem(size_t bytes) { - void* ptr = nullptr; - -#if defined(USE_CUDA) - CUDA_SAFE(cudaMalloc(&ptr, bytes)); -#elif defined(USE_HIP) - HIP_SAFE(hipMalloc(&ptr, bytes)); -#elif defined(USE_DPCPP) - ptr = sycl::malloc_device(bytes, tamm::GPUStreamPool::getInstance().getStream().first); -#endif - - assert(ptr != nullptr); /*We hopefully have a pointer*/ - return ptr; -} - -static void* moreHostMem(size_t bytes) { - void* ptr = nullptr; - -#if defined(USE_CUDA) - CUDA_SAFE(cudaMallocHost(&ptr, bytes)); -#elif defined(USE_HIP) - HIP_SAFE(hipHostMalloc(&ptr, bytes)); -#elif defined(USE_DPCPP) - ptr = sycl::malloc_host(bytes, tamm::GPUStreamPool::getInstance().getStream().first); -#else - ptr = (void*) std::malloc(bytes); -#endif - - assert(ptr != nullptr); /*We hopefully have a pointer*/ - return ptr; -} - -static inline void* resurrect_from_free_list(map>& free_map, size_t bytes, - map& liveset) { - void* ptr = nullptr; - num_resurrections += 1; - assert(free_map.find(bytes) != free_map.end()); - /* assert(free_map.find(bytes)->second.size() > 0); */ - set& st = free_map.find(bytes)->second; - ptr = *st.begin(); - st.erase(ptr); - if(st.size() == 0) free_map.erase(bytes); - liveset[ptr] = bytes; - - return ptr; -} - -void* getGpuMem(size_t bytes) { - void* ptr = nullptr; - -#ifdef NO_OPT - -#if defined(USE_CUDA) - CUDA_SAFE(cudaMalloc((void**) &ptr, bytes)); -#elif defined(USE_HIP) - HIP_SAFE(hipMalloc((void**) &ptr, bytes)); -#elif defined(USE_DPCPP) - ptr = sycl::malloc_device(bytes, tamm::GPUStreamPool::getInstance().getStream().first); -#endif - -#else - if(free_list_gpu.find(bytes) != free_list_gpu.end()) { - set& lst = free_list_gpu.find(bytes)->second; - if(lst.size() != 0) { - ptr = resurrect_from_free_list(free_list_gpu, bytes, live_ptrs_gpu); - return ptr; - } - } - else { - for(map>::iterator it = free_list_gpu.begin(); it != free_list_gpu.end(); - ++it) { - if(it->first >= bytes && it->second.size() > 0) { - ptr = resurrect_from_free_list(free_list_gpu, it->first, live_ptrs_gpu); - return ptr; - } - } - } - - ptr = moreDeviceMem(bytes); - live_ptrs_gpu[ptr] = bytes; -#endif // NO_OPT - - return ptr; -} - -void* getPinnedMem(size_t bytes) { - void* ptr = nullptr; - -#if defined(USE_CUDA) - CUDA_SAFE(cudaMallocHost((void**) &ptr, bytes)); -#elif defined(USE_HIP) - HIP_SAFE(hipMallocHost((void**) &ptr, bytes)); -#elif defined(USE_DPCPP) - ptr = sycl::malloc_host(bytes, tamm::GPUStreamPool::getInstance().getStream().first); -#endif - return ptr; -} - -void freePinnedMem(void* ptr) { -#if defined(USE_CUDA) - CUDA_SAFE(cudaFreeHost(ptr)); -#elif defined(USE_HIP) - HIP_SAFE(hipFreeHost(ptr)); -#elif defined(USE_DPCPP) - sycl::free(ptr, tamm::GPUStreamPool::getInstance().getStream().first); -#endif -} - -void* getHostMem(size_t bytes) { - void* ptr = nullptr; - -#ifdef NO_OPT - ptr = std::malloc(bytes); -#else // NO_OPT - if(free_list_host.find(bytes) != free_list_host.end()) { - set& lst = free_list_host.find(bytes)->second; - if(lst.size() != 0) { - ptr = resurrect_from_free_list(free_list_host, bytes, live_ptrs_host); - return ptr; - } - } - else { - for(map>::iterator it = free_list_host.begin(); it != free_list_host.end(); - ++it) { - if(it->first >= bytes && it->second.size() > 0) { - ptr = resurrect_from_free_list(free_list_host, it->first, live_ptrs_host); - return ptr; - } - } - } - - ptr = moreHostMem(bytes); - live_ptrs_host[ptr] = bytes; -#endif // NO_OPT - return ptr; -} - -void freeHostMem(void* p) { -#ifdef NO_OPT - std::free(p); -#else // NO_OPT - size_t bytes; - assert(live_ptrs_host.find(p) != live_ptrs_host.end()); - bytes = live_ptrs_host[p]; - live_ptrs_host.erase(p); - free_list_host[bytes].insert(p); -#endif // NO_OPT -} - -void freeGpuMem(void* p) { -#ifdef NO_OPT - -#if defined(USE_CUDA) - CUDA_SAFE(cudaFree(p)); -#elif defined(USE_HIP) - HIP_SAFE(hipFree(p)); -#elif defined(USE_DPCPP) - sycl::free(p, tamm::GPUStreamPool::getInstance().getStream().first); -#endif // NO_OPT - -#else - - size_t bytes; - assert(live_ptrs_gpu.find(p) != live_ptrs_gpu.end()); - bytes = live_ptrs_gpu[p]; - live_ptrs_gpu.erase(p); - free_list_gpu[bytes].insert(p); - -#endif -} - -void finalizememmodule() { - /*there should be no live pointers*/ - assert(live_ptrs_gpu.size() == 0); - assert(live_ptrs_host.size() == 0); - - /*release all freed pointers*/ - clearGpuFreeList(); - clearHostFreeList(); -} diff --git a/exachem/cc/lambda/ccsd_lambda.hpp b/exachem/cc/lambda/ccsd_lambda.hpp index 2010c8c..9b8dea5 100644 --- a/exachem/cc/lambda/ccsd_lambda.hpp +++ b/exachem/cc/lambda/ccsd_lambda.hpp @@ -9,7 +9,7 @@ #pragma once #include "cc/ccsd/cd_ccsd_os_ann.hpp" -#include "scf/scf_main.hpp" +#include "exachem/scf/scf_main.hpp" using namespace tamm; diff --git a/exachem/cc/lambda/ccsd_lambda_driver.cpp b/exachem/cc/lambda/ccsd_lambda_driver.cpp index 6089792..2ff2890 100644 --- a/exachem/cc/lambda/ccsd_lambda_driver.cpp +++ b/exachem/cc/lambda/ccsd_lambda_driver.cpp @@ -6,8 +6,8 @@ * See LICENSE.txt for details */ #include "ccsd_lambda.hpp" -#include "common/termcolor.hpp" -#include "scf/scf_guess.hpp" +#include "exachem/common/termcolor.hpp" +#include "exachem/scf/scf_guess.hpp" #include namespace fs = std::filesystem; diff --git a/exachem/cholesky/cholesky_2e.hpp b/exachem/cholesky/cholesky_2e.hpp index 38b76e0..6c67427 100644 --- a/exachem/cholesky/cholesky_2e.hpp +++ b/exachem/cholesky/cholesky_2e.hpp @@ -10,9 +10,9 @@ #pragma once #include "cholesky/cholesky_2e_driver.hpp" -#include "common/ec_basis.hpp" -#include "common/system_data.hpp" -#include "scf/scf_compute.hpp" +#include "exachem/common/ec_basis.hpp" +#include "exachem/common/system_data.hpp" +#include "exachem/scf/scf_compute.hpp" #include "tamm/eigen_utils.hpp" #if defined(USE_UPCXX) #include "tamm/ga_over_upcxx.hpp" @@ -38,4 +38,4 @@ Tensor cholesky_2e(ChemEnv& chem_env, ExecutionContext& ec, TiledInd TiledIndexSpace& tAO, TAMM_SIZE& chol_count, const TAMM_GA_SIZE max_cvecs, libint2::BasisSet& shells, Tensor& lcao, bool is_mso = true); -} // namespace exachem::cholesky_2e \ No newline at end of file +} // namespace exachem::cholesky_2e diff --git a/exachem/cholesky/cholesky_2e_driver.hpp b/exachem/cholesky/cholesky_2e_driver.hpp index 2b75401..90ad3c8 100644 --- a/exachem/cholesky/cholesky_2e_driver.hpp +++ b/exachem/cholesky/cholesky_2e_driver.hpp @@ -11,7 +11,7 @@ #include "cc/ccse_tensors.hpp" #include "cc/diis.hpp" #include "cholesky/v2tensors.hpp" -#include "scf/scf_main.hpp" +#include "exachem/scf/scf_main.hpp" namespace exachem::cholesky_2e { diff --git a/exachem/cholesky/two_index_transform.hpp b/exachem/cholesky/two_index_transform.hpp index 2ac57f2..8767438 100644 --- a/exachem/cholesky/two_index_transform.hpp +++ b/exachem/cholesky/two_index_transform.hpp @@ -8,7 +8,7 @@ #pragma once -#include "scf/scf_outputs.hpp" +#include "exachem/scf/scf_outputs.hpp" #include "tamm/eigen_utils.hpp" using namespace tamm; using TAMM_GA_SIZE = int64_t; diff --git a/exachem/common/atom_info.hpp b/exachem/common/atom_info.hpp index fdf0b71..b9bec2c 100644 --- a/exachem/common/atom_info.hpp +++ b/exachem/common/atom_info.hpp @@ -7,7 +7,7 @@ */ #pragma once -#include "libint2_includes.hpp" +#include "exachem/common/libint2_includes.hpp" class AtomInfo { public: size_t nbf; diff --git a/exachem/common/chemenv.cpp b/exachem/common/chemenv.cpp index 443e51b..07ee414 100644 --- a/exachem/common/chemenv.cpp +++ b/exachem/common/chemenv.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "chemenv.hpp" +#include "exachem/common/chemenv.hpp" int ChemEnv::get_nfcore() { if(ioptions.ccsd_options.freeze_atomic) { @@ -255,7 +255,12 @@ void ChemEnv::sinfo() { nelectrons -= charge; // sys_data.nelectrons = nelectrons; - EXPECTS((nelectrons + scf_options.multiplicity - 1) % 2 == 0); + if((nelectrons + scf_options.multiplicity - 1) % 2 != 0) { + std::string err_msg = "[ERROR] Number of electrons (" + std::to_string(nelectrons) + ") " + + "and multiplicity (" + std::to_string(scf_options.multiplicity) + ") " + + " not compatible!"; + tamm_terminate(err_msg); + } int nelectrons_alpha = (nelectrons + scf_options.multiplicity - 1) / 2; int nelectrons_beta = nelectrons - nelectrons_alpha; diff --git a/exachem/common/chemenv.hpp b/exachem/common/chemenv.hpp index 1783a8f..94142d5 100644 --- a/exachem/common/chemenv.hpp +++ b/exachem/common/chemenv.hpp @@ -7,13 +7,13 @@ */ #pragma once -#include "common/ec_basis.hpp" -#include "common/system_data.hpp" -#include "ecatom.hpp" +#include "exachem/common/ec_basis.hpp" +#include "exachem/common/ecatom.hpp" +#include "exachem/common/system_data.hpp" #include "options/input_options.hpp" // #include "libint2_includes.hpp" +#include "exachem/common/txt_utils.hpp" #include "tamm/tamm.hpp" -#include "txt_utils.hpp" #include using json = nlohmann::ordered_json; diff --git a/exachem/common/common.cmake b/exachem/common/common.cmake index 18c9fc6..74f7e66 100644 --- a/exachem/common/common.cmake +++ b/exachem/common/common.cmake @@ -6,10 +6,14 @@ set(COMMON_INCLUDES ${COMMON_SRCDIR}/cutils.hpp ${COMMON_SRCDIR}/ecatom.hpp ${COMMON_SRCDIR}/fcidump.hpp - ${COMMON_SRCDIR}/txt_utils.hpp + ${COMMON_SRCDIR}/atom_info.hpp + ${COMMON_SRCDIR}/txt_utils.hpp ${COMMON_SRCDIR}/system_data.hpp ${COMMON_SRCDIR}/chemenv.hpp ${COMMON_SRCDIR}/ec_basis.hpp + ${COMMON_SRCDIR}/ec_dplot.hpp + ${COMMON_SRCDIR}/ec_molden.hpp + ${COMMON_SRCDIR}/libint2_includes.hpp ${COMMON_SRCDIR}/options/parse_options.hpp ${COMMON_SRCDIR}/options/parse_common_options.hpp ${COMMON_SRCDIR}/options/parse_scf_options.hpp @@ -20,7 +24,6 @@ set(COMMON_INCLUDES ${COMMON_SRCDIR}/options/parse_task_options.hpp ${COMMON_SRCDIR}/options/input_options.hpp ${COMMON_SRCDIR}/initialize_system_data.hpp - ${COMMON_SRCDIR}/ec_molden.hpp ) set(COMMON_SRCS diff --git a/exachem/common/cutils.cpp b/exachem/common/cutils.cpp index db2d823..c703155 100644 --- a/exachem/common/cutils.cpp +++ b/exachem/common/cutils.cpp @@ -6,10 +6,7 @@ * See LICENSE.txt for details */ -// clang-format off -#include "chemenv.hpp" -#include "cutils.hpp" -// clang-format on +#include "exachem/common/cutils.hpp" #if defined(USE_SCALAPACK) diff --git a/exachem/common/cutils.hpp b/exachem/common/cutils.hpp index 76edfb0..16285c7 100644 --- a/exachem/common/cutils.hpp +++ b/exachem/common/cutils.hpp @@ -8,8 +8,11 @@ #pragma once -#include "common/system_data.hpp" +// clang-format off +#include "exachem/common/chemenv.hpp" +#include "exachem/common/system_data.hpp" #include "options/input_options.hpp" +// clang-format on using namespace tamm; #if defined(USE_SCALAPACK) @@ -84,4 +87,4 @@ struct ProcGroupData { // Nbf, % of nodes, % of Nbf, nnodes from input file, (% of nodes, % of nbf) for scalapack ProcGroupData get_spg_data(ExecutionContext& ec, const size_t N, const int node_p, const int nbf_p = -1, const int node_inp = -1, const int node_p_sca = -1, - const int nbf_p_sca = -1); \ No newline at end of file + const int nbf_p_sca = -1); diff --git a/exachem/common/ec_basis.cpp b/exachem/common/ec_basis.cpp index 9b1c1ff..e4593e1 100644 --- a/exachem/common/ec_basis.cpp +++ b/exachem/common/ec_basis.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "ec_basis.hpp" +#include "exachem/common/ec_basis.hpp" namespace fs = std::filesystem; void ECBasis::ecp_check(ExecutionContext& exc, std::string basisfile, std::vector& atoms, diff --git a/exachem/common/ec_basis.hpp b/exachem/common/ec_basis.hpp index 2ef0a23..30c0509 100644 --- a/exachem/common/ec_basis.hpp +++ b/exachem/common/ec_basis.hpp @@ -7,7 +7,7 @@ */ #pragma once -#include "common/ecatom.hpp" +#include "exachem/common/ecatom.hpp" using lib_basis_set = libint2::BasisSet; using lib_shell = libint2::Shell; diff --git a/exachem/common/ec_dplot.hpp b/exachem/common/ec_dplot.hpp index 10ba2c4..f264ac9 100644 --- a/exachem/common/ec_dplot.hpp +++ b/exachem/common/ec_dplot.hpp @@ -8,7 +8,7 @@ #pragma once -#include "common/chemenv.hpp" +#include "exachem/common/chemenv.hpp" class EC_DPLOT { public: diff --git a/exachem/common/ec_molden.cpp b/exachem/common/ec_molden.cpp index e6f40ae..d860c0c 100644 --- a/exachem/common/ec_molden.cpp +++ b/exachem/common/ec_molden.cpp @@ -6,8 +6,8 @@ * See LICENSE.txt for details */ -#include "ec_molden.hpp" -#include "txt_utils.hpp" +#include "exachem/common/ec_molden.hpp" +#include "exachem/common/txt_utils.hpp" #include bool ECMolden::check_molden(std::string moldenfile) { diff --git a/exachem/common/ec_molden.hpp b/exachem/common/ec_molden.hpp index 782264e..eff69d8 100644 --- a/exachem/common/ec_molden.hpp +++ b/exachem/common/ec_molden.hpp @@ -8,9 +8,9 @@ #pragma once -#include "atom_info.hpp" -#include "chemenv.hpp" -#include "libint2_includes.hpp" +#include "exachem/common/atom_info.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/libint2_includes.hpp" #include class ECMolden { diff --git a/exachem/common/ecatom.cpp b/exachem/common/ecatom.cpp index b9085e1..4734a8a 100644 --- a/exachem/common/ecatom.cpp +++ b/exachem/common/ecatom.cpp @@ -6,7 +6,8 @@ * See LICENSE.txt for details */ -#include "ecatom.hpp" +#include "exachem/common/ecatom.hpp" + int ECAtom::get_atomic_number(std::string element_symbol) { int Z = -1; for(const auto& e: libint2::chemistry::get_element_info()) { diff --git a/exachem/common/ecatom.hpp b/exachem/common/ecatom.hpp index f1d42ad..6acd4a1 100644 --- a/exachem/common/ecatom.hpp +++ b/exachem/common/ecatom.hpp @@ -10,10 +10,10 @@ #include #include -#include "atom_info.hpp" -#include "libint2_includes.hpp" +#include "exachem/common/atom_info.hpp" +#include "exachem/common/libint2_includes.hpp" +#include "exachem/common/txt_utils.hpp" #include "tamm/tamm.hpp" -#include "txt_utils.hpp" using namespace tamm; using libint2::Atom; class ECAtom: public AtomInfo { diff --git a/exachem/common/fcidump.cpp b/exachem/common/fcidump.cpp index e6779e8..8d747d3 100644 --- a/exachem/common/fcidump.cpp +++ b/exachem/common/fcidump.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "fcidump.hpp" +#include "exachem/common/fcidump.hpp" template bool nonzero(T value) { diff --git a/exachem/common/fcidump.hpp b/exachem/common/fcidump.hpp index 9658844..832c27c 100644 --- a/exachem/common/fcidump.hpp +++ b/exachem/common/fcidump.hpp @@ -8,8 +8,7 @@ #pragma once -#include "common/chemenv.hpp" -#include "cutils.hpp" +#include "exachem/common/cutils.hpp" #include namespace fcidump { diff --git a/exachem/common/initialize_system_data.cpp b/exachem/common/initialize_system_data.cpp index b09358e..10300ab 100644 --- a/exachem/common/initialize_system_data.cpp +++ b/exachem/common/initialize_system_data.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "initialize_system_data.hpp" +#include "exachem/common/initialize_system_data.hpp" void IniSystemData::initialize(ChemEnv& chem_env) { chem_env.sys_data.results = json::object(); diff --git a/exachem/common/initialize_system_data.hpp b/exachem/common/initialize_system_data.hpp index 2b29860..0adf4da 100644 --- a/exachem/common/initialize_system_data.hpp +++ b/exachem/common/initialize_system_data.hpp @@ -8,8 +8,8 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/txt_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/txt_utils.hpp" #include namespace fs = std::filesystem; using json = nlohmann::ordered_json; diff --git a/exachem/common/options/input_options.hpp b/exachem/common/options/input_options.hpp index aed017a..164b380 100644 --- a/exachem/common/options/input_options.hpp +++ b/exachem/common/options/input_options.hpp @@ -8,8 +8,8 @@ #pragma once -#include "common/ecatom.hpp" -#include "common/txt_utils.hpp" +#include "exachem/common/ecatom.hpp" +#include "exachem/common/txt_utils.hpp" #include #include #include diff --git a/exachem/common/options/parse_ccsd_options.hpp b/exachem/common/options/parse_ccsd_options.hpp index 2b9f1b2..30a555a 100644 --- a/exachem/common/options/parse_ccsd_options.hpp +++ b/exachem/common/options/parse_ccsd_options.hpp @@ -8,9 +8,9 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseCCSDOptions: public ParserUtils { private: @@ -23,4 +23,4 @@ class ParseCCSDOptions: public ParserUtils { ParseCCSDOptions(ChemEnv& chem_env); void operator()(ChemEnv& chem_env); void print(ChemEnv& chem_env); -}; \ No newline at end of file +}; diff --git a/exachem/common/options/parse_cd_options.hpp b/exachem/common/options/parse_cd_options.hpp index cc03ef0..a0ede83 100644 --- a/exachem/common/options/parse_cd_options.hpp +++ b/exachem/common/options/parse_cd_options.hpp @@ -7,9 +7,9 @@ */ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseCDOptions: public ParserUtils { private: @@ -21,4 +21,4 @@ class ParseCDOptions: public ParserUtils { ParseCDOptions(ChemEnv& chem_env); void operator()(ChemEnv& chem_env); void print(ChemEnv& chem_env); -}; \ No newline at end of file +}; diff --git a/exachem/common/options/parse_common_options.hpp b/exachem/common/options/parse_common_options.hpp index 47fd617..c2bf86a 100644 --- a/exachem/common/options/parse_common_options.hpp +++ b/exachem/common/options/parse_common_options.hpp @@ -6,8 +6,8 @@ * See LICENSE.txt for details */ -#include "common/chemenv.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseCommonOptions: public ParserUtils { private: diff --git a/exachem/common/options/parse_fci_options.hpp b/exachem/common/options/parse_fci_options.hpp index 42bffe6..377be36 100644 --- a/exachem/common/options/parse_fci_options.hpp +++ b/exachem/common/options/parse_fci_options.hpp @@ -8,9 +8,9 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseFCIOptions: public ParserUtils { private: @@ -25,4 +25,4 @@ class ParseFCIOptions: public ParserUtils { // void print(ChemEnv& chem_env); }; -// Have to add print() functionls \ No newline at end of file +// Have to add print() functionls diff --git a/exachem/common/options/parse_gw_options.hpp b/exachem/common/options/parse_gw_options.hpp index bdef1e0..38f902d 100644 --- a/exachem/common/options/parse_gw_options.hpp +++ b/exachem/common/options/parse_gw_options.hpp @@ -8,9 +8,9 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseGWOptions: public ParserUtils { private: @@ -23,4 +23,4 @@ class ParseGWOptions: public ParserUtils { ParseGWOptions(ChemEnv& chem_env); void operator()(ChemEnv& chem_env); void print(ChemEnv& chem_env); -}; \ No newline at end of file +}; diff --git a/exachem/common/options/parse_options.hpp b/exachem/common/options/parse_options.hpp index 145af7e..9be71a3 100644 --- a/exachem/common/options/parse_options.hpp +++ b/exachem/common/options/parse_options.hpp @@ -16,7 +16,7 @@ #include "parse_gw_options.hpp" #include "parse_scf_options.hpp" #include "parse_task_options.hpp" -#include "common/initialize_system_data.hpp" +#include "exachem/common/initialize_system_data.hpp" // clang-format on // This class populates all the input options. @@ -29,4 +29,4 @@ class ECOptionParser: public ParserUtils { ECOptionParser(ChemEnv& chem_env); void initialize(ChemEnv& chem_env); void parse_all_options(ChemEnv& chem_env); -}; \ No newline at end of file +}; diff --git a/exachem/common/options/parse_scf_options.hpp b/exachem/common/options/parse_scf_options.hpp index 4c26899..e940bdd 100644 --- a/exachem/common/options/parse_scf_options.hpp +++ b/exachem/common/options/parse_scf_options.hpp @@ -7,9 +7,9 @@ */ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseSCFOptions: public ParserUtils { private: diff --git a/exachem/common/options/parse_task_options.hpp b/exachem/common/options/parse_task_options.hpp index 3f3fc58..7ff7c33 100644 --- a/exachem/common/options/parse_task_options.hpp +++ b/exachem/common/options/parse_task_options.hpp @@ -7,9 +7,9 @@ */ #pragma once -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/common/options/parser_utils.hpp" class ParseTaskOptions: public ParserUtils { private: @@ -22,4 +22,4 @@ class ParseTaskOptions: public ParserUtils { ParseTaskOptions(ChemEnv& chem_env); void operator()(ChemEnv& chem_env); void print(ChemEnv& chem_env); -}; \ No newline at end of file +}; diff --git a/exachem/common/options/parser_utils.hpp b/exachem/common/options/parser_utils.hpp index a609ec7..cff0cb0 100644 --- a/exachem/common/options/parser_utils.hpp +++ b/exachem/common/options/parser_utils.hpp @@ -22,10 +22,10 @@ #include "tamm/tamm.hpp" #include -#include "common/libint2_includes.hpp" -#include "common/ecatom.hpp" -#include "common/txt_utils.hpp" -#include "common/chemenv.hpp" +#include "exachem/common/libint2_includes.hpp" +#include "exachem/common/ecatom.hpp" +#include "exachem/common/txt_utils.hpp" +#include "exachem/common/chemenv.hpp" using namespace tamm; using std::cerr; diff --git a/exachem/common/system_data.cpp b/exachem/common/system_data.cpp index 029779b..22665d1 100644 --- a/exachem/common/system_data.cpp +++ b/exachem/common/system_data.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "system_data.hpp" +#include "exachem/common/system_data.hpp" void SystemData::print() { std::cout << "scf_type = " << scf_type_string << std::endl; diff --git a/exachem/common/system_data.hpp b/exachem/common/system_data.hpp index 2264e68..6d230e6 100644 --- a/exachem/common/system_data.hpp +++ b/exachem/common/system_data.hpp @@ -8,7 +8,7 @@ #pragma once -#include "common/txt_utils.hpp" +#include "exachem/common/txt_utils.hpp" #include "options/input_options.hpp" #include "tamm/eigen_utils.hpp" #include "tamm/tamm.hpp" diff --git a/exachem/common/txt_utils.cpp b/exachem/common/txt_utils.cpp index d301252..a9571fb 100644 --- a/exachem/common/txt_utils.cpp +++ b/exachem/common/txt_utils.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "txt_utils.hpp" +#include "exachem/common/txt_utils.hpp" #include void txt_utils::to_upper(std::string& str) { diff --git a/exachem/fci/fci.hpp b/exachem/fci/fci.hpp index 6ee940b..0f287b5 100644 --- a/exachem/fci/fci.hpp +++ b/exachem/fci/fci.hpp @@ -9,7 +9,7 @@ #pragma once #include "cholesky/cholesky_2e_driver.hpp" -#include "common/fcidump.hpp" +#include "exachem/common/fcidump.hpp" #if defined(USE_MACIS) #include "macis.hpp" #endif diff --git a/exachem/scf/scf.cmake b/exachem/scf/scf.cmake index d683735..a01809d 100644 --- a/exachem/scf/scf.cmake +++ b/exachem/scf/scf.cmake @@ -1,8 +1,10 @@ include(TargetMacros) -set(SCF_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/../exachem/scf) +set(SCF_SRCDIR scf) + set(SCF_INCLUDES + ${SCF_SRCDIR}/scf_vars.hpp ${SCF_SRCDIR}/scf_iter.hpp ${SCF_SRCDIR}/scf_main.hpp ${SCF_SRCDIR}/scf_gauxc.hpp @@ -14,6 +16,8 @@ set(SCF_INCLUDES ${SCF_SRCDIR}/scf_restart.hpp ${SCF_SRCDIR}/scf_outputs.hpp ${SCF_SRCDIR}/scf_hartree_fock.hpp + ${SCF_SRCDIR}/scf_tamm_tensors.hpp + ${SCF_SRCDIR}/scf_eigen_tensors.hpp ) set(SCF_SRCS @@ -27,6 +31,6 @@ set(SCF_SRCS ${SCF_SRCDIR}/scf_matrix.cpp ${SCF_SRCDIR}/scf_restart.cpp ${SCF_SRCDIR}/scf_outputs.cpp - ${SCF_SRCDIR}/scf_hartree_fock.cpp + ${SCF_SRCDIR}/scf_hartree_fock.cpp ) diff --git a/exachem/scf/scf_common.cpp b/exachem/scf/scf_common.cpp index 3b595b2..f67aae4 100644 --- a/exachem/scf/scf_common.cpp +++ b/exachem/scf/scf_common.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf/scf_common.hpp" +#include "exachem/scf/scf_common.hpp" #if defined(TAMM_USE_ELPA) #include #endif diff --git a/exachem/scf/scf_common.hpp b/exachem/scf/scf_common.hpp index 5be3258..81c087b 100644 --- a/exachem/scf/scf_common.hpp +++ b/exachem/scf/scf_common.hpp @@ -10,11 +10,11 @@ #include -#include "common/chemenv.hpp" -#include "common/cutils.hpp" -#include "scf_eigen_tensors.hpp" -#include "scf_tamm_tensors.hpp" -#include "scf_vars.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/cutils.hpp" +#include "exachem/scf/scf_eigen_tensors.hpp" +#include "exachem/scf/scf_tamm_tensors.hpp" +#include "exachem/scf/scf_vars.hpp" using namespace tamm; using libint2::Atom; diff --git a/exachem/scf/scf_compute.cpp b/exachem/scf/scf_compute.cpp index a34b0b0..e254800 100644 --- a/exachem/scf/scf_compute.cpp +++ b/exachem/scf/scf_compute.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf_compute.hpp" +#include "exachem/scf/scf_compute.hpp" void exachem::scf::SCFCompute::compute_shellpair_list(const ExecutionContext& ec, const libint2::BasisSet& shells, diff --git a/exachem/scf/scf_compute.hpp b/exachem/scf/scf_compute.hpp index cc2b01d..665df87 100644 --- a/exachem/scf/scf_compute.hpp +++ b/exachem/scf/scf_compute.hpp @@ -8,10 +8,10 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/cutils.hpp" -#include "scf/scf_common.hpp" -#include "scf/scf_guess.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/cutils.hpp" +#include "exachem/scf/scf_common.hpp" +#include "exachem/scf/scf_guess.hpp" using libint2::Atom; using TensorType = double; using shellpair_list_t = std::unordered_map>; diff --git a/exachem/scf/scf_gauxc.cpp b/exachem/scf/scf_gauxc.cpp index 486070f..2eb2654 100644 --- a/exachem/scf/scf_gauxc.cpp +++ b/exachem/scf/scf_gauxc.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf/scf_gauxc.hpp" +#include "exachem/scf/scf_gauxc.hpp" #if defined(USE_GAUXC) diff --git a/exachem/scf/scf_gauxc.hpp b/exachem/scf/scf_gauxc.hpp index 1e5625a..1c3a19f 100644 --- a/exachem/scf/scf_gauxc.hpp +++ b/exachem/scf/scf_gauxc.hpp @@ -15,12 +15,12 @@ #endif #if defined(USE_GAUXC) -#include "common/chemenv.hpp" -#include "common/options/input_options.hpp" -#include "scf/scf_compute.hpp" -#include "scf/scf_eigen_tensors.hpp" -#include "scf/scf_tamm_tensors.hpp" -#include "scf/scf_vars.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/options/input_options.hpp" +#include "exachem/scf/scf_compute.hpp" +#include "exachem/scf/scf_eigen_tensors.hpp" +#include "exachem/scf/scf_tamm_tensors.hpp" +#include "exachem/scf/scf_vars.hpp" namespace exachem::scf::gauxc { diff --git a/exachem/scf/scf_guess.cpp b/exachem/scf/scf_guess.cpp index 2111465..d6daab5 100644 --- a/exachem/scf/scf_guess.cpp +++ b/exachem/scf/scf_guess.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf/scf_guess.hpp" +#include "exachem/scf/scf_guess.hpp" #include #include diff --git a/exachem/scf/scf_guess.hpp b/exachem/scf/scf_guess.hpp index aa20593..70eef05 100644 --- a/exachem/scf/scf_guess.hpp +++ b/exachem/scf/scf_guess.hpp @@ -8,8 +8,8 @@ #pragma once -#include "scf/scf_common.hpp" -#include "scf/scf_compute.hpp" +#include "exachem/scf/scf_common.hpp" +#include "exachem/scf/scf_compute.hpp" #if defined(TAMM_USE_ELPA) #include diff --git a/exachem/scf/scf_hartree_fock.cpp b/exachem/scf/scf_hartree_fock.cpp index 30872be..7c0aa80 100644 --- a/exachem/scf/scf_hartree_fock.cpp +++ b/exachem/scf/scf_hartree_fock.cpp @@ -6,10 +6,10 @@ * See LICENSE.txt for details */ -#include "scf_hartree_fock.hpp" -#include "common/cutils.hpp" -#include "common/ec_dplot.hpp" -#include "common/options/parser_utils.hpp" +#include "exachem/scf/scf_hartree_fock.hpp" +#include "exachem/common/cutils.hpp" +#include "exachem/common/ec_dplot.hpp" +#include "exachem/common/options/parser_utils.hpp" #include void exachem::scf::SCFHartreeFock::initialize(ExecutionContext& exc, ChemEnv& chem_env) { @@ -135,7 +135,12 @@ void exachem::scf::SCFHartreeFock::scf_hf(ExecutionContext& exc, ChemEnv& chem_e // if(k.has_ecp) // nelectrons -= k.ecp_nelec; chem_env.sys_data.nelectrons = nelectrons; - EXPECTS((nelectrons + chem_env.ioptions.scf_options.multiplicity - 1) % 2 == 0); + if((nelectrons + chem_env.ioptions.scf_options.multiplicity - 1) % 2 != 0) { + std::string err_msg = + "[ERROR] Number of electrons (" + std::to_string(nelectrons) + ") " + "and multiplicity (" + + std::to_string(chem_env.ioptions.scf_options.multiplicity) + ") " + " not compatible!"; + tamm_terminate(err_msg); + } chem_env.sys_data.nelectrons_alpha = (nelectrons + chem_env.ioptions.scf_options.multiplicity - 1) / 2; diff --git a/exachem/scf/scf_hartree_fock.hpp b/exachem/scf/scf_hartree_fock.hpp index 3fd2945..e763ef3 100644 --- a/exachem/scf/scf_hartree_fock.hpp +++ b/exachem/scf/scf_hartree_fock.hpp @@ -7,15 +7,15 @@ */ #pragma once -#include "common/chemenv.hpp" -#include "common/ec_basis.hpp" -#include "common/ec_molden.hpp" -#include "common/system_data.hpp" -#include "scf_compute.hpp" -#include "scf_iter.hpp" -#include "scf_outputs.hpp" -#include "scf_restart.hpp" -#include "scf_taskmap.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/common/ec_basis.hpp" +#include "exachem/common/ec_molden.hpp" +#include "exachem/common/system_data.hpp" +#include "exachem/scf/scf_compute.hpp" +#include "exachem/scf/scf_iter.hpp" +#include "exachem/scf/scf_outputs.hpp" +#include "exachem/scf/scf_restart.hpp" +#include "exachem/scf/scf_taskmap.hpp" #include #define SCF_THROTTLE_RESOURCES 1 diff --git a/exachem/scf/scf_iter.cpp b/exachem/scf/scf_iter.cpp index e58b6c6..a80e349 100644 --- a/exachem/scf/scf_iter.cpp +++ b/exachem/scf/scf_iter.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf_iter.hpp" +#include "exachem/scf/scf_iter.hpp" template std::tuple exachem::scf::SCFIter::scf_iter_body( diff --git a/exachem/scf/scf_iter.hpp b/exachem/scf/scf_iter.hpp index 03ffe58..9e9205f 100644 --- a/exachem/scf/scf_iter.hpp +++ b/exachem/scf/scf_iter.hpp @@ -8,9 +8,9 @@ #pragma once -#include "scf/scf_compute.hpp" -#include "scf/scf_gauxc.hpp" -#include "scf/scf_guess.hpp" +#include "exachem/scf/scf_compute.hpp" +#include "exachem/scf/scf_gauxc.hpp" +#include "exachem/scf/scf_guess.hpp" namespace exachem::scf { class SCFIter: public SCFCompute { diff --git a/exachem/scf/scf_main.cpp b/exachem/scf/scf_main.cpp index adc8446..a752a20 100644 --- a/exachem/scf/scf_main.cpp +++ b/exachem/scf/scf_main.cpp @@ -6,11 +6,11 @@ * See LICENSE.txt for details */ -#include "scf/scf_main.hpp" -#include "common/termcolor.hpp" -#include "scf/scf_common.hpp" -#include "scf/scf_hartree_fock.hpp" -#include "scf/scf_outputs.hpp" +#include "exachem/scf/scf_main.hpp" +#include "exachem/common/termcolor.hpp" +#include "exachem/scf/scf_common.hpp" +#include "exachem/scf/scf_hartree_fock.hpp" +#include "exachem/scf/scf_outputs.hpp" #include namespace exachem::scf { diff --git a/exachem/scf/scf_main.hpp b/exachem/scf/scf_main.hpp index fa82c77..4fa38da 100644 --- a/exachem/scf/scf_main.hpp +++ b/exachem/scf/scf_main.hpp @@ -33,8 +33,8 @@ #include #include -#include "common/chemenv.hpp" -#include "scf/scf_taskmap.hpp" +#include "exachem/common/chemenv.hpp" +#include "exachem/scf/scf_taskmap.hpp" using libint2::BasisSet; diff --git a/exachem/scf/scf_matrix.cpp b/exachem/scf/scf_matrix.cpp index 5a7f1b9..752b292 100644 --- a/exachem/scf/scf_matrix.cpp +++ b/exachem/scf/scf_matrix.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf_matrix.hpp" +#include "exachem/scf/scf_matrix.hpp" template Matrix exachem::scf::SCFMatrix::read_scf_mat(std::string matfile) { diff --git a/exachem/scf/scf_matrix.hpp b/exachem/scf/scf_matrix.hpp index 7a96c72..5a4d373 100644 --- a/exachem/scf/scf_matrix.hpp +++ b/exachem/scf/scf_matrix.hpp @@ -8,7 +8,7 @@ #pragma once -#include "common/ec_molden.hpp" +#include "exachem/common/ec_molden.hpp" #include using TensorType = double; diff --git a/exachem/scf/scf_outputs.cpp b/exachem/scf/scf_outputs.cpp index e1c2f7a..0a078d6 100644 --- a/exachem/scf/scf_outputs.cpp +++ b/exachem/scf/scf_outputs.cpp @@ -6,9 +6,9 @@ * See LICENSE.txt for details */ -#include "scf_outputs.hpp" -#include "common/options/parser_utils.hpp" -#include "scf_matrix.hpp" +#include "exachem/scf/scf_outputs.hpp" +#include "exachem/common/options/parser_utils.hpp" +#include "exachem/scf/scf_matrix.hpp" template double exachem::scf::SCFIO::tt_trace(ExecutionContext& ec, Tensor& T1, diff --git a/exachem/scf/scf_outputs.hpp b/exachem/scf/scf_outputs.hpp index f6709de..aac1a61 100644 --- a/exachem/scf/scf_outputs.hpp +++ b/exachem/scf/scf_outputs.hpp @@ -8,15 +8,14 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/cutils.hpp" -#include "common/ec_basis.hpp" +#include "exachem/common/cutils.hpp" +#include "exachem/common/ec_basis.hpp" -#include "scf/scf_compute.hpp" -#include "scf/scf_eigen_tensors.hpp" -#include "scf/scf_matrix.hpp" -#include "scf/scf_tamm_tensors.hpp" -#include "scf/scf_vars.hpp" +#include "exachem/scf/scf_compute.hpp" +#include "exachem/scf/scf_eigen_tensors.hpp" +#include "exachem/scf/scf_matrix.hpp" +#include "exachem/scf/scf_tamm_tensors.hpp" +#include "exachem/scf/scf_vars.hpp" namespace exachem::scf { diff --git a/exachem/scf/scf_restart.cpp b/exachem/scf/scf_restart.cpp index f1fd67e..63e8d8d 100644 --- a/exachem/scf/scf_restart.cpp +++ b/exachem/scf/scf_restart.cpp @@ -6,8 +6,8 @@ * See LICENSE.txt for details */ -#include "scf/scf_restart.hpp" -#include "scf/scf_matrix.hpp" +#include "exachem/scf/scf_restart.hpp" +#include "exachem/scf/scf_matrix.hpp" // Originally scf_restart_test void exachem::scf::SCFRestart::operator()(const ExecutionContext& ec, ChemEnv& chem_env, diff --git a/exachem/scf/scf_restart.hpp b/exachem/scf/scf_restart.hpp index 9a363a8..995263c 100644 --- a/exachem/scf/scf_restart.hpp +++ b/exachem/scf/scf_restart.hpp @@ -8,12 +8,11 @@ #pragma once -#include "common/chemenv.hpp" -#include "common/cutils.hpp" -#include "common/ec_molden.hpp" -#include "scf/scf_eigen_tensors.hpp" -#include "scf/scf_outputs.hpp" -#include "scf/scf_tamm_tensors.hpp" +#include "exachem/common/cutils.hpp" +#include "exachem/common/ec_molden.hpp" +#include "exachem/scf/scf_eigen_tensors.hpp" +#include "exachem/scf/scf_outputs.hpp" +#include "exachem/scf/scf_tamm_tensors.hpp" using namespace tamm; namespace exachem::scf { diff --git a/exachem/scf/scf_taskmap.cpp b/exachem/scf/scf_taskmap.cpp index e1bd53f..e915932 100644 --- a/exachem/scf/scf_taskmap.cpp +++ b/exachem/scf/scf_taskmap.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details */ -#include "scf_taskmap.hpp" +#include "exachem/scf/scf_taskmap.hpp" void exachem::scf::Loads::readLoads(std::vector& s1_all, std::vector& s2_all, std::vector ntasks_all) { diff --git a/exachem/scf/scf_vars.hpp b/exachem/scf/scf_vars.hpp index 5c4939b..e6c4d37 100644 --- a/exachem/scf/scf_vars.hpp +++ b/exachem/scf/scf_vars.hpp @@ -8,7 +8,7 @@ #pragma once -#include "common/libint2_includes.hpp" +#include "exachem/common/libint2_includes.hpp" #include "tamm/tamm.hpp" #include diff --git a/inputs/scripts/xyz_to_exachem.py b/inputs/scripts/xyz_to_exachem.py index a60c05b..9cc4b2a 100644 --- a/inputs/scripts/xyz_to_exachem.py +++ b/inputs/scripts/xyz_to_exachem.py @@ -11,6 +11,7 @@ Args: input_file: The path to a single xyz file (OR) path to a folder contatining xyz files. + optional_args: task-name Returns: json input file(s) for ExaChem. @@ -83,6 +84,8 @@ def dict_to_json(dictname): if __name__ == '__main__': input_fpath = sys.argv[1] + taskname = "sinfo" + if len(sys.argv) == 3: taskname = sys.argv[2] input_files = [] @@ -152,11 +155,7 @@ def dict_to_json(dictname): ccsd_pt["ccsdt_tilesize"] = 40 exachem_opt["TASK"] = {} - exachem_opt["TASK"]["sinfo"] = True - exachem_opt["TASK"]["scf"] = False - exachem_opt["TASK"]["cd_2e"] = False - exachem_opt["TASK"]["ccsd"] = False - exachem_opt["TASK"]["ccsd_t"] = False + exachem_opt["TASK"][taskname] = True exachem_opt = dict_to_json(exachem_opt) diff --git a/methods/CMakeLists.txt b/methods/CMakeLists.txt index fc0e476..76640a0 100644 --- a/methods/CMakeLists.txt +++ b/methods/CMakeLists.txt @@ -11,25 +11,29 @@ option(EC_COMPLEX "enable complex codes" ON) #TODO: cleanup include_directories(${EXACHEM_SRC_DIR}) -include(${EXACHEM_SRC_DIR}/scf/scf.cmake) - include(${EXACHEM_SRC_DIR}/mp2/mp2.cmake) include(${EXACHEM_SRC_DIR}/cholesky/cholesky.cmake) -include(${EXACHEM_SRC_DIR}/cc/cc2/cc2.cmake) -include(${EXACHEM_SRC_DIR}/cc/eom/eom.cmake) -include(${EXACHEM_SRC_DIR}/cc/ccsd/ccsd.cmake) -include(${EXACHEM_SRC_DIR}/cc/ccsd_t/ccsd_t.cmake) -include(${EXACHEM_SRC_DIR}/cc/lambda/lambda.cmake) -include(${EXACHEM_SRC_DIR}/cc/ducc/ducc.cmake) - -if(NOT USE_UPCXX AND EC_COMPLEX) - include(${EXACHEM_SRC_DIR}/cc/gfcc/gfcc.cmake) - include(${EXACHEM_SRC_DIR}/cc/rteom/rteom.cmake) + +list(FIND MODULES "CC" _cc_index) + +if(NOT _cc_index EQUAL -1) + message(STATUS "Compiling CC modules") + include(${EXACHEM_SRC_DIR}/cc/cc2/cc2.cmake) + include(${EXACHEM_SRC_DIR}/cc/eom/eom.cmake) + include(${EXACHEM_SRC_DIR}/cc/ccsd/ccsd.cmake) + include(${EXACHEM_SRC_DIR}/cc/ccsd_t/ccsd_t.cmake) + include(${EXACHEM_SRC_DIR}/cc/lambda/lambda.cmake) + include(${EXACHEM_SRC_DIR}/cc/ducc/ducc.cmake) + + if(NOT USE_UPCXX AND EC_COMPLEX) + include(${EXACHEM_SRC_DIR}/cc/gfcc/gfcc.cmake) + include(${EXACHEM_SRC_DIR}/cc/rteom/rteom.cmake) + endif() endif() set(CoupledCluster_SRCS ${CC_SRCS} ${CC2_SRCS} ${CCSD_SRCS} ${CCSD_T_SRCS} ${CC_LAMBDA_SRCS} ${CC_EOM_SRCS} ${GFCC_SRCS} ${RTEOM_SRCS} ${DUCC_SRCS}) -set(EXACHEM_SRCS ${SCF_SRCS} ${MP2_SRCS} ${CD_SRCS} ${CoupledCluster_SRCS} ${EC_PRIVATE_SRCS}) +set(EXACHEM_SRCS ${MP2_SRCS} ${CD_SRCS} ${CoupledCluster_SRCS} ${EC_PRIVATE_SRCS}) add_mpi_gpu_unit_test(ExaChem "${EXACHEM_SRCS}" 2 "${CMAKE_SOURCE_DIR}/../inputs/h2o.json") diff --git a/methods/ExaChem.cpp b/methods/ExaChem.cpp index 9f2318a..4ea74dd 100644 --- a/methods/ExaChem.cpp +++ b/methods/ExaChem.cpp @@ -9,11 +9,10 @@ #include #include -#define EC_CC #define EC_COMPLEX // clang-format off -#if defined(EC_CC) +#if defined(ENABLE_CC) #include "cc/ccsd/cd_ccsd_os_ann.hpp" #include "cc/ccsd_t/ccsd_t_fused_driver.hpp" #include "exachem/cc/lambda/ccsd_lambda.hpp" @@ -22,12 +21,12 @@ #include "exachem/common/chemenv.hpp" #include "exachem/common/options/parse_options.hpp" -#include "scf/scf_main.hpp" +#include "exachem/scf/scf_main.hpp" #include "mp2/cd_mp2.hpp" // clang-format on using namespace exachem; -#if !defined(USE_UPCXX) and defined(EC_COMPLEX) and defined(EC_CC) +#if !defined(USE_UPCXX) and defined(EC_COMPLEX) and defined(ENABLE_CC) namespace exachem::cc::gfcc { void gfccsd_driver(ExecutionContext& ec, ChemEnv& chem_env); } @@ -37,7 +36,7 @@ void rt_eom_cd_ccsd_driver(ExecutionContext& ec, ChemEnv& chem_env); #include "exachem/fci/fci.hpp" #endif -#if defined(EC_CC) +#if defined(ENABLE_CC) namespace exachem::cc2 { void cd_cc2_driver(ExecutionContext& ec, ChemEnv& chem_env); } @@ -188,7 +187,7 @@ int main(int argc, char* argv[]) { if(task.sinfo) chem_env.sinfo(); else if(task.scf) scf::scf_driver(ec, chem_env); -#if defined(EC_CC) +#if defined(ENABLE_CC) else if(task.mp2) mp2::cd_mp2(ec, chem_env); else if(task.cd_2e) cholesky_2e::cholesky_decomp_2e(ec, chem_env); else if(task.ccsd) cc::ccsd::cd_ccsd(ec, chem_env);