20 void compute_PIMD_Fu();
21 void compute_PIMD_u();
22 void compute_PIMD_x();
36 double *fxu,*fyu,*fzu;
37 double *rat1,*rat2,*veig;
56 pibeads.output_PIMD_x();
57 pibeads.energy_PIMD_x();
60 pibeads.compute_PIMD_u();
61 pibeads.output_PIMD_u();
62 pibeads.energy_PIMD_u();
65 pibeads.compute_PIMD_x();
66 pibeads.output_PIMD_x();
67 pibeads.energy_PIMD_x();
73 pibeads.compute_PIMD_Fu();
74 pibeads.checkUforce();
89 PIBeadAtoms::PIBeadAtoms(
int numBeads_dum)
95 numBeads = numBeads_dum;
97 x=
new double[numBeads];
98 y=
new double[numBeads];
99 z=
new double[numBeads];
100 xu=
new double[numBeads];
101 yu=
new double[numBeads];
102 zu=
new double[numBeads];
103 fx=
new double[numBeads];
104 fy=
new double[numBeads];
105 fz=
new double[numBeads];
106 fxu=
new double[numBeads];
107 fyu=
new double[numBeads];
108 fzu=
new double[numBeads];
110 rat1 =
new double[numBeads];
111 rat2 =
new double[numBeads];
112 veig =
new double[numBeads];
117 for(
int ip=2;ip<=numBeads;ip++){
119 rat1[ip1] = ((double)(ip1))/((
double)(ip));
120 rat2[ip1] = 1.0/((double)(ip));
121 veig[ip1] = ((double)(ip))/((
double)(ip1));
126 long int seedval = 91435715;
128 for(
int i =0;i<numBeads;i++){
129 x[i] = drand48() - 0.5;
130 y[i] = drand48() - 0.5;
131 z[i] = drand48() - 0.5;
149 void PIBeadAtoms::compute_PIMD_Fu()
155 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
156 printf(
"The number of beads must be >=0\n");
157 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
164 fxu[0] = 0.0; fyu[0] = 0.0; fzu[0] = 0.0;
165 for(
int ip=0;ip<numBeads;ip++){
166 fxu[0] += fx[ip]; fyu[0] += fy[ip]; fzu[0] += fz[ip];
168 fxu[1] = fx[1]; fyu[1] = fy[1]; fzu[1] = fz[1];
169 for(
int ip=1;ip<numBeads-1;ip++){
171 fxu[ip1] = fx[ip1] + rat1[ip]*fxu[ip];
172 fyu[ip1] = fy[ip1] + rat1[ip]*fyu[ip];
173 fzu[ip1] = fz[ip1] + rat1[ip]*fzu[ip];
176 fxu[0] = fx[0]; fyu[0] = fy[0]; fzu[0] = fz[0];
189 void PIBeadAtoms::compute_PIMD_u()
195 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
196 printf(
"The number of beads must be >=0\n");
197 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
204 xu[0] = x[0]; yu[0] = y[0]; zu[0] = z[0];
205 for(
int ip=1;ip<numBeads-1;ip++){
207 double xstar = rat1[ip]*x[ip1] + rat2[ip]*x[0];
208 double ystar = rat1[ip]*y[ip1] + rat2[ip]*y[0];
209 double zstar = rat1[ip]*z[ip1] + rat2[ip]*z[0];
210 xu[ip] = x[ip] - xstar;
211 yu[ip] = y[ip] - ystar;
212 zu[ip] = z[ip] - zstar;
215 xu[ip] = x[ip] - x[0];
216 yu[ip] = y[ip] - y[0];
217 zu[ip] = z[ip] - z[0];
219 xu[0] = x[0]; yu[0] = y[0]; zu[0] = z[0];
232 void PIBeadAtoms::compute_PIMD_x()
238 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
239 printf(
"The number of beads must be >=0\n");
240 printf(
"@@@@@@@@@@@@@@@@@@@@_error_@@@@@@@@@@@@@@@@@@@@@@\n");
248 x[0] = xu[0]; y[0] = yu[0]; z[0] = zu[0];
250 x[ip] = xu[ip] + x[0]; y[ip] = yu[ip] + y[0]; z[ip] = zu[ip] + z[0];
251 for(
int ip=numBeads-2;ip>=1;ip--){
253 double xadd = rat1[ip]*x[ip1]+xu[0]*rat2[ip];
254 double yadd = rat1[ip]*y[ip1]+yu[0]*rat2[ip];
255 double zadd = rat1[ip]*z[ip1]+zu[0]*rat2[ip];
256 x[ip] = xu[ip] + xadd;
257 y[ip] = yu[ip] + yadd;
258 z[ip] = zu[ip] + zadd;
261 x[0] = xu[0]; y[0] = yu[0]; z[0] = zu[0];
277 printf(
"\n/////////////////////////////////\n");
278 for(
int i =0;i<numBeads;i++){
279 printf(
"x[%d]: %g %g %g\n",i,x[i],y[i],z[i]);
281 printf(
"/////////////////////////////////\n");
296 printf(
"\n/////////////////////////////////\n");
297 for(
int i =0;i<numBeads;i++){
298 printf(
"u[%d]: %g %g %g\n",i,xu[i],yu[i],zu[i]);
300 printf(
"/////////////////////////////////\n");
315 for(
int i =0;i<numBeads;i++){
316 xu[i] = 0.0; yu[i] = 0.0; zu[i] = 0.0;;
332 for(
int i =0;i<numBeads;i++){
333 fxu[i] = 0.0; fyu[i] = 0.0; fzu[i] = 0.0;;
349 for(
int i =0;i<numBeads;i++){
350 x[i] = 0.0; y[i] = 0.0; z[i] = 0.0;;
369 int ip1 = numBeads-1;
370 ep = ( (x[ip]-x[ip1])*(x[ip]-x[ip1])
371 +(y[ip]-y[ip1])*(y[ip]-y[ip1])
372 +(z[ip]-z[ip1])*(z[ip]-z[ip1])
374 for(
int ip=1;ip<numBeads;ip++){
376 ep += ( (x[ip]-x[ip1])*(x[ip]-x[ip1])
377 +(y[ip]-y[ip1])*(y[ip]-y[ip1])
378 +(z[ip]-z[ip1])*(z[ip]-z[ip1])
381 printf(
"\n/////////////////////////////////\n");
382 printf(
"x energy %.10g\n",ep);
383 printf(
"/////////////////////////////////\n");
399 for(
int ip =1;ip<numBeads;ip++){
400 double fk = veig[ip];
401 ep += fk*(xu[ip]*xu[ip]
406 printf(
"\n/////////////////////////////////\n");
407 printf(
"u energy %.10g\n",ep);
408 printf(
"/////////////////////////////////\n");
423 printf(
"\n/////////////////////////////////\n");
428 double delta = 1.e-05;
429 for(
int ip =0;ip<numBeads;ip++){
454 printf(
"fu[%d]: %.10g %.10g : %.10g %.10g : %.10g %.10g\n",
455 ip,fxu[ip],0.5*(potmx-potpx)/delta,
456 fyu[ip],0.5*(potmy-potpy)/delta,
457 fzu[ip],0.5*(potmz-potpz)/delta);
460 printf(
"/////////////////////////////////\n");
477 for(
int ip =0;ip<numBeads;ip++){
478 pot += fk*(x[ip]*x[ip]
void output_PIMD_x()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void zero_PIMD_u()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void zero_PIMD_x()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void output_PIMD_u()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void energy_PIMD_x()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void energy_PIMD_u()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void checkUforce()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void zero_PIMD_fu()
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...
void modelpot_PIMD_x(double *)
useful for debugging /////////////////////////////////////////////////////////////////////////// ////...