PmeKSpace.C File Reference

#include "PmeKSpace.h"
#include <math.h>
#include <stdlib.h>
#include <alloca.h>
#include "PmeBase.inl"
#include "SimParameters.h"
#include "Node.h"
#include "ComputeMoaMgr.decl.h"

Go to the source code of this file.

Defines

#define ALLOCA(TYPE, NAME, SIZE)   TYPE *NAME = (TYPE *) alloca((SIZE)*sizeof(TYPE))

Functions

static void dftmod (double *bsp_mod, double *bsp_arr, int nfft)
void compute_b_moduli (double *bm, int K, int order)
static void compute_energy_orthogonal_ckloop (int first, int last, void *result, int paraNum, void *param)


Define Documentation

#define ALLOCA ( TYPE,
NAME,
SIZE   )     TYPE *NAME = (TYPE *) alloca((SIZE)*sizeof(TYPE))

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 20 of file PmeKSpace.C.

Referenced by ProxyMgr::recvNodeAwareSpanningTree().


Function Documentation

void compute_b_moduli ( double *  bm,
int  K,
int  order 
)

Definition at line 42 of file PmeKSpace.C.

References compute_b_spline(), and dftmod().

Referenced by PmeKSpace::PmeKSpace(), and PmeKSpaceCompute::PmeKSpaceCompute().

00042                                                     {
00043   int i;
00044   double fr[3];
00045 
00046   double *M = new double[3*order];
00047   double *dM = new double[3*order];
00048   double *scratch = new double[K];
00049 
00050   fr[0]=fr[1]=fr[2]=0.0;
00051   compute_b_spline(fr,M,dM,order);  
00052   for (i=0; i<order; i++) bm[i] = M[i];
00053   for (i=order; i<K; i++) bm[i] = 0.0;
00054   dftmod(scratch, bm, K);
00055   for (i=0; i<K; i++) bm[i] = 1.0/scratch[i];
00056 
00057 
00058   delete [] scratch;
00059   delete [] dM;
00060   delete [] M;
00061 }

static void compute_energy_orthogonal_ckloop ( int  first,
int  last,
void *  result,
int  paraNum,
void *  param 
) [inline, static]

Definition at line 214 of file PmeKSpace.C.

References PmeKSpace::compute_energy_orthogonal_subset().

00214                                                                                                                 {
00215   for ( int i = first; i <= last; ++i ) {
00216     void **params = (void **)param;
00217     PmeKSpace *kspace = (PmeKSpace *)params[0];
00218     float *q_arr = (float *)params[1];
00219     double *recips = (double *)params[2];
00220     double *partialEnergy = (double *)params[3];
00221     double *partialVirial = (double *)params[4];
00222     int *unitDist = (int *)params[5];
00223     
00224     int unit = unitDist[0];
00225     int remains = unitDist[1];
00226     int k1from, k1to;
00227     if(i<remains){
00228         k1from = i*(unit+1);
00229         k1to = k1from+unit;
00230     }else{
00231         k1from = remains*(unit+1)+(i-remains)*unit;
00232         k1to = k1from+unit-1;
00233     }
00234     double *pEnergy = partialEnergy+i;
00235     double *pVirial = partialVirial+i*6;
00236     kspace->compute_energy_orthogonal_subset(q_arr, recips, pVirial, pEnergy, k1from, k1to);
00237   }
00238 }

static void dftmod ( double *  bsp_mod,
double *  bsp_arr,
int  nfft 
) [static]

Definition at line 22 of file PmeKSpace.C.

References j, and M_PI.

Referenced by compute_b_moduli().

00022                                                                {
00023   int j, k;
00024   double twopi, arg, sum1, sum2;
00025   double infft = 1.0/nfft;
00026 /* Computes the modulus of the discrete fourier transform of bsp_arr, */
00027 /*  storing it into bsp_mod */
00028   twopi =  2.0 * M_PI;
00029 
00030   for (k = 0; k <nfft; ++k) {
00031     sum1 = 0.;
00032     sum2 = 0.;
00033     for (j = 0; j < nfft; ++j) {
00034       arg = twopi * k * j * infft;
00035       sum1 += bsp_arr[j] * cos(arg);
00036       sum2 += bsp_arr[j] * sin(arg);
00037     }
00038     bsp_mod[k] = sum1*sum1 + sum2*sum2;
00039   }
00040 }


Generated on Wed Nov 22 01:17:18 2017 for NAMD by  doxygen 1.4.7