QMCPACK
DTD_BConds< T, 3, PPNX > Struct Template Reference

specialization for a slab, general cell More...

+ Collaboration diagram for DTD_BConds< T, 3, PPNX >:

Public Member Functions

 DTD_BConds (const CrystalLattice< T, 3 > &lat)
 
get_min_distance (TinyVector< T, 3 > &a) const
 evaluate the minimum distance More...
 
apply_bc (TinyVector< T, 3 > &displ) const
 apply BC to a displacement vector a and return the minimum-image distance More...
 
void apply_bc (std::vector< TinyVector< T, 3 >> &dr, std::vector< T > &r, std::vector< T > &rinv) const
 
void apply_bc (std::vector< TinyVector< T, 3 >> &dr, std::vector< T > &r) const
 
void evaluate_rsquared (TinyVector< T, 3 > *restrict dr, T *restrict rr, int n)
 

Public Attributes

r00
 
r10
 
r01
 
r11
 
g00
 
g10
 
g01
 
g11
 
r2max
 
std::vector< TinyVector< T, 3 > > nextcells
 

Detailed Description

template<class T>
struct qmcplusplus::DTD_BConds< T, 3, PPNX >

specialization for a slab, general cell

Definition at line 638 of file ParticleBConds3D.h.

Constructor & Destructor Documentation

◆ DTD_BConds()

DTD_BConds ( const CrystalLattice< T, 3 > &  lat)
inline

Definition at line 645 of file ParticleBConds3D.h.

646  : r00(lat.R(0)),
647  r10(lat.R(3)),
648  r01(lat.R(1)),
649  r11(lat.R(4)),
650  g00(lat.G(0)),
651  g10(lat.G(3)),
652  g01(lat.G(1)),
653  g11(lat.G(4)),
654  r2max(lat.CellRadiusSq)
655  {
656  nextcells.resize(8);
657  int ic = 0;
658  for (int i = -1; i <= 1; ++i)
659  for (int j = -1; j <= 1; ++j)
660  {
661  if (!(i || j))
662  continue; //exclude zero
663  nextcells[ic][0] = i * r00 + j * r10;
664  nextcells[ic][1] = i * r01 + j * r11;
665  nextcells[ic][2] = 0;
666  ++ic;
667  }
668  }
std::vector< TinyVector< T, 3 > > nextcells

Member Function Documentation

◆ apply_bc() [1/3]

T apply_bc ( TinyVector< T, 3 > &  displ) const
inline

apply BC to a displacement vector a and return the minimum-image distance

Parameters
latlattice
adisplacement vector
Returns
the minimum-image distance

Definition at line 708 of file ParticleBConds3D.h.

709  {
710  //cart2unit
711  TinyVector<T, 2> ar(displ[0] * g00 + displ[1] * g10, displ[0] * g01 + displ[1] * g11);
712  //put them in the box
713  ar[0] -= round(ar[0]);
714  ar[1] -= round(ar[1]);
715  //unit2cart
716  displ[0] = ar[0] * r00 + ar[1] * r10;
717  displ[1] = ar[0] * r01 + ar[1] * r11;
718  //return |displ|^2 after checking the ghost cells
719  return get_min_distance(displ);
720  }
T get_min_distance(TinyVector< T, 3 > &a) const
evaluate the minimum distance

◆ apply_bc() [2/3]

void apply_bc ( std::vector< TinyVector< T, 3 >> &  dr,
std::vector< T > &  r,
std::vector< T > &  rinv 
) const
inline

Definition at line 722 of file ParticleBConds3D.h.

References DTD_BConds< T, D, SC >::apply_bc(), qmcplusplus::simd::inv(), qmcplusplus::n, and qmcplusplus::simd::sqrt().

723  {
724  const int n = dr.size();
725  for (int i = 0; i < n; ++i)
726  rinv[i] = apply_bc(dr[i]);
727  simd::sqrt(&rinv[0], &r[0], n);
728  simd::inv(&r[0], &rinv[0], n);
729  }
T apply_bc(TinyVector< T, 3 > &displ) const
apply BC to a displacement vector a and return the minimum-image distance
void inv(const T *restrict in, T *restrict out, int n)
Definition: vmath.hpp:65
void sqrt(T *restrict inout, SIZET n)
Definition: vmath.hpp:52

◆ apply_bc() [3/3]

void apply_bc ( std::vector< TinyVector< T, 3 >> &  dr,
std::vector< T > &  r 
) const
inline

Definition at line 731 of file ParticleBConds3D.h.

References DTD_BConds< T, D, SC >::apply_bc().

732  {
733  for (int i = 0; i < dr.size(); ++i)
734  r[i] = apply_bc(dr[i]);
735  }
T apply_bc(TinyVector< T, 3 > &displ) const
apply BC to a displacement vector a and return the minimum-image distance

◆ evaluate_rsquared()

void evaluate_rsquared ( TinyVector< T, 3 > *restrict  dr,
T *restrict  rr,
int  n 
)
inline

Definition at line 737 of file ParticleBConds3D.h.

References DTD_BConds< T, D, SC >::apply_bc(), and qmcplusplus::n.

738  {
739  for (int i = 0; i < n; ++i)
740  rr[i] = apply_bc(dr[i]);
741  }
T apply_bc(TinyVector< T, 3 > &displ) const
apply BC to a displacement vector a and return the minimum-image distance

◆ get_min_distance()

T get_min_distance ( TinyVector< T, 3 > &  a) const
inline

evaluate the minimum distance

Parameters
latlattice
adisplacement vector $[-0.5,0.5)\times [-0.5,0.5)\times [-\infty,\infty)$
r2maxsquare of the maximum cutoff
Returns
square of the minimum-image distance

Search the ghost cells to match Wigner-Seitz cell

Definition at line 678 of file ParticleBConds3D.h.

679  {
680  T d2 = a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
681  if (d2 < r2max)
682  return d2;
683  else
684  {
685  T d2min = d2;
686  int ic = -1;
687  for (int i = 0; i < 8; ++i)
688  {
689  TinyVector<T, 3> c(a + nextcells[i]);
690  d2 = c[0] * c[0] + c[1] * c[1] + c[2] * c[2];
691  if (d2 < d2min)
692  {
693  d2min = d2;
694  ic = i;
695  }
696  }
697  if (ic >= 0)
698  a += nextcells[ic];
699  return d2min;
700  }
701  }
std::vector< TinyVector< T, 3 > > nextcells

Member Data Documentation

◆ g00

T g00

Definition at line 641 of file ParticleBConds3D.h.

◆ g01

T g01

Definition at line 641 of file ParticleBConds3D.h.

◆ g10

T g10

Definition at line 641 of file ParticleBConds3D.h.

◆ g11

T g11

Definition at line 641 of file ParticleBConds3D.h.

◆ nextcells

std::vector<TinyVector<T, 3> > nextcells

Definition at line 643 of file ParticleBConds3D.h.

◆ r00

T r00

Definition at line 640 of file ParticleBConds3D.h.

◆ r01

T r01

Definition at line 640 of file ParticleBConds3D.h.

◆ r10

T r10

Definition at line 640 of file ParticleBConds3D.h.

◆ r11

T r11

Definition at line 640 of file ParticleBConds3D.h.

◆ r2max

T r2max

Definition at line 642 of file ParticleBConds3D.h.


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