ergo
DistrBasisSetChunk.h
Go to the documentation of this file.
1 /* Ergo, version 3.3, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2013 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 #ifndef DISTR_BASIS_SET_CHUNK_HEADER
28 #define DISTR_BASIS_SET_CHUNK_HEADER
29 
30 #ifdef USE_CHUNKS_AND_TASKS
31 
32 #include "chunks_and_tasks.h"
33 #include "basisinfo.h"
34 
35 struct BoxStruct {
36  ergo_real minCoord[3];
37  ergo_real maxCoord[3];
38  BoxStruct() {
39  for(int i = 0; i < 3; i++) {
40  minCoord[i] = 0;
41  maxCoord[i] = 0;
42  }
43  }
44 };
45 
46 class DistrBasisSetChunk : public cht::Chunk {
47  public:
48  // Things required for a Chunk object
49  void writeToBuffer ( char * dataBuffer,
50  size_t const bufferSize ) const;
51  size_t getSize() const;
52  void assignFromBuffer ( char const * dataBuffer,
53  size_t const bufferSize);
54  size_t memoryUsage() const;
55  void getChildChunks(std::list<cht::ChunkID> & childChunkIDs) const;
56  // Other stuff
57  DistrBasisSetChunk() : noOfBasisFuncs(0) { }
58  DistrBasisSetChunk(const BasisInfoStruct & b, const BoxStruct & box)
59  : noOfBasisFuncs(b.noOfBasisFuncs), basisInfo(b), maxExtent(0), boundingBoxForCenters(box) { }
60  DistrBasisSetChunk(const BasisInfoStruct & b, const BoxStruct & box, const std::vector<int> indexList)
61  : noOfBasisFuncs(b.noOfBasisFuncs), basisInfo(b), maxExtent(0), boundingBoxForCenters(box), basisFuncIndexList(indexList) { }
62  DistrBasisSetChunk(const BasisInfoStruct & b, const BoxStruct & box, const std::vector<int> indexList, const std::vector<ergo_real> extentList)
63  : noOfBasisFuncs(b.noOfBasisFuncs), basisInfo(b), boundingBoxForCenters(box), basisFuncIndexList(indexList), basisFuncExtentList(extentList) {
64  maxExtent = 0;
65  for(int i = 0; i < basisFuncExtentList.size(); i++)
66  if(basisFuncExtentList[i] > maxExtent)
67  maxExtent = basisFuncExtentList[i];
68  }
69  DistrBasisSetChunk(int nBasisFuncs, const BoxStruct & box, ergo_real maxExtent_, cht::ChunkID cid_child1, cht::ChunkID cid_child2)
70  : noOfBasisFuncs(nBasisFuncs), boundingBoxForCenters(box), maxExtent(maxExtent_) {
71  cid_child_chunks[0] = cid_child1;
72  cid_child_chunks[1] = cid_child2;
73  }
74  // Data
75  int noOfBasisFuncs;
76  BasisInfoStruct basisInfo; // Used only at lowest level.
77  std::vector<int> basisFuncIndexList; // Used only at lowest level.
78  std::vector<ergo_real> basisFuncExtentList; // Used only at lowest level.
79  ergo_real maxExtent;
80  BoxStruct boundingBoxForCenters;
81  cht::ChunkID cid_child_chunks[2]; // Used if not lowest level.
82  // Mandatory chunk type declaration macro
83  CHT_CHUNK_TYPE_DECLARATION;
84 };
85 
86 #endif
87 #endif
double ergo_real
Definition: realtype.h:53
Definition: basisinfo.h:111
struct BoxStruct_ BoxStruct
Definition: cubature_rules.h:41
Definition: cubature_rules.h:37