seams-core v2.14.0
libyodaLib, the C++ engine of d-SEAMS
Loading...
Searching...
No Matches
ylm_batch.hpp
Go to the documentation of this file.
1#ifndef SEAMS_YLM_BATCH_H_
2#define SEAMS_YLM_BATCH_H_
3
4#include <ylm_cartesian.hpp>
5
6namespace seams {
7namespace ylm {
8
9// ylm_cartesian_avx512.cpp is compiled with -mavx512f -mavx512dq -mfma, so
10// any instruction in it may need all three. True when the build has that
11// file, the CPU reports all three and seams::cpu::allowSimdKernels has not
12// turned it off. ylm12AddBonds, ylmAdd8 and ylmSumRows4 are called only
13// after this returns true; ylmBatch and ylmLocalQl ask it themselves. The
14// scalar path gives the same values.
16
17// Add up to eight l = 12 bonds into one interleaved q_lm row (real, imag).
18// n is 1..8. Shorter tails do not contribute. Same values as the scalar
19// solid harmonic.
20void ylm12AddBonds(const double *dx, const double *dy, const double *dz, int n,
21 double *qlmInterleaved);
22
23// Bond-major output: component m of bond b is at b * (2 * orderL + 1) + m.
24// Host only. l is 3, 4 or 6.
25void ylmBatch(int orderL, const double *dx, const double *dy, const double *dz,
26 int n, double *re, double *im);
27
28// Eight bonds, AVX-512. The first four sum into accA and the next four
29// into accB. Each accumulator is interleaved real, imag, length
30// 2 * (2 * l + 1). l is 4 or 6. The recurrence is the Cartesian
31// polynomial, not a trigonometric Y_lm.
32void ylmAdd8(int orderL, const double *dx, const double *dy, const double *dz,
33 double *accA, double *accB);
34
35// Eight atoms, four bonds each. dx, dy and dz are 4 * 8 values, bond
36// slot in the outer index, and each group of eight is 64-byte aligned.
37// The solid harmonics stay in SoA while the four bonds are added, then
38// one blocked transpose writes atom a at rows[a * stride + 2 * m].
39// l is 4 or 6. nKeep leading components are written (m = -l upward).
40// The positive orders are the conjugate partners of those and are not
41// stored. Returns false if any bond has zero length.
42bool ylmSumRows4(int orderL, const double *dx, const double *dy,
43 const double *dz, double *rows, int stride, int nKeep);
44
45// Eight atoms, a variable shell. dx/dy/dz are bond-major, nbonds groups
46// of eight. nUsed[a] is the number of leading live bonds of atom a;
47// a later slot is zero and is not summed. Writes ql[8] for l = 4 or 6.
48// The sum is the same Cartesian solid harmonic as ylmSumRows4, added in
49// bond order, then divided by nUsed.
50bool ylmLocalQl(int orderL, const double *dx, const double *dy, const double *dz,
51 int nbonds, const int *nUsed, double prefactor, double *ql);
52
53} // namespace ylm
54} // namespace seams
55
56#endif
void ylmAdd8(int orderL, const double *dx, const double *dy, const double *dz, double *accA, double *accB)
void ylm12AddBonds(const double *dx, const double *dy, const double *dz, int n, double *qlmInterleaved)
bool ylmSumRows4(int orderL, const double *dx, const double *dy, const double *dz, double *rows, int stride, int nKeep)
bool ylmLocalQl(int orderL, const double *dx, const double *dy, const double *dz, int nbonds, const int *nUsed, double prefactor, double *ql)
bool avx512Kernels()
void ylmBatch(int orderL, const double *dx, const double *dy, const double *dz, int n, double *re, double *im)