1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
/* Ergo, version 3.8.2, a program for linear scaling electronic structure
* calculations.
* Copyright (C) 2023 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek,
* and Anastasia Kruchinina.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Primary academic reference:
* Ergo: An open-source program for linear-scaling electronic structure
* calculations,
* Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia
* Kruchinina,
* SoftwareX 7, 107 (2018),
* <http://dx.doi.org/10.1016/j.softx.2018.03.005>
*
* For further information about Ergo, see <http://www.ergoscf.org>.
*/
/** @file integrals_2el_utils.h
\brief Code for various utilities used by 2-electron integral
computation (i.e. computation of J and K matrices).
@author: Elias Rudberg <em>responsible</em>.
*/
#ifndef INTEGRALS_2EL_UTILS_HEADER
#define INTEGRALS_2EL_UTILS_HEADER
#include "organize_distrs.h"
#include "organize_distrs_mm.h"
#include "box_system.h"
#define MAX_NO_OF_BRANCHES 10
/* Struct used for storing result matrix contributions when e.g. the J
kernel routine is used with Chunks and Tasks. */
struct ResultMatContrib {
struct RowColVal {
int row;
int col;
ergo_real value;
};
static const int nVectorsMax = 40;
int currVecIndex;
int currContribCount;
int indexInCurrVec;
int currVecReservedSize;
std::vector<RowColVal> * vList[nVectorsMax];
ResultMatContrib();
~ResultMatContrib();
void addContrib(int row, int col, ergo_real value);
const RowColVal & fetchNextContrib(int & currVecIndexForFetch, int & indexInCurrVecForFetch) const;
};
struct box_struct {
// General stuff
box_struct_basic basicBox;
// Stuff related to J
distr_list_description_struct branchListForJ[MAX_NO_OF_BRANCHES];
int branchIndexListForJ[MAX_NO_OF_BRANCHES];
int branchCountListForJ[MAX_NO_OF_BRANCHES];
// Stuff related to K
distr_list_description_struct distrListForK;
// Constructor
box_struct();
};
struct JK_contribs_buffer_struct {
ergo_real* summedIntegralList;
ergo_real* primitiveIntegralList;
ergo_real* primitiveIntegralList_work;
ergo_real* partial_dmat_1;
ergo_real* partial_dmat_2; // used in non-symmetric case
ergo_real* partial_K_1;
ergo_real* partial_K_2; // used in non-symmetric case
};
ergo_real get_max_abs_vector_element(int n, const ergo_real* vector);
void
allocate_buffers_needed_by_integral_code(const IntegralInfo & integralInfo,
int maxNoOfMonomials,
int basisFuncListCount_max,
JK_contribs_buffer_struct* bufferStruct);
void
free_buffers_needed_by_integral_code(JK_contribs_buffer_struct* bufferStruct);
int
get_related_integrals_h(const IntegralInfo & integralInfo,
const JK::ExchWeights & CAM_params,
int n1max, int noOfMonomials_1,
int n2max, int noOfMonomials_2,
ergo_real dx0,
ergo_real dx1,
ergo_real dx2,
ergo_real alpha1,
ergo_real alpha2,
ergo_real alpha0,
ergo_real* primitiveIntegralList,
ergo_real* primitiveIntegralList_work,
ergo_real resultPreFactor);
void
compute_extent_for_list_of_distributions(int n,
DistributionSpecStructLabeled* distrList,
ergo_real threshold,
ergo_real maxLimitingFactor,
ergo_real maxabsDmatelement);
int
get_list_of_labeled_distrs_maxLimitingFactor(const BasisInfoStruct & basisInfo,
const IntegralInfo & integralInfo,
ergo_real threshold,
ergo_real* resultMaxLimitingFactor,
ergo_real maxDensityMatrixElement);
int
get_list_of_labeled_distrs(const BasisInfoStruct & basisInfo,
const IntegralInfo & integralInfo,
ergo_real threshold,
DistributionSpecStructLabeled* resultList,
int maxCountDistrs,
ergo_real maxLimitingFactor,
const ergo_real* dens,
ergo_real maxDensityMatrixElement);
int
create_box_system_and_reorder_distrs(int distrCount,
DistributionSpecStructLabeled* distrList,
ergo_real toplevelBoxSize,
BoxSystem & boxSystem);
#endif
|