QMCPACK
LatticeAnalyzer< T, 3 > Struct Template Reference

specialization for 3D lattice More...

+ Collaboration diagram for LatticeAnalyzer< T, 3 >:

Public Types

using SingleParticlePos = TinyVector< T, 3 >
 
using Tensor_t = Tensor< T, 3 >
 

Public Member Functions

int operator() (const TinyVector< int, 3 > &box)
 
bool isDiagonalOnly (const Tensor_t &R) const
 
SingleParticlePos calcSolidAngles (const TinyVector< SingleParticlePos, 3 > &Rv, const SingleParticlePos &OneOverLength)
 
calcWignerSeitzRadius (TinyVector< SingleParticlePos, 3 > &a)
 
calcSimulationCellRadius (TinyVector< SingleParticlePos, 3 > &a)
 

Public Attributes

int mySC
 SuperCell type. More...
 

Detailed Description

template<typename T>
struct qmcplusplus::LatticeAnalyzer< T, 3 >

specialization for 3D lattice

Definition at line 49 of file LatticeAnalyzer.h.

Member Typedef Documentation

◆ SingleParticlePos

Definition at line 51 of file LatticeAnalyzer.h.

◆ Tensor_t

using Tensor_t = Tensor<T, 3>

Definition at line 52 of file LatticeAnalyzer.h.

Member Function Documentation

◆ calcSimulationCellRadius()

T calcSimulationCellRadius ( TinyVector< SingleParticlePos, 3 > &  a)
inline

Definition at line 105 of file LatticeAnalyzer.h.

References qmcplusplus::Units::distance::A, qmcplusplus::abs(), B(), qmcplusplus::Units::charge::C, qmcplusplus::cross(), qmcplusplus::dot(), omptarget::min(), and qmcplusplus::sqrt().

106  {
107  T scr = 0.5 * std::numeric_limits<T>::max();
108  //if(mySC == SUPERCELL_BULK)
109  //{
110  for (int i = 0; i < 3; ++i)
111  {
112  SingleParticlePos A = a[i];
113  SingleParticlePos B = a[(i + 1) % 3];
114  SingleParticlePos C = a[(i + 2) % 3];
115  SingleParticlePos BxC = cross(B, C);
116  T dist = 0.5 * std::abs(dot(A, BxC)) / std::sqrt(dot(BxC, BxC));
117  scr = std::min(scr, dist);
118  }
119  //}
120  //else if(mySC == SUPERCELL_SLAB)
121  //{
122  // T a0mag = std::sqrt(dot(a[0],a[0]));
123  // T a1mag = std::sqrt(dot(a[1],a[1]));
124  // scr=0.5*std::min(a0mag,a1mag);
125  // //T dist = 0.5*std::abs(dot(A,BxC))/std::sqrt(dot(BxC,BxC));
126  // //T theta1 = dot (a[0], a[1])/(a0mag*a1mag);
127  // //T theta2 = M_PI - theta1;
128  // //T theta = std::min (theta1, theta2);
129  // //T dist = std::min (a0mag, a1mag);
130  // //scr=0.5*std::sin(theta)*dist;
131  // std::cout << " calcSimulationCellRadius for Slab" << std::endl;
132  //}
133  //else if(mySC == SUPERCELL_WIRE)
134  //{
135  // scr=0.5*std::sqrt(dot(a[0],a[0]));
136  //}
137  return scr;
138  }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
T min(T a, T b)
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > cross(const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
Definition: TinyVector.h:200
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
double B(double x, int k, int i, const std::vector< double > &t)

◆ calcSolidAngles()

SingleParticlePos calcSolidAngles ( const TinyVector< SingleParticlePos, 3 > &  Rv,
const SingleParticlePos OneOverLength 
)
inline

Definition at line 65 of file LatticeAnalyzer.h.

References qmcplusplus::acos(), and qmcplusplus::dot().

67  {
68  const T rad_to_deg = 180.0 / M_PI;
69  return SingleParticlePos(rad_to_deg * std::acos(dot(Rv[0], Rv[1]) * OneOverLength[0] * OneOverLength[1]),
70  rad_to_deg * std::acos(dot(Rv[1], Rv[2]) * OneOverLength[1] * OneOverLength[2]),
71  rad_to_deg * std::acos(dot(Rv[2], Rv[0]) * OneOverLength[2] * OneOverLength[0]));
72  }
MakeReturn< UnaryNode< FnArcCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t acos(const Vector< T1, C1 > &l)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ calcWignerSeitzRadius()

T calcWignerSeitzRadius ( TinyVector< SingleParticlePos, 3 > &  a)
inline

Definition at line 74 of file LatticeAnalyzer.h.

References qmcplusplus::dot(), omptarget::min(), qmcplusplus::SOA_OFFSET, qmcplusplus::sqrt(), qmcplusplus::SUPERCELL_BULK, qmcplusplus::SUPERCELL_SLAB, and qmcplusplus::SUPERCELL_WIRE.

75  {
76  T rMin = 0.5 * std::numeric_limits<T>::max();
77  if (mySC == SUPERCELL_BULK || mySC == SUPERCELL_BULK + SOA_OFFSET) //bulk type
78  {
79  for (int i = -1; i <= 1; i++)
80  for (int j = -1; j <= 1; j++)
81  for (int k = -1; k <= 1; k++)
82  if (i || j || k)
83  {
84  SingleParticlePos L = (static_cast<T>(i) * a[0] + static_cast<T>(j) * a[1] + static_cast<T>(k) * a[2]);
85  rMin = std::min(rMin, dot(L, L));
86  }
87  }
88  else if (mySC == SUPERCELL_SLAB || mySC == SUPERCELL_SLAB + SOA_OFFSET) //slab type
89  {
90  for (int i = -1; i <= 1; i++)
91  for (int j = -1; j <= 1; j++)
92  if (i || j)
93  {
94  SingleParticlePos L = (static_cast<T>(i) * a[0] + static_cast<T>(j) * a[1]);
95  rMin = std::min(rMin, dot(L, L));
96  }
97  }
98  else if (mySC == SUPERCELL_WIRE || mySC == SUPERCELL_WIRE + SOA_OFFSET) //wire
99  {
100  rMin = dot(a[0], a[0]);
101  }
102  return 0.5 * std::sqrt(rMin);
103  }
T min(T a, T b)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot(const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)

◆ isDiagonalOnly()

bool isDiagonalOnly ( const Tensor_t R) const
inline

Definition at line 58 of file LatticeAnalyzer.h.

References qmcplusplus::abs().

59  {
60  T offdiag = std::abs(R(0, 1)) + std::abs(R(0, 2)) + std::abs(R(1, 0)) + std::abs(R(1, 2)) + std::abs(R(2, 0)) +
61  std::abs(R(2, 1));
62  return (offdiag < std::numeric_limits<T>::epsilon());
63  }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)

◆ operator()()

int operator() ( const TinyVector< int, 3 > &  box)
inline

Definition at line 56 of file LatticeAnalyzer.h.

56 { return mySC = box[0] + 2 * (box[1] + box[2] * 2); }

Member Data Documentation

◆ mySC

int mySC

SuperCell type.

Definition at line 54 of file LatticeAnalyzer.h.


The documentation for this struct was generated from the following file: