00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00038 #ifndef INTEGRALS_2EL_UTILS_HEADER
00039 #define INTEGRALS_2EL_UTILS_HEADER
00040
00041
00042 #include "organize_distrs.h"
00043 #include "organize_distrs_mm.h"
00044 #include "box_system.h"
00045
00046
00047 #define MAX_NO_OF_BRANCHES 10
00048
00049
00050
00051
00052 struct ResultMatContrib {
00053 struct RowColVal {
00054 int row;
00055 int col;
00056 ergo_real value;
00057 };
00058 static const int nVectorsMax = 40;
00059 int currVecIndex;
00060 int currContribCount;
00061 int indexInCurrVec;
00062 int currVecReservedSize;
00063 std::vector<RowColVal> * vList[nVectorsMax];
00064 ResultMatContrib();
00065 ~ResultMatContrib();
00066 void addContrib(int row, int col, ergo_real value);
00067 const RowColVal & fetchNextContrib(int & currVecIndexForFetch, int & indexInCurrVecForFetch) const;
00068 };
00069
00070
00071 struct box_struct {
00072
00073 box_struct_basic basicBox;
00074
00075 distr_list_description_struct branchListForJ[MAX_NO_OF_BRANCHES];
00076 int branchIndexListForJ[MAX_NO_OF_BRANCHES];
00077 int branchCountListForJ[MAX_NO_OF_BRANCHES];
00078
00079 distr_list_description_struct distrListForK;
00080
00081 box_struct();
00082 };
00083
00084
00085 struct JK_contribs_buffer_struct {
00086 ergo_real* summedIntegralList;
00087 ergo_real* primitiveIntegralList;
00088 ergo_real* primitiveIntegralList_work;
00089 ergo_real* partial_dmat_1;
00090 ergo_real* partial_dmat_2;
00091 ergo_real* partial_K_1;
00092 ergo_real* partial_K_2;
00093 };
00094
00095
00096 ergo_real get_max_abs_vector_element(int n, const ergo_real* vector);
00097
00098 void
00099 allocate_buffers_needed_by_integral_code(const IntegralInfo & integralInfo,
00100 int maxNoOfMonomials,
00101 int basisFuncListCount_max,
00102 JK_contribs_buffer_struct* bufferStruct);
00103
00104 void
00105 free_buffers_needed_by_integral_code(JK_contribs_buffer_struct* bufferStruct);
00106
00107 int
00108 get_related_integrals_h(const IntegralInfo & integralInfo,
00109 const JK::ExchWeights & CAM_params,
00110 int n1max, int noOfMonomials_1,
00111 int n2max, int noOfMonomials_2,
00112 ergo_real dx0,
00113 ergo_real dx1,
00114 ergo_real dx2,
00115 ergo_real alpha1,
00116 ergo_real alpha2,
00117 ergo_real alpha0,
00118 ergo_real* primitiveIntegralList,
00119 ergo_real* primitiveIntegralList_work,
00120 ergo_real resultPreFactor);
00121
00122 void
00123 compute_extent_for_list_of_distributions(int n,
00124 DistributionSpecStructLabeled* distrList,
00125 ergo_real threshold,
00126 ergo_real maxLimitingFactor,
00127 ergo_real maxabsDmatelement);
00128
00129 int
00130 get_list_of_labeled_distrs_maxLimitingFactor(const BasisInfoStruct & basisInfo,
00131 const IntegralInfo & integralInfo,
00132 ergo_real threshold,
00133 ergo_real* resultMaxLimitingFactor,
00134 ergo_real maxDensityMatrixElement);
00135
00136 int
00137 get_list_of_labeled_distrs(const BasisInfoStruct & basisInfo,
00138 const IntegralInfo & integralInfo,
00139 ergo_real threshold,
00140 DistributionSpecStructLabeled* resultList,
00141 int maxCountDistrs,
00142 ergo_real maxLimitingFactor,
00143 const ergo_real* dens,
00144 ergo_real maxDensityMatrixElement);
00145
00146 int
00147 create_box_system_and_reorder_distrs(int distrCount,
00148 DistributionSpecStructLabeled* distrList,
00149 ergo_real toplevelBoxSize,
00150 BoxSystem & boxSystem);
00151
00152
00153
00154 #endif