diff --git a/README.md b/README.md index 47ac0bd..bfb389d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # HFCXX [![Build](https://github.com/ifilot/hfcxx/actions/workflows/build.yml/badge.svg)](https://github.com/ifilot/hfcxx/actions/workflows/build.yml) +![Version](https://img.shields.io/github/v/tag/ifilot/hfcxx?label=version) +[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ## Overview diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 85562be..37227ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,7 @@ #**************************************************************************/ # set minimum cmake requirements -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.5) project (hfcxx) # add custom directory to look for .cmake files diff --git a/src/hf.cpp b/src/hf.cpp index 9ebd62e..b0d1ca9 100644 --- a/src/hf.cpp +++ b/src/hf.cpp @@ -65,7 +65,7 @@ void HF::molecule(const Molecule &moll) { for(unsigned int i=0; i> te_jobs; - for(unsigned int i=0; i tedouble(tecnt, -1.0); + + // it is more efficient to first 'unroll' the fourfold nested loop + // into a single vector of jobs to execute + std::vector> jobs; + for(size_t i=0; i= tedouble.size()) { + throw std::runtime_error("Process tried to access illegal array position"); + } + + if(tedouble[idx] < 0.0) { + tedouble[idx] = 1.0; + jobs.emplace_back(std::array({idx, i, j, k, l})); + } } } } } } - // perform the two-electron integral calculation + // evaluate jobs #pragma omp parallel for schedule(dynamic) - for(const auto& te_job : te_jobs) { - TE[te_job[0]] = cgf_repulsion(orbitals[te_job[1]],orbitals[te_job[2]],orbitals[te_job[3]],orbitals[te_job[4]]); + for(int s=0; s<(int)jobs.size(); s++) { // have to use signed int for MSVC OpenMP here + const size_t idx = jobs[s][0]; + const size_t i = jobs[s][1]; + const size_t j = jobs[s][2]; + const size_t k = jobs[s][3]; + const size_t l = jobs[s][4]; + tedouble[idx] = cgf_repulsion(orbitals[i], orbitals[j], orbitals[k], orbitals[l]); + } + + const size_t sz2 = sz * sz; + const size_t sz3 = sz2 * sz; + + // reorganize everyting into a tensor object + for(size_t i=0; i #include #include +#include #include "config.h" #include "molecule.h" diff --git a/src/repulsion.cpp b/src/repulsion.cpp index add3866..79b4467 100644 --- a/src/repulsion.cpp +++ b/src/repulsion.cpp @@ -76,11 +76,17 @@ double coulomb_repulsion(const Vec3 &a, const double &norma, const int la, const std::vector by = B_array(ma, mb, mc, md, p.gety(), a.gety(), b.gety(), q.gety(), c.gety(), d.gety(), gamma1, gamma2, delta); std::vector bz = B_array(na, nb, nc, nd, p.getz(), a.getz(), b.getz(), q.getz(), c.getz(), d.getz(), gamma1, gamma2, delta); + // pre-calculate all Fgamma values + std::vector fg(la+lb+lc+ld+ma+mb+mc+md+na+nb+nc+nd+1); + for (unsigned int i=0; i #include -#define PACKAGE_VERSION "1.5.0" +#define PACKAGE_VERSION "1.5.1" std::string version();