NAMD
Public Member Functions | List of all members
PmeRealSpace Class Reference

#include <PmeRealSpace.h>

Public Member Functions

 PmeRealSpace (PmeGrid grid)
 
 ~PmeRealSpace ()
 
void set_num_atoms (int natoms)
 
void fill_charges (float **q_arr, float **q_arr_list, int &q_arr_count, int &stray_count, char *f_arr, char *fz_arr, PmeParticle p[])
 
void compute_forces (const float *const *q_arr, const PmeParticle p[], Vector f[])
 
void compute_forces_order4_partial (int first, int last, const float *const *q_arr, const PmeParticle p[], Vector f[])
 

Detailed Description

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

Definition at line 14 of file PmeRealSpace.h.

Constructor & Destructor Documentation

PmeRealSpace::PmeRealSpace ( PmeGrid  grid)

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

Definition at line 13 of file PmeRealSpace.C.

14  : myGrid(grid) {
15 }
PmeRealSpace::~PmeRealSpace ( )

Definition at line 17 of file PmeRealSpace.C.

17  {
18 }

Member Function Documentation

void PmeRealSpace::compute_forces ( const float *const *  q_arr,
const PmeParticle  p[],
Vector  f[] 
)

Definition at line 141 of file PmeRealSpace.C.

References NAMD_die(), and PmeGrid::order.

Referenced by ComputePme::ungridForces().

142  {
143 
144  switch (myGrid.order) {
145  case 4:
146  compute_forces_order4(q_arr, p, f);
147  break;
148  case 6:
149  compute_forces_order<6>(q_arr, p, f);
150  break;
151  case 8:
152  compute_forces_order<8>(q_arr, p, f);
153  break;
154  case 10:
155  compute_forces_order<10>(q_arr, p, f);
156  break;
157  default: NAMD_die("unsupported PMEInterpOrder");
158  }
159 
160 }
int order
Definition: PmeBase.h:20
void NAMD_die(const char *err_msg)
Definition: common.C:83
void PmeRealSpace::compute_forces_order4_partial ( int  first,
int  last,
const float *const *  q_arr,
const PmeParticle  p[],
Vector  f[] 
)

Definition at line 426 of file PmeRealSpace.C.

References PmeParticle::cg, PmeGrid::dim2, PmeGrid::K1, PmeGrid::K2, PmeGrid::K3, order, Vector::x, Vector::y, and Vector::z.

Referenced by compute_forces_order4_helper().

428  {
429 
430  int i, j, k, l, stride;
431  float f1, f2, f3;
432  float *Mi, *dMi;
433  int K1, K2, K3, dim2;
434 
435  K1=myGrid.K1; K2=myGrid.K2; K3=myGrid.K3; dim2=myGrid.dim2;
436  // order = myGrid.order;
437  stride=3*order;
438  Mi = M; dMi = dM;
439 
440  for (i=first; i<=last; i++) {
441  Mi = M + i*stride;
442  dMi = dM + i*stride;
443  float q;
444  int u1, u2, u2i, u3i;
445  q = p[i].cg;
446  f1=f2=f3=0.0;
447  u1 = (int)(p[i].x);
448  u2i = (int)(p[i].y);
449  u3i = (int)(p[i].z);
450  u1 -= order;
451  u2i -= order;
452  u3i -= order;
453  u3i += 1;
454  if ( u3i < 0 ) u3i += K3;
455  for (j=0; j<order; j++) {
456  float m1, d1;
457  int ind1;
458  m1=Mi[j]*q;
459  d1=K1*dMi[j]*q;
460  u1++;
461  ind1 = (u1 + (u1 < 0 ? K1 : 0))*dim2;
462  u2 = u2i;
463  for (k=0; k<order; k++) {
464  float m2, d2, m1m2, m1d2, d1m2;
465  int ind2;
466  m2=Mi[order+k];
467  d2=K2*dMi[order+k];
468  m1m2=m1*m2;
469  m1d2=m1*d2;
470  d1m2=d1*m2;
471  u2++;
472  ind2 = ind1 + (u2 + (u2 < 0 ? K2 : 0));
473  const float *qline = q_arr[ind2];
474  if ( ! qline ) continue;
475  for (l=0; l<order; l++) {
476  float term, m3, d3;
477  m3=Mi[2*order+l];
478  d3=K3*dMi[2*order+l];
479  term = qline[u3i+l];
480  f1 -= d1m2 * m3 * term;
481  f2 -= m1d2 * m3 * term;
482  f3 -= m1m2 * d3 * term;
483  }
484  }
485  }
486  f[i].x = f1;
487  f[i].y = f2;
488  f[i].z = f3;
489  }
490 }
int dim2
Definition: PmeBase.h:19
int K2
Definition: PmeBase.h:18
int K1
Definition: PmeBase.h:18
BigReal z
Definition: Vector.h:66
double cg
Definition: PmeBase.h:27
#define order
Definition: PmeRealSpace.C:235
gridSize z
BigReal x
Definition: Vector.h:66
int K3
Definition: PmeBase.h:18
BigReal y
Definition: Vector.h:66
gridSize y
gridSize x
void PmeRealSpace::fill_charges ( float **  q_arr,
float **  q_arr_list,
int &  q_arr_count,
int &  stray_count,
char *  f_arr,
char *  fz_arr,
PmeParticle  p[] 
)

Definition at line 47 of file PmeRealSpace.C.

References NAMD_die(), and PmeGrid::order.

Referenced by ComputePme::doWork().

48  {
49 
50  switch (myGrid.order) {
51  case 4:
52  fill_charges_order4(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
53  break;
54  case 6:
55  fill_charges_order<6>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
56  break;
57  case 8:
58  fill_charges_order<8>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
59  break;
60  case 10:
61  fill_charges_order<10>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
62  break;
63  default: NAMD_die("unsupported PMEInterpOrder");
64  }
65 
66 }
int order
Definition: PmeBase.h:20
void NAMD_die(const char *err_msg)
Definition: common.C:83
void PmeRealSpace::set_num_atoms ( int  natoms)

Definition at line 20 of file PmeRealSpace.C.

References ResizeArray< T >::begin(), PmeGrid::order, order, and ResizeArray< T >::resize().

Referenced by ComputePme::doWork().

20  {
21  N = natoms;
22  int order = myGrid.order;
23  M_alloc.resize(3*N*order);
24  M = M_alloc.begin();
25  dM_alloc.resize(3*N*order);
26  dM = dM_alloc.begin();
27 }
#define order
Definition: PmeRealSpace.C:235
int order
Definition: PmeBase.h:20
void resize(int i)
Definition: ResizeArray.h:84
iterator begin(void)
Definition: ResizeArray.h:36

The documentation for this class was generated from the following files: