PSCF v1.1
WaveList.h
1#ifndef PSPG_WAVE_LIST_H
2#define PSPG_WAVE_LIST_H
3/*
4* PSCF - Polymer Self-Consistent Field Theory
5*
6* Copyright 2016 - 2022, The Regents of the University of Minnesota
7* Distributed under the terms of the GNU General Public License.
8*/
9
10#include <pscf/math/IntVec.h>
11#include <pspg/field/RDFieldDft.h>
12#include <pspg/field/RDField.h>
13#include <pscf/mesh/MeshIterator.h>
14#include <pscf/mesh/Mesh.h>
15#include <pscf/crystal/shiftToMinimum.h>
16#include <pscf/crystal/UnitCell.h>
17#include <util/containers/DArray.h>
18#include <util/containers/GArray.h>
19#include <util/containers/DMatrix.h>
20
21namespace Pscf {
22namespace Pspg
23{
24
25 using namespace Util;
26
30 template <int D>
31 class WaveList{
32 public:
33
37 WaveList();
38
42 ~WaveList();
43
50 void allocate(Mesh<D> const & mesh,
51 UnitCell<D> const & unitCell);
52
62 void computeMinimumImages(Mesh<D> const & mesh,
63 UnitCell<D> const & unitCell);
64
75 void computeKSq(UnitCell<D> const & unitCell);
76
84 void computedKSq(UnitCell<D> const & unitCell);
85
91 const IntVec<D>& minImage(int i) const;
92
96 cudaReal* kSq() const;
97
101 cudaReal* dkSq() const;
102
106 int kSize() const;
107
108 bool isAllocated() const
109 { return isAllocated_; }
110
111 bool hasMinimumImages() const
112 { return hasMinimumImages_; }
113
114 private:
115
116 // Bare C array holding precomputed minimum images
117 int* minImage_d;
118
119 // Bare C array holding values of kSq_
120 cudaReal* kSq_;
121
122 // Bare C array holding values of dkSq_
123 cudaReal* dkSq_;
124
125 cudaReal* dkkBasis_d;
126 cudaReal* dkkBasis;
127
128 int* partnerIdTable;
129 int* partnerIdTable_d;
130
131 int* selfIdTable;
132 int* selfIdTable_d;
133
134 bool* implicit;
135 bool* implicit_d;
136
137 IntVec<D> dimensions_;
138 int kSize_;
139 int rSize_;
140 int nParams_;
141
142 DArray< IntVec<D> > minImage_;
143
144 bool isAllocated_;
145
146 bool hasMinimumImages_;
147
148 };
149
150 template <int D>
151 inline const IntVec<D>& WaveList<D>::minImage(int i) const
152 { return minImage_[i]; }
153
154 template <int D>
155 inline cudaReal* WaveList<D>::kSq() const
156 { return kSq_; }
157
158 template <int D>
159 inline cudaReal* WaveList<D>::dkSq() const
160 { return dkSq_; }
161
162 template <int D>
163 inline int WaveList<D>::kSize() const
164 { return kSize_; }
165
166 #ifndef PSPG_WAVE_LIST_TPP
167 // Suppress implicit instantiation
168 extern template class WaveList<1>;
169 extern template class WaveList<2>;
170 extern template class WaveList<3>;
171 #endif
172
173}
174}
175//#include "WaveList.tpp"
176#endif
An IntVec<D, T> is a D-component vector of elements of integer type T.
Definition: IntVec.h:27
Description of a regular grid of points in a periodic domain.
Definition: Mesh.h:61
Container for wavevector data.
Definition: WaveList.h:31
WaveList()
Constructor.
Definition: WaveList.tpp:79
cudaReal * dkSq() const
Get a pointer to the dkSq array on device.
Definition: WaveList.h:159
void computeMinimumImages(Mesh< D > const &mesh, UnitCell< D > const &unitCell)
Compute minimum images of wavevectors.
Definition: WaveList.tpp:172
void computeKSq(UnitCell< D > const &unitCell)
Compute square norm |k|^2 for all wavevectors.
Definition: WaveList.tpp:280
~WaveList()
Destructor.
Definition: WaveList.tpp:103
const IntVec< D > & minImage(int i) const
Get the minimum image vector for a specified wavevector.
Definition: WaveList.h:151
void computedKSq(UnitCell< D > const &unitCell)
Compute derivatives of |k|^2 w/ respect to unit cell parameters.
Definition: WaveList.tpp:285
cudaReal * kSq() const
Get a pointer to the kSq array on device.
Definition: WaveList.h:155
void allocate(Mesh< D > const &mesh, UnitCell< D > const &unitCell)
Allocate memory for all arrays.
Definition: WaveList.tpp:117
int kSize() const
Get size of k-grid (number of wavewavectors).
Definition: WaveList.h:163
Base template for UnitCell<D> classes, D=1, 2 or 3.
Definition: UnitCell.h:44
Dynamically allocatable contiguous array template.
Definition: DArray.h:32
C++ namespace for polymer self-consistent field theory (PSCF).
Utility classes for scientific computation.
Definition: accumulators.mod:1