ergo
|
00001 /* Ergo, version 3.2, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2012 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * Primary academic reference: 00019 * KohnâSham Density Functional Theory Electronic Structure Calculations 00020 * with Linearly Scaling Computational Time and Memory Usage, 00021 * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek, 00022 * J. Chem. Theory Comput. 7, 340 (2011), 00023 * <http://dx.doi.org/10.1021/ct100611z> 00024 * 00025 * For further information about Ergo, see <http://www.ergoscf.org>. 00026 */ 00027 00028 #ifndef BASISINFO_HEADER 00029 #define BASISINFO_HEADER 00030 00031 /* for NULL */ 00032 #include <stdlib.h> 00033 00034 #include "realtype.h" 00035 #include "integral_info.h" 00036 /* for Molecule */ 00037 #include "molecule.h" 00038 00039 #include "basisset.h" 00040 00041 #define MAX_NO_OF_PRIMITIVES_PER_BASIS_FUNC 44 00042 00043 struct DistributionSpecStruct_{ 00044 ergo_real coeff; 00045 ergo_real exponent; 00046 ergo_real extent; 00047 ergo_real centerCoords[3]; 00048 char monomialInts[4]; 00049 }; 00050 typedef struct DistributionSpecStruct_ DistributionSpecStruct; 00051 00052 typedef struct 00053 { 00054 int basisFuncIndex_1; 00055 int basisFuncIndex_2; 00056 int pairIndex; 00057 int groupID; 00058 ergo_real limitingFactor; // squareroot of repulsion integral of this distr with itself. 00059 ergo_real dmatElement; 00060 DistributionSpecStruct distr; 00061 } DistributionSpecStructLabeled; 00062 00063 00064 #define MAX_NO_OF_CONTR_GAUSSIANS 20 00065 00066 struct ShellSpecStruct_{ 00067 ergo_real coeffList[MAX_NO_OF_CONTR_GAUSSIANS]; 00068 ergo_real exponentList[MAX_NO_OF_CONTR_GAUSSIANS]; 00069 ergo_real sizeList[MAX_NO_OF_CONTR_GAUSSIANS]; 00070 ergo_real padding; /* We keep this for compatibility with old density files... */ 00071 ergo_real centerCoords[3]; /* x0, y0, z0 */ 00072 int noOfContr; 00073 int shellType; 00074 int shell_ID; 00075 int noOfBasisFuncs; 00076 int startIndexInMatrix; /* start index in density matrix */ 00077 int dummy; /* padding to make sure the size of this structure is a multiple of 8 bytes */ 00078 }; 00079 typedef struct ShellSpecStruct_ ShellSpecStruct; 00080 00081 struct BasisFuncStruct_{ 00082 int noOfContr; 00083 ergo_real coeffList[MAX_NO_OF_CONTR_GAUSSIANS]; 00084 ergo_real exponentList[MAX_NO_OF_CONTR_GAUSSIANS]; 00085 ergo_real extent; 00086 Vector3D centerCoords; /* x0, y0, z0 */ 00087 int shellType; /* 0 <-> 's', 1 <-> 'p', 2 <-> 'd' etc */ 00088 int functionNumber; /* -1,0,1 for 'p', -2,-1,0,1,2 for 'd', etc */ 00089 int noOfSimplePrimitives; 00090 int simplePrimitiveIndex; 00091 int noOfTermsInPolynomial; 00092 basis_func_term_struct poly[MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY]; 00093 }; 00094 typedef struct BasisFuncStruct_ BasisFuncStruct; 00095 00096 00097 typedef struct 00098 { 00099 int startAtomIndex; 00100 int count; 00101 basisset_struct* basisset; 00102 } basis_set_range_struct; 00103 00104 typedef struct 00105 { 00106 int startAtomIndex; 00107 int count; 00108 char* basisSetFileName; 00109 } BasissetNameRange; 00110 00111 struct BasisInfoStruct{ 00112 int use_6_d_funcs; 00117 int noOfShells; 00118 ShellSpecStruct* shellList; 00119 int noOfBasisFuncs; 00120 BasisFuncStruct* basisFuncList; 00121 int noOfSimplePrimitives; 00122 DistributionSpecStruct* simplePrimitiveList; 00123 00125 BasisInfoStruct(int use_6_d_funcs_ = 0) : 00126 use_6_d_funcs(use_6_d_funcs_), 00127 noOfShells(0), 00128 shellList(NULL), 00129 noOfBasisFuncs(0), 00130 basisFuncList(NULL), 00131 noOfSimplePrimitives(0), 00132 simplePrimitiveList(NULL) 00133 { 00134 } 00135 00136 ~BasisInfoStruct() 00137 { 00138 if(shellList) delete [] shellList; 00139 if(basisFuncList) delete [] basisFuncList; 00140 if(simplePrimitiveList) delete [] simplePrimitiveList; 00141 } 00142 00143 int addBasisfuncsForMolecule(const Molecule& molecule, 00144 const char* basisset_filename_default, 00145 int noOfRanges, 00146 const BasissetNameRange* rangeList, 00147 const IntegralInfo& integralInfo, 00148 int print_raw, 00149 int do_normalization, 00150 int skip_sort_shells); 00151 00152 BasisInfoStruct *permuteShells(const int *shellMap, 00153 const IntegralInfo& ii) const; 00154 00155 int normalizeShells(const IntegralInfo& integralInfo); 00156 00157 int get_basis_funcs(); 00158 00159 int getSimplePrimitivesAll(const IntegralInfo& integralInfo); 00160 }; 00161 00162 00163 00169 struct SquareFuncIntegrator { 00170 const int MAX_NO_OF_PRIMS; 00171 DistributionSpecStruct *list; 00172 DistributionSpecStruct *productlist; 00173 SquareFuncIntegrator() : MAX_NO_OF_PRIMS(44444) 00174 { 00175 list = new DistributionSpecStruct[MAX_NO_OF_PRIMS]; 00176 productlist = new DistributionSpecStruct[MAX_NO_OF_PRIMS]; 00177 } 00178 ~SquareFuncIntegrator() 00179 { 00180 delete []list; 00181 delete []productlist; 00182 } 00183 ergo_real computeIntegralOfSquareOfBasisFunc 00184 (const IntegralInfo& integralInfo, BasisFuncStruct* basisFunc, int use_6_d_funcs); 00185 00186 ergo_real getShellFactor(const IntegralInfo& integralInfo, 00187 ergo_real exponent, int shellType, int use_6_d_funcs); 00188 }; 00189 00190 00191 00192 00193 #ifdef ERGO_ENABLE_DEPRECATED 00194 00195 int basisinfo_construct_multi_basis(BasisInfoStruct* result_basisInfo, 00196 const Molecule* molecule, 00197 const char* basisset_filename_default, 00198 const Molecule* ghostMolecule, 00199 const char* ghost_molecule_basisset_filename, 00200 int noOfRanges, 00201 const BasissetNameRange* rangeList, 00202 IntegralInfo* integralInfo, 00203 int print_raw, 00204 int do_normalization, 00205 int skip_sort_shells, 00206 int skip_standard_basis); 00207 struct AtomInfoStruct_{ 00208 int charge; 00209 ergo_real coords[3]; 00210 }; 00211 typedef struct AtomInfoStruct_ AtomInfoStruct; 00212 #endif 00213 00214 int get_basis_funcs(BasisInfoStruct* basisInfo, 00215 const IntegralInfo* integralInfo, 00216 int do_normalization); 00217 00218 int get_simple_primitives_all(BasisInfoStruct* basisInfo, 00219 const IntegralInfo* integralInfo); 00220 00221 int output_basisinfo(const BasisInfoStruct & basisInfo); 00222 00223 ergo_real getSafeMaxDistance(const BasisInfoStruct & basisInfo); 00224 00225 00226 #endif