ergo
multipole.h
Go to the documentation of this file.
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 MULTIPOLE_HEADER
00029 #define MULTIPOLE_HEADER
00030 
00031 
00032 #include "realtype.h"
00033 #include "integral_info.h"
00034 #include "basisinfo.h"
00035 
00036 #define MAX_MULTIPOLE_DEGREE 15
00037 #define MAX_NO_OF_MOMENTS_PER_MULTIPOLE ((MAX_MULTIPOLE_DEGREE+1)*(MAX_MULTIPOLE_DEGREE+1))
00038 
00039 #define MAX_MULTIPOLE_DEGREE_BASIC BASIS_FUNC_POLY_MAX_DEGREE
00040 #define MAX_NO_OF_MOMENTS_PER_MULTIPOLE_BASIC ((MAX_MULTIPOLE_DEGREE_BASIC+1)*(MAX_MULTIPOLE_DEGREE_BASIC+1))
00041 
00042 
00043 typedef struct
00044 {
00045   ergo_real centerCoords[3];
00046   int degree;
00047   int noOfMoments;
00048   ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE];
00049   ergo_real maxAbsMomentList[MAX_MULTIPOLE_DEGREE+1];
00050   ergo_real euclideanNormList[MAX_MULTIPOLE_DEGREE+1];
00051 } multipole_struct_large;
00052 
00053 typedef struct
00054 {
00055   ergo_real centerCoords[3];
00056   int degree;
00057   int noOfMoments;
00058   ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE_BASIC];
00059 } multipole_struct_small;
00060 
00061 
00062 int init_multipole_code();
00063 
00064 int
00065 compute_multipole_moments(const IntegralInfo& integralInfo,
00066                           const DistributionSpecStruct* distr,
00067                           multipole_struct_small* result);
00068 
00069 class MMTranslator {
00070   static const int MMDP1 = MAX_MULTIPOLE_DEGREE+1;
00071   ergo_real *buffer_W_cc;
00072   ergo_real *buffer_W_cs;
00073   ergo_real *buffer_W_sc;
00074   ergo_real *buffer_W_ss;
00075  public:
00076   MMTranslator();
00077   ~MMTranslator();
00078   int getTranslationMatrix(ergo_real dx,
00079                            ergo_real dy,
00080                            ergo_real dz,
00081                            int l_1,
00082                            int l_2,
00083                            ergo_real* result_W);
00084 };
00085 
00086 class MMInteractor {
00087   static const int MMDP1 = MAX_MULTIPOLE_DEGREE+1;
00088   ergo_real *buffer_T_cc;
00089   ergo_real *buffer_T_cs;
00090   ergo_real *buffer_T_sc;
00091   ergo_real *buffer_T_ss;
00092  public:
00093   MMInteractor();
00094   ~MMInteractor();
00095   int getInteractionMatrix(ergo_real dx,
00096                            ergo_real dy,
00097                            ergo_real dz,
00098                            int l_1,
00099                            int l_2,
00100                            ergo_real* result_T);
00101 };
00102 
00103 
00104 int
00105 setup_multipole_maxAbsMomentList(multipole_struct_large* multipole);
00106 
00107 #endif