Skip to content

Commit

Permalink
initial attempt to use scf as a library
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaypanyala committed Jul 11, 2024
1 parent 76b3180 commit 3553cba
Show file tree
Hide file tree
Showing 66 changed files with 257 additions and 411 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
2 changes: 1 addition & 1 deletion exachem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
65 changes: 64 additions & 1 deletion exachem/cc/ccsd/ccsd_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -67,3 +67,66 @@ void ccsd_stats(ExecutionContext& ec, double hf_energy, double residual, double

template<typename T>
void cc_print(ChemEnv& chem_env, Tensor<T> d_t1, Tensor<T> d_t2, std::string files_prefix);

template<typename T>
struct V2Tensors_SE {
CCSE_Tensors<T> v2ijab;
CCSE_Tensors<T> v2iajb;
CCSE_Tensors<T> v2ijka;
CCSE_Tensors<T> v2ijkl;
CCSE_Tensors<T> v2iabc;
CCSE_Tensors<T> v2abcd;

void allocate(Scheduler& sch, const TiledIndexSpace& MO) {
const TiledIndexSpace& O = MO("occ");
const TiledIndexSpace& V = MO("virt");
v2ijab = CCSE_Tensors<T>{MO, {O, O, V, V}, "ijab", {"aaaa", "abab", "bbbb"}};
v2iajb = CCSE_Tensors<T>{MO, {O, V, O, V}, "iajb", {"aaaa", "abab", "bbbb"}};
v2ijka = CCSE_Tensors<T>{MO, {O, O, O, V}, "ijka", {"aaaa", "abab", "bbbb"}};
v2ijkl = CCSE_Tensors<T>{MO, {O, O, O, O}, "ijkl", {"aaaa", "abab", "bbbb"}};
v2iabc = CCSE_Tensors<T>{MO, {O, V, V, V}, "iabc", {"aaaa", "abab", "bbbb"}};
v2abcd = CCSE_Tensors<T>{MO, {V, V, V, V}, "abcd", {"aaaa", "abab", "bbbb"}};
CCSE_Tensors<T>::allocate_list(sch, v2ijab, v2iajb, v2ijka, v2ijkl, v2iabc, v2abcd);
}

void init(Scheduler& sch, const TiledIndexSpace& MO,
exachem::cholesky_2e::V2Tensors<T>& 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<T>::deallocate_list(sch, v2ijab, v2iajb, v2ijka, v2ijkl, v2iabc, v2abcd);
}
};
234 changes: 0 additions & 234 deletions exachem/cc/ccsd_t/memory.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion exachem/cc/lambda/ccsd_lambda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions exachem/cc/lambda/ccsd_lambda_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <filesystem>

namespace fs = std::filesystem;
Expand Down
8 changes: 4 additions & 4 deletions exachem/cholesky/cholesky_2e.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -38,4 +38,4 @@ Tensor<TensorType> cholesky_2e(ChemEnv& chem_env, ExecutionContext& ec, TiledInd
TiledIndexSpace& tAO, TAMM_SIZE& chol_count,
const TAMM_GA_SIZE max_cvecs, libint2::BasisSet& shells,
Tensor<TensorType>& lcao, bool is_mso = true);
} // namespace exachem::cholesky_2e
} // namespace exachem::cholesky_2e
2 changes: 1 addition & 1 deletion exachem/cholesky/cholesky_2e_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion exachem/cholesky/two_index_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion exachem/common/atom_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

#pragma once
#include "libint2_includes.hpp"
#include "exachem/common/libint2_includes.hpp"
class AtomInfo {
public:
size_t nbf;
Expand Down
Loading

0 comments on commit 3553cba

Please sign in to comment.