JDFTx  1.2.0
Basis.h
1 /*-------------------------------------------------------------------
2 Copyright 2011 Ravishankar Sundararaman
3 Copyright 1996-2003 Sohrab Ismail-Beigi
4 
5 This file is part of JDFTx.
6 
7 JDFTx is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 JDFTx is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
19 -------------------------------------------------------------------*/
20 
21 #ifndef JDFTX_ELECTRONIC_BASIS_H
22 #define JDFTX_ELECTRONIC_BASIS_H
23 
24 #include <electronic/common.h>
25 #include <core/vector3.h>
26 #include <core/GridInfo.h>
27 #include <vector>
28 
29 class Basis
30 {
31 public:
32  const GridInfo* gInfo;
33  const IonInfo* iInfo;
34 
35  size_t nbasis;
37  int *index;
38  #ifdef GPU_ENABLED
40  int *indexGpu;
41  #endif
42  int* indexPref;
44 
45  std::vector<int> head;
46 
47  Basis();
48  ~Basis();
49 
50  Basis(const Basis&);
51  Basis& operator=(const Basis&);
52 
54  void setup(const GridInfo& gInfo, const IonInfo& iInfo, double Ecut, const vector3<> k);
55 
57  void setup(const GridInfo& gInfo, const IonInfo& iInfo, const std::vector<int>& indexVec);
58 
59 private:
60  bool ownsData; //whether the pointers were allocated by this object and need to be freed
61  void setup(const GridInfo& gInfo, const IonInfo& iInfo,
62  const std::vector<int>& indexVec,
63  const std::vector< vector3<int> >& iGvec); //set the data arrays from vectors
64 };
65 
66 #endif // JDFTX_ELECTRONIC_BASIS_H
vector3< int > * iGarrPref
points to iGarrGpu in GPU mode and iGarr otherwise
Definition: Basis.h:43
vector3< int > * iGarr
the (integer) G-vectors for the basis in recip. lattice coords
Definition: Basis.h:36
Simulation grid descriptor.
Definition: GridInfo.h:45
Definition: IonInfo.h:46
const IonInfo * iInfo
pointer to the ion information (basis is conceptually ultrasoft-pseudopotential dependent) ...
Definition: Basis.h:33
int * indexPref
points to indexGpu in GPU mode and index otherwise
Definition: Basis.h:42
void setup(const GridInfo &gInfo, const IonInfo &iInfo, double Ecut, const vector3<> k)
Setup the indices and integer G-vectors within Ecut for kpoint k.
std::vector< int > head
short list of low G basis locations (used for phase fixing)
Definition: Basis.h:45
Definition: Basis.h:29
vector3< int > * iGarrGpu
GPU copy of G-vector index coefficients.
Definition: Basis.h:39
int * indexGpu
copy of index array on the GPU
Definition: Basis.h:40
const GridInfo * gInfo
pointer to the grid specs
Definition: Basis.h:32
size_t nbasis
number of basis elements (i.e. G-vectors)
Definition: Basis.h:35
Geometry of the simulation grid.
int * index
indices of the basis functions in the FFT boxes used
Definition: Basis.h:37
Basis & operator=(const Basis &)
copy by reference