QMCPACK
DTD_BConds< T, 3, PPNG+SOA_OFFSET > Struct Template Reference

specialization for a slab, general cell More...

+ Collaboration diagram for DTD_BConds< T, 3, PPNG+SOA_OFFSET >:

Public Member Functions

 DTD_BConds (const CrystalLattice< T, 3 > &lat)
 
template<typename PT , typename RSOA , typename DISPLSOA >
void computeDistances (const PT &pos, const RSOA &R0, T *restrict temp_r, DISPLSOA &temp_dr, int first, int last, int flip_ind=0) const
 
void computeDistancesOffload (const T pos[3], const T *restrict R0, int r0_stride, T *restrict temp_r, T *restrict temp_dr, int padded_size, int iat, int flip_ind=0) const
 
computeDist (T dx, T dy, T dz) const
 

Public Attributes

g00
 
g10
 
g01
 
g11
 
r00
 
r10
 
r01
 
r11
 
TinyVector< TinyVector< T, 3 >, 3 > rb
 
TinyVector< TinyVector< T, 4 >, 2 > corners
 

Detailed Description

template<class T>
struct qmcplusplus::DTD_BConds< T, 3, PPNG+SOA_OFFSET >

specialization for a slab, general cell

Definition at line 542 of file ParticleBConds3DSoa.h.

Constructor & Destructor Documentation

◆ DTD_BConds()

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

Definition at line 549 of file ParticleBConds3DSoa.h.

References CrystalLattice< T, D >::a(), and CrystalLattice< T, D >::G.

550  {
551  rb[0] = lat.a(0);
552  rb[1] = lat.a(1);
553  rb[2] = lat.a(2); //rb[2]=0.0;
554  r00 = rb[0][0];
555  r10 = rb[1][0];
556  r01 = rb[0][1];
557  r11 = rb[1][1];
558  g00 = lat.G(0);
559  g10 = lat.G(3);
560  g01 = lat.G(1);
561  g11 = lat.G(4);
562 
563  T minusone = -1.0;
564  for (int idim = 0; idim < 2; idim++)
565  {
566  auto& corners_dim = corners[idim];
567 
568  corners_dim[0] = T(0);
569  corners_dim[1] = minusone * (rb[0][idim]);
570  corners_dim[2] = minusone * (rb[1][idim]);
571  corners_dim[3] = minusone * (rb[0][idim] + rb[1][idim]);
572  }
573  }
TinyVector< TinyVector< T, 4 >, 2 > corners

Member Function Documentation

◆ computeDist()

T computeDist ( dx,
dy,
dz 
) const
inline

Definition at line 690 of file ParticleBConds3DSoa.h.

References qmcplusplus::floor(), and qmcplusplus::sqrt().

691  {
692  const auto& cellx = corners[0];
693  const auto& celly = corners[1];
694 
695  const T ar_0 = -std::floor(dx * g00 + dy * g10);
696  const T ar_1 = -std::floor(dx * g01 + dy * g11);
697 
698  const T delx = dx + ar_0 * r00 + ar_1 * r10;
699  const T dely = dy + ar_0 * r01 + ar_1 * r11;
700 
701  T rmin = delx * delx + dely * dely;
702 #pragma unroll(3)
703  for (int c = 1; c < 4; ++c)
704  {
705  const T x = delx + cellx[c];
706  const T y = dely + celly[c];
707  const T r2 = x * x + y * y;
708  rmin = (r2 < rmin) ? r2 : rmin;
709  }
710 
711  return std::sqrt(rmin + dz * dz);
712  }
TinyVector< TinyVector< T, 4 >, 2 > corners
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

◆ computeDistances()

void computeDistances ( const PT &  pos,
const RSOA &  R0,
T *restrict  temp_r,
DISPLSOA &  temp_dr,
int  first,
int  last,
int  flip_ind = 0 
) const
inline

Definition at line 576 of file ParticleBConds3DSoa.h.

References qmcplusplus::floor(), and qmcplusplus::sqrt().

583  {
584  const T x0 = pos[0];
585  const T y0 = pos[1];
586  const T z0 = pos[2];
587 
588  const T* restrict px = R0.data(0);
589  const T* restrict py = R0.data(1);
590  const T* restrict pz = R0.data(2);
591 
592  T* restrict dx = temp_dr.data(0);
593  T* restrict dy = temp_dr.data(1);
594  T* restrict dz = temp_dr.data(2);
595 
596  const auto& cellx = corners[0];
597  const auto& celly = corners[1];
598 
599  constexpr T minusone(-1);
600  constexpr T one(1);
601 #pragma omp simd aligned(temp_r, px, py, pz, dx, dy, dz: QMC_SIMD_ALIGNMENT)
602  for (int iat = first; iat < last; ++iat)
603  {
604  const T flip = iat < flip_ind ? one : minusone;
605  const T displ_0 = (px[iat] - x0) * flip;
606  const T displ_1 = (py[iat] - y0) * flip;
607  const T delz = pz[iat] - z0;
608 
609  const T ar_0 = -std::floor(displ_0 * g00 + displ_1 * g10);
610  const T ar_1 = -std::floor(displ_0 * g01 + displ_1 * g11);
611 
612  const T delx = displ_0 + ar_0 * r00 + ar_1 * r10;
613  const T dely = displ_1 + ar_0 * r01 + ar_1 * r11;
614 
615  T rmin = delx * delx + dely * dely;
616  int ic = 0;
617 #pragma unroll(3)
618  for (int c = 1; c < 4; ++c)
619  {
620  const T x = delx + cellx[c];
621  const T y = dely + celly[c];
622  const T r2 = x * x + y * y;
623  ic = (r2 < rmin) ? c : ic;
624  rmin = (r2 < rmin) ? r2 : rmin;
625  }
626 
627  temp_r[iat] = std::sqrt(rmin + delz * delz);
628  dx[iat] = flip * (delx + cellx[ic]);
629  dy[iat] = flip * (dely + celly[ic]);
630  dz[iat] = delz;
631  }
632  }
TinyVector< TinyVector< T, 4 >, 2 > corners
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

◆ computeDistancesOffload()

void computeDistancesOffload ( const T  pos[3],
const T *restrict  R0,
int  r0_stride,
T *restrict  temp_r,
T *restrict  temp_dr,
int  padded_size,
int  iat,
int  flip_ind = 0 
) const
inline

Definition at line 634 of file ParticleBConds3DSoa.h.

References qmcplusplus::floor(), and qmcplusplus::sqrt().

642  {
643  const T x0 = pos[0];
644  const T y0 = pos[1];
645  const T z0 = pos[2];
646 
647  const T* restrict px = R0;
648  const T* restrict py = R0 + r0_stride;
649  const T* restrict pz = R0 + r0_stride * 2;
650 
651  T* restrict dx = temp_dr;
652  T* restrict dy = temp_dr + padded_size;
653  T* restrict dz = temp_dr + padded_size * 2;
654 
655  const auto& cellx = corners[0];
656  const auto& celly = corners[1];
657 
658  constexpr T minusone(-1);
659  constexpr T one(1);
660 
661  const T flip = iat < flip_ind ? one : minusone;
662  const T displ_0 = (px[iat] - x0) * flip;
663  const T displ_1 = (py[iat] - y0) * flip;
664  const T delz = pz[iat] - z0;
665 
666  const T ar_0 = -std::floor(displ_0 * g00 + displ_1 * g10);
667  const T ar_1 = -std::floor(displ_0 * g01 + displ_1 * g11);
668 
669  const T delx = displ_0 + ar_0 * r00 + ar_1 * r10;
670  const T dely = displ_1 + ar_0 * r01 + ar_1 * r11;
671 
672  T rmin = delx * delx + dely * dely;
673  int ic = 0;
674 #pragma unroll(3)
675  for (int c = 1; c < 4; ++c)
676  {
677  const T x = delx + cellx[c];
678  const T y = dely + celly[c];
679  const T r2 = x * x + y * y;
680  ic = (r2 < rmin) ? c : ic;
681  rmin = (r2 < rmin) ? r2 : rmin;
682  }
683 
684  temp_r[iat] = std::sqrt(rmin + delz * delz);
685  dx[iat] = flip * (delx + cellx[ic]);
686  dy[iat] = flip * (dely + celly[ic]);
687  dz[iat] = delz;
688  }
TinyVector< TinyVector< T, 4 >, 2 > corners
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

Member Data Documentation

◆ corners

TinyVector<TinyVector<T, 4>, 2> corners

Definition at line 547 of file ParticleBConds3DSoa.h.

◆ g00

T g00

Definition at line 544 of file ParticleBConds3DSoa.h.

◆ g01

T g01

Definition at line 544 of file ParticleBConds3DSoa.h.

◆ g10

T g10

Definition at line 544 of file ParticleBConds3DSoa.h.

◆ g11

T g11

Definition at line 544 of file ParticleBConds3DSoa.h.

◆ r00

T r00

Definition at line 545 of file ParticleBConds3DSoa.h.

◆ r01

T r01

Definition at line 545 of file ParticleBConds3DSoa.h.

◆ r10

T r10

Definition at line 545 of file ParticleBConds3DSoa.h.

◆ r11

T r11

Definition at line 545 of file ParticleBConds3DSoa.h.

◆ rb

TinyVector<TinyVector<T, 3>, 3> rb

Definition at line 546 of file ParticleBConds3DSoa.h.


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