QMCPACK
KContainer.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef QMCPLUSPLUS_KCONTAINER_H
16 #define QMCPLUSPLUS_KCONTAINER_H
17 
18 #include "Configuration.h"
21 
22 namespace qmcplusplus
23 {
24 /** Container for k-points
25  *
26  * It generates a set of k-points that are unit-translations of the reciprocal-space
27  * cell. K-points are generated within a spherical cutoff set by the supercell
28  */
29 class KContainer : public QMCTraits
30 {
31 private:
32  /// The cutoff up to which k-vectors are generated.
34 
35 public:
36  //Typedef for the lattice-type
38 
39  ///number of k-points
40  int numk;
41 
42  /** maximum integer translations of reciprocal cell within kc.
43  *
44  * Last index is max. of first dimension+1
45  */
47 
48  /** K-vector in reduced coordinates
49  */
50  std::vector<TinyVector<int, DIM>> kpts;
51  /** K-vector in Cartesian coordinates
52  */
53  std::vector<PosType> kpts_cart;
54  /** squre of kpts in Cartesian coordniates
55  */
56  std::vector<RealType> ksq;
57  /** Given a k index, return index to -k
58  */
59  std::vector<int> minusk;
60  /** kpts which belong to the ith-shell [kshell[i], kshell[i+1]) */
61  std::vector<int> kshell;
62 
63  /** k points sorted by the |k| excluding |k|=0
64  *
65  * The first for |k|
66  * The second for a map to the full index. The size of the second is the degeneracy.
67  */
68  //std::map<int,std::vector<int>*> kpts_sorted;
69 
70  /** update k-vectors
71  * @param sc supercell
72  * @param kc cutoff radius in the K
73  * @param twist shifts the center of the grid of k-vectors
74  * @param useSphere if true, use the |K|
75  */
77  RealType kc,
78  unsigned ndim,
79  const PosType& twist = PosType(),
80  bool useSphere = true);
81 
82  const auto& get_kpts_cart_soa() const { return kpts_cart_soa_; }
83 
84 private:
85  /** compute approximate parallelpiped that surrounds kc
86  * @param lattice supercell
87  */
88  void findApproxMMax(const ParticleLayout& lattice, unsigned ndim);
89  /** construct the container for k-vectors */
90  void BuildKLists(const ParticleLayout& lattice, const PosType& twist, bool useSphere);
91 
92  /** K-vector in Cartesian coordinates in SoA layout
93  */
95 };
96 
97 } // namespace qmcplusplus
98 
99 #endif
a class that defines a supercell in D-dimensional Euclean space.
std::vector< PosType > kpts_cart
K-vector in Cartesian coordinates.
Definition: KContainer.h:53
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
VectorSoaContainer< RealType, DIM, OffloadAllocator< RealType > > kpts_cart_soa_
K-vector in Cartesian coordinates in SoA layout.
Definition: KContainer.h:94
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > ParticleLayout
Definition: Configuration.h:79
Soa Container for D-dim vectors.
SoA adaptor class for Vector<TinyVector<T,D> >
const auto & get_kpts_cart_soa() const
Definition: KContainer.h:82
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
RealType kcutoff
The cutoff up to which k-vectors are generated.
Definition: KContainer.h:33
PtclOnLatticeTraits::ParticleLayout ParticleLayout
Definition: KContainer.h:37
TinyVector< int, DIM+1 > mmax
maximum integer translations of reciprocal cell within kc.
Definition: KContainer.h:46
QTBase::PosType PosType
Definition: Configuration.h:61
Container for k-points.
Definition: KContainer.h:29
std::vector< int > kshell
kpts which belong to the ith-shell [kshell[i], kshell[i+1])
Definition: KContainer.h:61
void findApproxMMax(const ParticleLayout &lattice, unsigned ndim)
compute approximate parallelpiped that surrounds kc
Definition: KContainer.cpp:44
std::vector< int > minusk
Given a k index, return index to -k.
Definition: KContainer.h:59
std::vector< RealType > ksq
squre of kpts in Cartesian coordniates
Definition: KContainer.h:56
void updateKLists(const ParticleLayout &lattice, RealType kc, unsigned ndim, const PosType &twist=PosType(), bool useSphere=true)
k points sorted by the |k| excluding |k|=0
Definition: KContainer.cpp:24
traits for QMC variables
Definition: Configuration.h:49
std::vector< TinyVector< int, DIM > > kpts
K-vector in reduced coordinates.
Definition: KContainer.h:50
int numk
number of k-points
Definition: KContainer.h:40
void BuildKLists(const ParticleLayout &lattice, const PosType &twist, bool useSphere)
construct the container for k-vectors
Definition: KContainer.cpp:105