PmeRealSpace Class Reference

#include <PmeRealSpace.h>

List of all members.

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.

00014   : myGrid(grid) {
00015 }

PmeRealSpace::~PmeRealSpace (  ) 

Definition at line 17 of file PmeRealSpace.C.

00017                             {
00018 }


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 f, NAMD_die(), and PmeGrid::order.

Referenced by ComputePme::ungridForces().

00142                                                                    {
00143 
00144   switch (myGrid.order) {
00145   case 4:
00146     compute_forces_order4(q_arr, p, f);
00147     break;
00148   case 6:
00149     compute_forces_order<6>(q_arr, p, f);
00150     break;
00151   case 8:
00152     compute_forces_order<8>(q_arr, p, f);
00153     break;
00154   case 10:
00155     compute_forces_order<10>(q_arr, p, f);
00156     break;
00157   default: NAMD_die("unsupported PMEInterpOrder");
00158   }
00159 
00160 }

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, f, PmeGrid::K1, PmeGrid::K2, and PmeGrid::K3.

Referenced by compute_forces_order4_helper().

00428                                                                    {
00429   
00430   int i, j, k, l, stride;
00431   float f1, f2, f3;
00432   float *Mi, *dMi;
00433   int K1, K2, K3, dim2;
00434 
00435   K1=myGrid.K1; K2=myGrid.K2; K3=myGrid.K3; dim2=myGrid.dim2;
00436   // order = myGrid.order;
00437   stride=3*order;
00438   Mi = M; dMi = dM;
00439  
00440   for (i=first; i<=last; i++) {
00441     Mi = M + i*stride;
00442     dMi = dM + i*stride;
00443     float q;
00444     int u1, u2, u2i, u3i;
00445     q = p[i].cg;
00446     f1=f2=f3=0.0;
00447     u1 = (int)(p[i].x);
00448     u2i = (int)(p[i].y);
00449     u3i = (int)(p[i].z);
00450     u1 -= order;
00451     u2i -= order;
00452     u3i -= order;
00453     u3i += 1;
00454     if ( u3i < 0 ) u3i += K3;
00455     for (j=0; j<order; j++) {
00456       float m1, d1;
00457       int ind1;
00458       m1=Mi[j]*q;
00459       d1=K1*dMi[j]*q;
00460       u1++;
00461       ind1 = (u1 + (u1 < 0 ? K1 : 0))*dim2; 
00462       u2 = u2i;
00463       for (k=0; k<order; k++) {
00464         float m2, d2, m1m2, m1d2, d1m2;
00465         int ind2;
00466         m2=Mi[order+k];
00467         d2=K2*dMi[order+k];
00468         m1m2=m1*m2;
00469         m1d2=m1*d2;
00470         d1m2=d1*m2;
00471         u2++;
00472         ind2 = ind1 + (u2 + (u2 < 0 ? K2 : 0));
00473         const float *qline = q_arr[ind2];
00474         if ( ! qline ) continue;
00475         for (l=0; l<order; l++) {
00476           float term, m3, d3;
00477           m3=Mi[2*order+l];
00478           d3=K3*dMi[2*order+l];
00479           term = qline[u3i+l];
00480           f1 -= d1m2 * m3 * term;
00481           f2 -= m1d2 * m3 * term;
00482           f3 -= m1m2 * d3 * term;
00483         }
00484       }
00485     }
00486     f[i].x = f1;
00487     f[i].y = f2;
00488     f[i].z = f3;
00489   }
00490 }

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.

00048                                                                                      {
00049 
00050   switch (myGrid.order) {
00051   case 4:
00052     fill_charges_order4(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
00053     break;
00054   case 6:
00055     fill_charges_order<6>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
00056     break;
00057   case 8:
00058     fill_charges_order<8>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
00059     break;
00060   case 10:
00061     fill_charges_order<10>(q_arr, q_arr_list, q_arr_count, stray_count, f_arr, fz_arr, p);
00062     break;
00063   default: NAMD_die("unsupported PMEInterpOrder");
00064   }
00065 
00066 }

void PmeRealSpace::set_num_atoms ( int  natoms  ) 

Definition at line 20 of file PmeRealSpace.C.

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

00020                                            {
00021   N = natoms;
00022   int order = myGrid.order;
00023   M_alloc.resize(3*N*order);
00024   M = M_alloc.begin();
00025   dM_alloc.resize(3*N*order);
00026   dM = dM_alloc.begin();
00027 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 23 01:17:19 2017 for NAMD by  doxygen 1.4.7