QMCPACK
HEGGrid.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: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
10 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
11 // Yubo "Paul" Yang, yubo.paul.yang@gmail.com, CCQ @ Flatiron
12 //
13 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
14 //////////////////////////////////////////////////////////////////////////////////////
15 
16 
17 #ifndef QMCPLUSPLUS_HEGGRID_H
18 #define QMCPLUSPLUS_HEGGRID_H
19 
20 #include "Lattice/CrystalLattice.h"
21 #include <array>
22 
23 namespace qmcplusplus
24 {
25 //three-d specialization
26 template<class T>
27 struct HEGGrid
28 {
30 
31  const PL_t& Lattice;
32  static constexpr std::array<int, 31> n_within_shell{1, 7, 19, 27, 33, 57, 81, 93, 123, 147, 171,
33  179, 203, 251, 257, 305, 341, 365, 389, 437, 461, 485,
34  515, 587, 619, 691, 739, 751, 799, 847, 895};
35 
36  HEGGrid(const PL_t& lat) : Lattice(lat) {}
37  ~HEGGrid() = default;
38 
39 
40  /** return the estimated number of grid in each direction */
41  inline int getNC(int nup) const { return static_cast<int>(std::pow(static_cast<T>(nup), 1.0 / 3.0)) / 2 + 1; }
42 
43  //return the number of k-points upto nsh-shell
44  inline int getNumberOfKpoints(int nsh) const
45  {
46  if (nsh < n_within_shell.size())
47  return n_within_shell[nsh];
48  else
49  return -1;
50  }
51 
52  //return the shell index for nkpt k-points
53  inline int getShellIndex(int nkpt) const
54  {
55  auto loc = std::upper_bound(n_within_shell.begin(), n_within_shell.end(), nkpt);
56  if (loc < n_within_shell.end())
57  return loc - n_within_shell.begin() - 1;
58  else
59  return getNC(nkpt);
60  }
61 
62  /** return the cell size for the number of particles and rs
63  * @param nptcl number of particles
64  * @param rs_in rs
65  */
66  inline T getCellLength(int nptcl, T rs_in) const { return std::pow(4.0 * M_PI * nptcl / 3.0, 1.0 / 3.0) * rs_in; }
67 };
68 
69 } // namespace qmcplusplus
70 #endif
a class that defines a supercell in D-dimensional Euclean space.
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
HEGGrid(const PL_t &lat)
Definition: HEGGrid.h:36
int getShellIndex(int nkpt) const
Definition: HEGGrid.h:53
static constexpr std::array< int, 31 > n_within_shell
Definition: HEGGrid.h:32
const PL_t & Lattice
Definition: HEGGrid.h:31
Declaration of CrystalLattice<T,D>
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
int getNC(int nup) const
return the estimated number of grid in each direction
Definition: HEGGrid.h:41
TinyVector< T, 3 > upper_bound(const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
helper function to determine the upper bound of a domain (need to move up)
int getNumberOfKpoints(int nsh) const
Definition: HEGGrid.h:44
T getCellLength(int nptcl, T rs_in) const
return the cell size for the number of particles and rs
Definition: HEGGrid.h:66