00001 /* Ergo, version 3.7, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2018 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, 00004 * and Anastasia Kruchinina. 00005 * 00006 * This program is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * Primary academic reference: 00020 * Ergo: An open-source program for linear-scaling electronic structure 00021 * calculations, 00022 * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia 00023 * Kruchinina, 00024 * SoftwareX 7, 107 (2018), 00025 * <http://dx.doi.org/10.1016/j.softx.2018.03.005> 00026 * 00027 * For further information about Ergo, see <http://www.ergoscf.org>. 00028 */ 00029 00040 #ifndef ORGANIZE_DISTRS_HEADER 00041 #define ORGANIZE_DISTRS_HEADER 00042 00043 #include "output.h" 00044 #include "multipole.h" 00045 #include "simple_sparse_mat.h" 00046 00047 #include <vector> 00048 00049 00050 typedef struct 00051 { 00052 int startIndex; 00053 int distrCount; 00054 int nmax; 00055 ergo_real centerCoords[3]; 00056 ergo_real exponent; 00057 ergo_real maxSizeGroup; 00058 ergo_real maxExtentGroup; 00059 ergo_real maxLimitingFactorGroup; 00060 ergo_real maxAbsDmatElementGroup; 00061 ergo_real multipoleEuclNormListForK[MAX_MULTIPOLE_DEGREE_BASIC+1]; 00062 } distr_group_struct; 00063 00064 typedef struct 00065 { 00066 int basisFuncPairIndex; 00067 int monomialIndex; 00068 ergo_real coeff; 00069 } minimal_distr_struct; 00070 00071 typedef struct 00072 { 00073 int nmax; 00074 ergo_real exponent; 00075 int groupStartIndex; 00076 int noOfGroups; 00077 ergo_real maxLimitingFactorForCluster; 00078 ergo_real multipoleEuclNormListForK[MAX_MULTIPOLE_DEGREE_BASIC+1]; 00079 } cluster_struct; 00080 00081 typedef struct 00082 { 00083 int index_1; 00084 int index_2; 00085 int index_1_mod; 00086 int index_2_mod; 00087 int index_inbox_1; 00088 int index_inbox_2; 00089 int pairIndex; 00090 ergo_real dmatElement; 00091 } basis_func_pair_struct; 00092 00093 #ifndef BASIS_FUNC_POLY_MAX_DEGREE 00094 #error The constant BASIS_FUNC_POLY_MAX_DEGREE must be defined. 00095 #endif 00096 #if BASIS_FUNC_POLY_MAX_DEGREE<6 00097 #define MAX_NO_OF_BASIS_FUNC_PAIRS_PER_BATCH 1000 00098 #else 00099 #define MAX_NO_OF_BASIS_FUNC_PAIRS_PER_BATCH 10000 00100 #endif 00101 00102 typedef struct 00103 { 00104 int clusterStartIndex; 00105 int noOfClusters; 00106 int noOfBasisFuncPairs; 00107 int basisFuncPairListIndex; 00108 int basisFuncForBatchsIndex; 00109 int basisFuncForBatchCount; 00110 int global_debug_id; 00111 } batch_struct; 00112 00113 struct basis_func_group_info_for_box { 00114 int basisFuncGroupIndex; 00115 ergo_real max_CS_factor; 00116 ergo_real maxMomentVectorNormList[MAX_MULTIPOLE_DEGREE_BASIC+1]; 00117 int maxMultipoleDegree; 00118 }; 00119 00120 00121 struct distr_org_struct { 00122 std::vector<minimal_distr_struct> minimalDistrList; 00123 std::vector<distr_group_struct> groupList; 00124 std::vector<cluster_struct> clusterList; 00125 std::vector<batch_struct> batchList; 00126 std::vector<basis_func_pair_struct> basisFuncPairList; 00127 std::vector<int> basisFuncListForBatchs; 00128 std::vector<int> basisFuncListForBatchs_map; 00129 std::vector<int> basisFuncList; 00130 std::vector<i_j_val_struct> spMatElementList; 00131 std::vector<int> spMatCountList; 00132 std::vector<int> spMatIdxList; 00133 std::vector<basis_func_group_info_for_box> basisFuncGroupInfoListForK; 00134 struct Data { 00135 ergo_real maxExtent; 00136 ergo_real maxDistanceOutsideBox; 00137 int maxNoOfMonomials; 00138 Data(); 00139 }; 00140 Data data; 00141 // Functions needed for CHT usage 00142 void writeToBuffer(char* dataBuffer, size_t const bufferSize) const; 00143 size_t getSize() const; 00144 void assignFromBuffer(char const * dataBuffer, size_t const bufferSize); 00145 }; 00146 00147 00148 int 00149 organize_distributions(const IntegralInfo & integralInfo, 00150 DistributionSpecStructLabeled* distrList_in, 00151 int distrCount, 00152 distr_org_struct* result, 00153 const ergo_real* boxCenterCoords, 00154 ergo_real boxWidth); 00155 00156 #endif