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 BOX_SYSTEM_HEADER 00029 #define BOX_SYSTEM_HEADER 00030 00031 00032 #include "realtype.h" 00033 00034 00035 typedef struct 00036 { 00037 ergo_real centerCoords[3]; 00038 int originalIndex; 00039 } box_item_struct; 00040 00041 00042 typedef struct 00043 { 00044 ergo_real centerCoords[3]; 00045 ergo_real width; 00046 int noOfItems; 00047 int firstItemIndex; 00048 int noOfChildBoxes; 00049 int firstChildBoxIndex; 00050 } box_struct_basic; 00051 00052 typedef struct 00053 { 00054 int noOfBoxes; 00055 int startIndexInBoxList; 00056 } box_level_struct; 00057 00058 #define MAX_NO_OF_BOX_LEVELS 20 00059 00060 class BoxSystem 00061 { 00062 public: 00063 int totNoOfBoxes; 00064 int noOfLevels; 00065 box_level_struct levelList[MAX_NO_OF_BOX_LEVELS]; 00066 box_struct_basic* boxList; 00067 BoxSystem(); 00068 ~BoxSystem(); 00069 int create_box_system(box_item_struct* itemList, 00070 int noOfItems, 00071 ergo_real toplevelBoxSize); 00072 int get_items_near_point(const box_item_struct* itemList, 00073 const ergo_real* coords, 00074 ergo_real distance, 00075 int* resultOrgIndexList) const; 00076 private: 00077 int get_items_near_point_recursive(const box_item_struct* itemList, 00078 const ergo_real* coords, 00079 ergo_real distance, 00080 int* resultOrgIndexList, 00081 int level, 00082 int boxIndex) const; 00083 }; 00084 00085 00086 00087 00088 #endif