Commit 274543bf authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Modify ghit(), cms() and incm() to use statically defined rac3j vectors

parent 70003c6d
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -141,19 +141,19 @@ void crsm1(double vk, double exri, ParticleDescriptor *c1);
 * This function computes the transfer vector going from N2 to N1, using either
 * Hankel, Bessel or Bessel from origin functions.
 *
 * \param ihi: `int`
 * \param ipamo: `int`
 * \param nbl: `int`
 * \param l1: `int`
 * \param m1: `int`
 * \param l2: `int`
 * \param m2: `int`
 * \param c1: `ParticleDescriptor *` Pointer to a ParticleDescriptor instance.
 * \param rac3j: `double *` J connection vector.
 * \param ihi: `int` Function mode. [IN]
 * \param ipamo: `int` [IN]
 * \param nbl: `int` Block identifier. [IN]
 * \param l1: `int` First L quantum number. [IN]
 * \param m1: `int` First M quantum number. [IN]
 * \param l2: `int` Second L quantum number. [IN]
 * \param m2: `int` Second M quantum number. [IN]
 * \param c1: `ParticleDescriptor *` Pointer to a ParticleDescriptor instance. [IN]
 * \param rac3j: `double[]` J connection vector. [IN/OUT]
 */
dcomplex ghit(
  int ihi, int ipamo, int nbl, int l1, int m1, int l2, int m2, ParticleDescriptor *c1,
  double *rac3j
  double rac3j[]
);

/**
+3 −4
Original line number Diff line number Diff line
@@ -553,6 +553,7 @@ void cms_gpu(dcomplex **am, ParticleDescriptor *c1) {
  const int ndi = nsph * nlim;
  const int max_litpo = 2 * li + 1;
  const int nsphmo = nsph - 1;
  const int lmtpo = c1->lmtpo;
  const np_int num_pairs = (nsph * (nsph - 1)) / 2;
  const np_int total_iters = num_pairs * li * max_litpo * li * max_litpo;
  const dcomplex cc0 = 0.0 + I * 0.0;
@@ -571,6 +572,7 @@ void cms_gpu(dcomplex **am, ParticleDescriptor *c1) {
#pragma omp parallel for
  for (np_int iter = 0; iter < total_iters; ++iter) {
    np_int t = iter;
    double rac3j[lmtpo];

    // Index calculation (from innermost to outermost)
    int im2 = (t % max_litpo) + 1;
@@ -618,8 +620,6 @@ void cms_gpu(dcomplex **am, ParticleDescriptor *c1) {
    int j2e = (is_valid_iter) ? in1 + ilm2e : 0;
    // End of index 2 magnetic quantum numbers
    dcomplex cgh, cgk;
    double *rac3j = new double[c1->lmtpo];
    memcpy(rac3j, c1->rac3j, c1->lmtpo * sizeof(double));
    cgh = (is_valid_iter) ?
      ghit(0, 0, nbl, l1, m1, l2, m2, c1, rac3j) :
      cc0;
@@ -636,7 +636,6 @@ void cms_gpu(dcomplex **am, ParticleDescriptor *c1) {
      am[j1e - 1][j2 - 1] = cgk * rsk;
      am[j1e - 1][j2e - 1] = cgh * rsh;
    }
    delete[] rac3j;
  }

  delete[] lut_n1;
@@ -794,7 +793,7 @@ void crsm1(double vk, double exri, ParticleDescriptor *c1) {

dcomplex ghit(
  int ihi, int ipamo, int nbl, int l1, int m1, int l2, int m2, ParticleDescriptor *c1,
  double *rac3j
  double rac3j[]
) {
  /* NBL identifies transfer vector going from N2 to N1;
   * IHI=0 for Hankel, IHI=1 for Bessel, IHI=2 for Bessel from origin;
+2 −1
Original line number Diff line number Diff line
@@ -95,8 +95,9 @@ void exma(dcomplex **am, ParticleDescriptor *c1) {

void incms(dcomplex **am, double enti, ParticleDescriptor *c1) {
  const dcomplex cc0 = 0.0 + I * 0.0;
  const int lmtpo = c1->lmtpo;
  dcomplex **at = c1->at;
  double *rac3j = c1->rac3j;
  double rac3j[lmtpo];
  int nbl, i1;
  const int ndi = c1->ndi;
  const int ndit = ndi + ndi;