25 double r1x = recip1.
x;
26 double r1y = recip1.
y;
27 double r1z = recip1.
z;
28 double r2x = recip2.
x;
29 double r2y = recip2.
y;
30 double r2z = recip2.
z;
31 double r3x = recip3.
x;
32 double r3y = recip3.
y;
33 double r3z = recip3.
z;
37 double shift1 = ((K1 + grid.
order - 1)/2)/(double)K1;
38 double shift2 = ((K2 + grid.
order - 1)/2)/(double)K2;
39 double shift3 = ((K3 + grid.
order - 1)/2)/(double)K3;
41 for (
int i=0; i<N; i++) {
42 double px = p[i].
x - ox;
43 double py = p[i].
y - oy;
44 double pz = p[i].
z - oz;
45 double sx = shift1 + px*r1x + py*r1y + pz*r1z;
46 double sy = shift2 + px*r2x + py*r2y + pz*r2z;
47 double sz = shift3 + px*r3x + py*r3y + pz*r3z;
48 p[i].
x = K1 * ( sx - floor(sx) );
49 p[i].
y = K2 * ( sy - floor(sy) );
50 p[i].
z = K3 * ( sz - floor(sz) );
53 if ( p[i].
x == K1 ) p[i].
x = 0;
54 if ( p[i].
y == K2 ) p[i].
y = 0;
55 if ( p[i].
z == K3 ) p[i].
z = 0;
64 double r1x = recip1.
x;
65 double r1y = recip1.
y;
66 double r1z = recip1.
z;
67 double r2x = recip2.
x;
68 double r2y = recip2.
y;
69 double r2z = recip2.
z;
70 double r3x = recip3.
x;
71 double r3y = recip3.
y;
72 double r3z = recip3.
z;
74 for (
int i=0; i<N; i++) {
78 f[i].
x = f1*r1x + f2*r2x + f3*r3x;
79 f[i].
y = f1*r1y + f2*r2y + f3*r3y;
80 f[i].
z = f1*r1z + f2*r2z + f3*r3z;
88 REAL
x,
y,
z,x1,y1,z1, div;
89 REAL * __restrict Mx, * __restrict My, * __restrict Mz, * __restrict dMx, * __restrict dMy, * __restrict dMz;
90 Mx=M-1; My=M+order-1; Mz=M+2*order-1;
91 dMx=dM-1; dMy =dM+order-1; dMz=dM+2*order-1;
95 x1=1.0-
x; y1=1.0-
y; z1=1.0-
z;
111 for (n=4; n<=order-1; n++) {
114 Mx[n] = x*div*Mx[n-1];
115 My[n] = y*div*My[n-1];
116 Mz[n] = z*div*Mz[n-1];
117 for (j=1; j<=n-2; j++) {
118 Mx[n-j] = ((x+j)*Mx[n-j-1] + (n-x-j)*Mx[n-j])*div;
119 My[n-j] = ((y+j)*My[n-j-1] + (n-y-j)*My[n-j])*div;
120 Mz[n-j] = ((z+j)*Mz[n-j-1] + (n-z-j)*Mz[n-j])*div;
122 Mx[1] *= (1.0-
x)*div;
123 My[1] *= (1.0-
y)*div;
124 Mz[1] *= (1.0-
z)*div;
127 dMx[1]=-Mx[1]; dMy[1]=-My[1]; dMz[1]=-Mz[1];
128 for (j=2; j <=
order; j++) {
129 dMx[j] = Mx[j-1] - Mx[j];
130 dMy[j] = My[j-1] - My[j];
131 dMz[j] = Mz[j-1] - Mz[j];
135 Mx[
order] = x*div*Mx[order-1];
136 My[
order] = y*div*My[order-1];
137 Mz[
order] = z*div*Mz[order-1];
138 for (j=1; j<=order-2; j++) {
139 Mx[order-j] = ((x+j)*Mx[order-j-1] + (order-x-j)*Mx[order-j])*div;
140 My[order-j] = ((y+j)*My[order-j-1] + (order-y-j)*My[order-j])*div;
141 Mz[order-j] = ((z+j)*Mz[order-j-1] + (order-z-j)*Mz[order-j])*div;
143 Mx[1] *= (1.0-
x)*div;
144 My[1] *= (1.0-
y)*div;
145 Mz[1] *= (1.0-
z)*div;
static void scale_coordinates(PmeParticle p[], int N, Lattice lattice, PmeGrid grid)
static void scale_forces(Vector f[], int N, Lattice &lattice)
static void compute_b_spline(REAL *__restrict frac, REAL *M, REAL *dM, int order)