JDFTx  1.2.0
ColumnBundleTransform.h
1 /*-------------------------------------------------------------------
2 Copyright 2014 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_ELECTRONIC_COLUMNBUNDLETRANSFORM_H
21 #define JDFTX_ELECTRONIC_COLUMNBUNDLETRANSFORM_H
22 
23 #include <electronic/Basis.h>
24 #include <electronic/matrix.h>
25 
28 {
29 public:
30  struct BasisWrapper
31  { BasisWrapper(const Basis& basis);
32  const Basis& basis;
35  std::vector<int> table;
36  };
37 
50  ColumnBundleTransform(const vector3<>& kC, const Basis& basisC, const vector3<>& kD, const BasisWrapper& basisDwrapper,
51  int nSpinor, const matrix3<int>& sym, int invert, const matrix3<int>& super = matrix3<int>(1,1,1));
53 
54  //Non-copyable:
56  ColumnBundleTransform& operator=(const ColumnBundleTransform&)=delete;
57 
58  void scatterAxpy(complex alpha, const ColumnBundle& C_C, int bC, ColumnBundle& C_D, int bD) const;
59  void gatherAxpy(complex alpha, const ColumnBundle& C_D, int bD, ColumnBundle& C_C, int bC) const;
60 
61  void scatterAxpy(complex alpha, const ColumnBundle& C_C, ColumnBundle& C_D, int bDstart, int bDstep) const;
62  void gatherAxpy(complex alpha, const ColumnBundle& C_D, int bDstart, int bDstep, ColumnBundle& C_C) const;
63 
64 private:
65  const Basis& basisC;
66  const Basis& basisD;
67  int nSpinor, invert;
68 
69  //Index array:
70  std::vector<int> index; int* indexPref;
71  #ifdef GPU_ENABLED
72  int* indexGpu;
73  #endif
74 
75  matrix spinorRot; //spinor space rotation
76 };
77 
78 #endif //JDFTX_ELECTRONIC_COLUMNBUNDLETRANSFORM_H
General complex matrix.
Definition: matrix.h:58
Definition: ColumnBundleTransform.h:30
vector3< int > pitch
pitch of each dimension in index look-up table
Definition: ColumnBundleTransform.h:34
Definition: Basis.h:29
std::vector< int > table
index look-up table
Definition: ColumnBundleTransform.h:35
vector3< int > iGbox
half-size of index look-up table
Definition: ColumnBundleTransform.h:33
void scatterAxpy(complex alpha, const ColumnBundle &C_C, int bC, ColumnBundle &C_D, int bD) const
scatter-accumulate a single column
void gatherAxpy(complex alpha, const ColumnBundle &C_D, int bD, ColumnBundle &C_C, int bC) const
gather-accumulate a single column
const Basis & basis
reference to underlying basis
Definition: ColumnBundleTransform.h:32
Complex number (need to define our own because we need operators for gpu code as well) ...
Definition: scalar.h:49
ColumnBundleTransform(const vector3<> &kC, const Basis &basisC, const vector3<> &kD, const BasisWrapper &basisDwrapper, int nSpinor, const matrix3< int > &sym, int invert, const matrix3< int > &super=matrix3< int >(1, 1, 1))
Handle transformation of ColumnBundles upon symmetry operations.
Definition: ColumnBundleTransform.h:27
Definition: ColumnBundle.h:30