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

specialization for a periodic 3D general cell More...

+ Collaboration diagram for DTD_BConds< T, 3, PPPG+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
 
g20
 
g01
 
g11
 
g21
 
g02
 
g12
 
g22
 
r00
 
r10
 
r20
 
r01
 
r11
 
r21
 
r02
 
r12
 
r22
 
TinyVector< TinyVector< T, 8 >, 3 > corners
 

Detailed Description

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

specialization for a periodic 3D general cell

Wigner-Seitz cell radius > simulation cell radius Need to check image cells

Definition at line 328 of file ParticleBConds3DSoa.h.

Constructor & Destructor Documentation

◆ DTD_BConds()

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

Definition at line 334 of file ParticleBConds3DSoa.h.

References CrystalLattice< T, D >::a(), qmcplusplus::find_reduced_basis(), and qmcplusplus::inverse().

335  {
337  rb[0] = lat.a(0);
338  rb[1] = lat.a(1);
339  rb[2] = lat.a(2);
340  find_reduced_basis(rb);
341 
342  r00 = rb[0][0];
343  r10 = rb[1][0];
344  r20 = rb[2][0];
345  r01 = rb[0][1];
346  r11 = rb[1][1];
347  r21 = rb[2][1];
348  r02 = rb[0][2];
349  r12 = rb[1][2];
350  r22 = rb[2][2];
351 
352  Tensor<T, 3> rbt;
353  for (int i = 0; i < 3; ++i)
354  for (int j = 0; j < 3; ++j)
355  rbt(i, j) = rb[i][j];
356  Tensor<T, 3> g = inverse(rbt);
357 
358  g00 = g(0);
359  g10 = g(3);
360  g20 = g(6);
361  g01 = g(1);
362  g11 = g(4);
363  g21 = g(7);
364  g02 = g(2);
365  g12 = g(5);
366  g22 = g(8);
367 
368  constexpr T minusone(-1);
369  constexpr T zero(0);
370 
371  for (int idim = 0; idim < 3; idim++)
372  {
373  auto& corners_dim = corners[idim];
374 
375  corners_dim[0] = zero;
376  corners_dim[1] = minusone * (rb[0][idim]);
377  corners_dim[2] = minusone * (rb[1][idim]);
378  corners_dim[3] = minusone * (rb[2][idim]);
379  corners_dim[4] = minusone * (rb[0][idim] + rb[1][idim]);
380  corners_dim[5] = minusone * (rb[0][idim] + rb[2][idim]);
381  corners_dim[6] = minusone * (rb[1][idim] + rb[2][idim]);
382  corners_dim[7] = minusone * (rb[0][idim] + rb[1][idim] + rb[2][idim]);
383  }
384  }
TinyVector< TinyVector< T, 8 >, 3 > corners
void find_reduced_basis(TinyVector< TinyVector< T, 3 >, 3 > &rb)
Tensor< T, D > inverse(const Tensor< T, D > &a)
Definition: TensorOps.h:879

Member Function Documentation

◆ computeDist()

T computeDist ( dx,
dy,
dz 
) const
inline

Definition at line 509 of file ParticleBConds3DSoa.h.

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

510  {
511  const auto& cellx = corners[0];
512  const auto& celly = corners[1];
513  const auto& cellz = corners[2];
514 
515  const T ar_0 = -std::floor(dx * g00 + dy * g10 + dz * g20);
516  const T ar_1 = -std::floor(dx * g01 + dy * g11 + dz * g21);
517  const T ar_2 = -std::floor(dx * g02 + dy * g12 + dz * g22);
518 
519  const T delx = dx + ar_0 * r00 + ar_1 * r10 + ar_2 * r20;
520  const T dely = dy + ar_0 * r01 + ar_1 * r11 + ar_2 * r21;
521  const T delz = dz + ar_0 * r02 + ar_1 * r12 + ar_2 * r22;
522 
523  T rmin = delx * delx + dely * dely + delz * delz;
524 #pragma unroll(7)
525  for (int c = 1; c < 8; ++c)
526  {
527  const T x = delx + cellx[c];
528  const T y = dely + celly[c];
529  const T z = delz + cellz[c];
530  const T r2 = x * x + y * y + z * z;
531  rmin = (r2 < rmin) ? r2 : rmin;
532  }
533 
534  return std::sqrt(rmin);
535  }
TinyVector< TinyVector< T, 8 >, 3 > 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 387 of file ParticleBConds3DSoa.h.

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

394  {
395  const T x0 = pos[0];
396  const T y0 = pos[1];
397  const T z0 = pos[2];
398 
399  const T* restrict px = R0.data(0);
400  const T* restrict py = R0.data(1);
401  const T* restrict pz = R0.data(2);
402 
403  T* restrict dx = temp_dr.data(0);
404  T* restrict dy = temp_dr.data(1);
405  T* restrict dz = temp_dr.data(2);
406 
407  const auto& cellx = corners[0];
408  const auto& celly = corners[1];
409  const auto& cellz = corners[2];
410 
411  constexpr T minusone(-1);
412  constexpr T one(1);
413 #pragma omp simd aligned(temp_r, px, py, pz, dx, dy, dz: QMC_SIMD_ALIGNMENT)
414  for (int iat = first; iat < last; ++iat)
415  {
416  const T flip = iat < flip_ind ? one : minusone;
417  const T displ_0 = (px[iat] - x0) * flip;
418  const T displ_1 = (py[iat] - y0) * flip;
419  const T displ_2 = (pz[iat] - z0) * flip;
420 
421  const T ar_0 = -std::floor(displ_0 * g00 + displ_1 * g10 + displ_2 * g20);
422  const T ar_1 = -std::floor(displ_0 * g01 + displ_1 * g11 + displ_2 * g21);
423  const T ar_2 = -std::floor(displ_0 * g02 + displ_1 * g12 + displ_2 * g22);
424 
425  const T delx = displ_0 + ar_0 * r00 + ar_1 * r10 + ar_2 * r20;
426  const T dely = displ_1 + ar_0 * r01 + ar_1 * r11 + ar_2 * r21;
427  const T delz = displ_2 + ar_0 * r02 + ar_1 * r12 + ar_2 * r22;
428 
429  T rmin = delx * delx + dely * dely + delz * delz;
430  int ic = 0;
431 #pragma unroll(7)
432  for (int c = 1; c < 8; ++c)
433  {
434  const T x = delx + cellx[c];
435  const T y = dely + celly[c];
436  const T z = delz + cellz[c];
437  const T r2 = x * x + y * y + z * z;
438  ic = (r2 < rmin) ? c : ic;
439  rmin = (r2 < rmin) ? r2 : rmin;
440  }
441 
442  temp_r[iat] = std::sqrt(rmin);
443  dx[iat] = flip * (delx + cellx[ic]);
444  dy[iat] = flip * (dely + celly[ic]);
445  dz[iat] = flip * (delz + cellz[ic]);
446  }
447  }
TinyVector< TinyVector< T, 8 >, 3 > 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 449 of file ParticleBConds3DSoa.h.

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

457  {
458  const T x0 = pos[0];
459  const T y0 = pos[1];
460  const T z0 = pos[2];
461 
462  const T* restrict px = R0;
463  const T* restrict py = R0 + r0_stride;
464  const T* restrict pz = R0 + r0_stride * 2;
465 
466  T* restrict dx = temp_dr;
467  T* restrict dy = temp_dr + padded_size;
468  T* restrict dz = temp_dr + padded_size * 2;
469 
470  const auto& cellx = corners[0];
471  const auto& celly = corners[1];
472  const auto& cellz = corners[2];
473 
474  constexpr T minusone(-1);
475  constexpr T one(1);
476 
477  const T flip = iat < flip_ind ? one : minusone;
478  const T displ_0 = (px[iat] - x0) * flip;
479  const T displ_1 = (py[iat] - y0) * flip;
480  const T displ_2 = (pz[iat] - z0) * flip;
481 
482  const T ar_0 = -std::floor(displ_0 * g00 + displ_1 * g10 + displ_2 * g20);
483  const T ar_1 = -std::floor(displ_0 * g01 + displ_1 * g11 + displ_2 * g21);
484  const T ar_2 = -std::floor(displ_0 * g02 + displ_1 * g12 + displ_2 * g22);
485 
486  const T delx = displ_0 + ar_0 * r00 + ar_1 * r10 + ar_2 * r20;
487  const T dely = displ_1 + ar_0 * r01 + ar_1 * r11 + ar_2 * r21;
488  const T delz = displ_2 + ar_0 * r02 + ar_1 * r12 + ar_2 * r22;
489 
490  T rmin = delx * delx + dely * dely + delz * delz;
491  int ic = 0;
492 #pragma unroll(7)
493  for (int c = 1; c < 8; ++c)
494  {
495  const T x = delx + cellx[c];
496  const T y = dely + celly[c];
497  const T z = delz + cellz[c];
498  const T r2 = x * x + y * y + z * z;
499  ic = (r2 < rmin) ? c : ic;
500  rmin = (r2 < rmin) ? r2 : rmin;
501  }
502 
503  temp_r[iat] = std::sqrt(rmin);
504  dx[iat] = flip * (delx + cellx[ic]);
505  dy[iat] = flip * (dely + celly[ic]);
506  dz[iat] = flip * (delz + cellz[ic]);
507  }
TinyVector< TinyVector< T, 8 >, 3 > 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, 8>, 3> corners

Definition at line 332 of file ParticleBConds3DSoa.h.

◆ g00

T g00

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g01

T g01

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g02

T g02

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g10

T g10

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g11

T g11

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g12

T g12

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g20

T g20

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g21

T g21

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ g22

T g22

Definition at line 330 of file ParticleBConds3DSoa.h.

◆ r00

T r00

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r01

T r01

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r02

T r02

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r10

T r10

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r11

T r11

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r12

T r12

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r20

T r20

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r21

T r21

Definition at line 331 of file ParticleBConds3DSoa.h.

◆ r22

T r22

Definition at line 331 of file ParticleBConds3DSoa.h.


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