QMCPACK
createDistanceTableAB.cpp
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: Ken Esler, kpesler@gmail.com, University of Illinois at Urbana-Champaign
8 // Jeremy McMinnis, jmcminis@gmail.com, University of Illinois at Urbana-Champaign
9 // Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
10 // Jaron T. Krogel, krogeljt@ornl.gov, Oak Ridge National Laboratory
11 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
12 //
13 // File created by: Jeongnim Kim, jeongnim.kim@gmail.com, University of Illinois at Urbana-Champaign
14 //////////////////////////////////////////////////////////////////////////////////////
15 
16 
18 #include "Particle/DistanceTable.h"
20 
21 namespace qmcplusplus
22 {
23 /** Adding AsymmetricDTD to the list, e.g., el-el distance table
24  *\param s source/target particle set
25  *\return index of the distance table with the name
26  */
27 std::unique_ptr<DistanceTable> createDistanceTableAB(const ParticleSet& s, ParticleSet& t, std::ostream& description)
28 {
30  enum
31  {
32  DIM = OHMMS_DIM
33  };
34  const int sc = t.getLattice().SuperCellEnum;
35  std::unique_ptr<DistanceTable> dt;
36  std::ostringstream o;
37  o << " Distance table for dissimilar particles (A-B):" << std::endl;
38  o << " source: " << s.getName() << " target: " << t.getName() << std::endl;
39  o << " Using structure-of-arrays (SoA) data layout" << std::endl;
40 
41  if (sc == SUPERCELL_BULK)
42  {
43  if (s.getLattice().DiagonalOnly)
44  {
45  o << " Distance computations use orthorhombic periodic cell in 3D." << std::endl;
46  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPO + SOA_OFFSET>>(s, t);
47  }
48  else
49  {
50  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
51  {
52  o << " Distance computations use general periodic cell in 3D with corner image checks." << std::endl;
53  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPG + SOA_OFFSET>>(s, t);
54  }
55  else
56  {
57  o << " Distance computations use general periodic cell in 3D without corner image checks." << std::endl;
58  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPS + SOA_OFFSET>>(s, t);
59  }
60  }
61  }
62  else if (sc == SUPERCELL_SLAB)
63  {
64  if (s.getLattice().DiagonalOnly)
65  {
66  o << " Distance computations use orthorhombic code for periodic cell in 2D." << std::endl;
67  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNO + SOA_OFFSET>>(s, t);
68  }
69  else
70  {
71  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
72  {
73  o << " Distance computations use general periodic cell in 2D with corner image checks." << std::endl;
74  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNG + SOA_OFFSET>>(s, t);
75  }
76  else
77  {
78  o << " Distance computations use general periodic cell in 2D without corner image checks." << std::endl;
79  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNS + SOA_OFFSET>>(s, t);
80  }
81  }
82  }
83  else if (sc == SUPERCELL_WIRE)
84  {
85  o << " Distance computations use periodic cell in one dimension." << std::endl;
86  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, SUPERCELL_WIRE + SOA_OFFSET>>(s, t);
87  }
88  else //open boundary condition
89  {
90  o << " Distance computations use open boundary conditions in 3D." << std::endl;
91  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, SUPERCELL_OPEN + SOA_OFFSET>>(s, t);
92  }
93 
94  description << o.str() << std::endl;
95  return dt;
96 }
97 
98 
99 } //namespace qmcplusplus
const std::string & getName() const
return the name
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
QTBase::RealType RealType
Definition: Configuration.h:58
#define OHMMS_DIM
Definition: config.h:64
Specialized paritlce class for atomistic simulations.
Definition: ParticleSet.h:55
std::unique_ptr< DistanceTable > createDistanceTableAB(const ParticleSet &s, ParticleSet &t, std::ostream &description)
free function create a distable table of s-t
const auto & getLattice() const
Definition: ParticleSet.h:251