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 00038 #ifndef MULTIPOLE_PREP_HEADER 00039 #define MULTIPOLE_PREP_HEADER 00040 00041 #include "realtype.h" 00042 #include "polydegree.h" 00043 #include <cstddef> /* size_t */ 00044 00045 #define MAX_MULTIPOLE_DEGREE 15 00046 #define MAX_NO_OF_MOMENTS_PER_MULTIPOLE ((MAX_MULTIPOLE_DEGREE+1)*(MAX_MULTIPOLE_DEGREE+1)) 00047 00048 #define MAX_MULTIPOLE_DEGREE_BASIC BASIS_FUNC_POLY_MAX_DEGREE 00049 #define MAX_NO_OF_MOMENTS_PER_MULTIPOLE_BASIC ((MAX_MULTIPOLE_DEGREE_BASIC+1)*(MAX_MULTIPOLE_DEGREE_BASIC+1)) 00050 00051 typedef struct 00052 { 00053 ergo_real centerCoords[3]; 00054 int degree; 00055 int noOfMoments; 00056 ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE]; 00057 ergo_real maxAbsMomentList[MAX_MULTIPOLE_DEGREE+1]; 00058 ergo_real euclideanNormList[MAX_MULTIPOLE_DEGREE+1]; 00059 } multipole_struct_large; 00060 00061 typedef struct 00062 { 00063 ergo_real centerCoords[3]; 00064 int degree; 00065 int noOfMoments; 00066 ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE_BASIC]; 00067 } multipole_struct_small; 00068 00069 class MultipolePrepManager { 00070 public: 00071 typedef struct { 00072 int l; 00073 int m; 00074 } l_m_struct; 00075 private: 00076 int initialized_flag; 00077 ergo_real prepared_lm_factor_list[MAX_MULTIPOLE_DEGREE+1][MAX_MULTIPOLE_DEGREE+1]; 00078 l_m_struct prepared_l_m_list[MAX_NO_OF_MOMENTS_PER_MULTIPOLE]; 00079 public: 00080 MultipolePrepManager(); 00081 void init(); 00082 bool is_initialized() const; 00083 const l_m_struct* get_l_m_list_ptr() const { return prepared_l_m_list; } 00084 ergo_real get_lm_factor(int l, int m) const; 00085 // Stuff needed for Chunks&Tasks usage 00086 void write_to_buffer ( char * dataBuffer, size_t const bufferSize ) const; 00087 size_t get_size() const; 00088 void assign_from_buffer ( char const * dataBuffer, size_t const bufferSize); 00089 }; 00090 00091 #endif