- Timestamp:
- Apr 22, 2008, 9:02:23 AM (17 years ago)
- Children:
- 0f2c43
- Parents:
- ce81a3a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/pseudo.c
rce81a3a rf72dc1 1068 1068 } 1069 1069 1070 /** Calculates the local force acting on ion.1070 /** Calculates the local force acting on each ion. 1071 1071 * \param *P Problem at hand 1072 1072 */ … … 1080 1080 struct RunStruct *R = &P->R; 1081 1081 struct LatticeLevel *Lev0 = R->Lev0; 1082 struct LatticeLevel *LevS = R->LevS; 1082 1083 struct Density *Dens = Lev0->Dens; 1084 struct fft_plan_3d *plan = L->plan; 1085 fftw_complex *work = Dens->DensityCArray[TempDensity]; 1086 fftw_complex *HGC = Dens->DensityCArray[HGDensity]; 1087 fftw_real *HGCR = (fftw_real *)HGC; 1083 1088 double ForceFac = L->Volume; 1084 1089 double force, *dsum; 1085 1090 fftw_complex cv; 1091 1092 // precalc V_XC(r) and fft 1093 //debug(P,"precalc V_XC\n"); 1094 SetArrayToDouble0((double *)HGCR, Dens->TotalSize*2); 1095 CalculateXCPotentialNoRT(P, HGCR); 1096 fft_3d_real_to_complex(plan, LevS->LevelNo, FFTNF1, HGC, work); 1097 //debug(P,"precalc V_XC finished\n"); 1086 1098 for (is=0; is < I->Max_Types; is++) { 1087 1099 SetArrayToDouble0(I->FTemp, NDIM*I->I[is].Max_IonsOfType); … … 1096 1108 c_re(cv) = c_re(PP->VCoulombc[g2])*PP->FacGauss[is][g2]+PP->phi_ps_loc[is][g2]*c_re(Dens->DensityCArray[TotalDensity][Index])*R->HGcFactor; 1097 1109 c_im(cv) = c_im(PP->VCoulombc[g2])*PP->FacGauss[is][g2]-PP->phi_ps_loc[is][g2]*c_im(Dens->DensityCArray[TotalDensity][Index])*R->HGcFactor; 1110 if (I->I[is].corecorr == CoreCorrected) { 1111 // this summand was missing before, is not thoroughly tested 1112 //debug(P,"V_XC summand in CalculateIonLocalForce()\n"); 1113 c_re(cv) += (PP->formfCore[is][g2]*c_re(HGC[Index]))*R->HGcFactor; 1114 c_im(cv) += -(PP->formfCore[is][g2]*c_im(HGC[Index]))*R->HGcFactor; 1115 //fprintf(stderr, "(%i) FormfCore %lg\tHGC %lg+i%lg\n",P->Par.me, PP->formfCore[is][g2],c_re(HGC[Index]),c_im(HGC[Index])); 1116 } 1098 1117 force = c_re(PP->ei[is][ia][g2])*c_im(cv)+c_im(PP->ei[is][ia][g2])*c_re(cv); 1099 dsum[0] += 2.*(-G[0]*force); 1100 dsum[1] += 2.*(-G[1]*force); 1101 dsum[2] += 2.*(-G[2]*force); 1118 dsum[0] += 2.*(-G[0]*force); //2.* ... why? Nowhere from derivative! 1119 dsum[1] += 2.*(-G[1]*force); //2.* 1120 dsum[2] += 2.*(-G[2]*force); //2.* 1102 1121 } 1103 1122 } … … 1105 1124 for (ia=0;ia< I->I[is].Max_IonsOfType; ia++) 1106 1125 for (i=0; i<NDIM; i++) 1107 I->I[is].FIonL[i+NDIM*ia] *= ForceFac;1126 I->I[is].FIonL[i+NDIM*ia] *= ForceFac; 1108 1127 } 1109 1128 }
Note:
See TracChangeset
for help on using the changeset viewer.