- Timestamp:
- Apr 22, 2008, 11:11:04 AM (17 years ago)
- Children:
- d2f1b1
- Parents:
- b0225a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/perturbed.c
rb0225a r0da6d5 2091 2091 int k, j, i0; 2092 2092 int n[NDIM], n0; 2093 int N[NDIM]; 2094 N[0] = Lev0->Plan0.plan->N[0]; 2095 N[1] = Lev0->Plan0.plan->N[1]; 2096 N[2] = Lev0->Plan0.plan->N[2]; 2093 int *N; 2094 N = Lev0->Plan0.plan->N; 2097 2095 const int N0 = Lev0->Plan0.plan->local_nx; 2098 2096 //int ActNum; … … 2101 2099 MPI_Status status; 2102 2100 int cross_lookup_1[4], cross_lookup_3[4], l_1 = 0, l_3 = 0; 2101 double Factor;//, factor; 2103 2102 2104 2103 //fprintf(stderr,"(%i) FactoR %e\n", P->Par.me, R->FactorDensityR); … … 2175 2174 int wished = -1; 2176 2175 FILE *file = fopen(P->Call.MainParameterFile,"r"); 2177 if (!ParseForParameter( 1,file,"Orbital",0,1,1,int_type,&wished, 1, optional)) {2178 fprintf(stderr,"Desired Orbital missing!\n");2176 if (!ParseForParameter(0,file,"Orbital",0,1,1,int_type,&wished, 1, optional)) { 2177 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital missing, using: All!\n"); 2179 2178 wished = -1; 2180 2179 } else if (wished != -1) { 2181 fprintf(stderr,"Desired Orbital is: %i.\n", wished);2180 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: %i.\n", wished); 2182 2181 } else { 2183 fprintf(stderr,"Desired Orbital is: All.\n");2182 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: All.\n"); 2184 2183 } 2185 2184 fclose(file); … … 2218 2217 case Perturbed_P1: 2219 2218 case Perturbed_P2: 2219 /* // evaluate factor to compensate r x normalized phi(r) against normalized phi(rxp) 2220 factor = 0.; 2221 for (n0=0;n0<N0;n0++) // only local points on x axis 2222 for (n[1]=0;n[1]<N[1];n[1]++) 2223 for (n[2]=0;n[2]<N[2];n[2]++) { 2224 i0 = n[2]+N[2]*(n[1]+N[1]*n0); 2225 n[0]=n0 + N0*myPE; // global relative coordinate: due to partitoning of x-axis in PEPGamma>1 case 2226 fac[0] = (double)n[0]/(double)N[0]; 2227 fac[1] = (double)n[1]/(double)N[1]; 2228 fac[2] = (double)n[2]/(double)N[2]; 2229 RMat33Vec3(x, Lat->RealBasis, fac); // relative coordinate times basis matrix gives absolute ones 2230 MinImageConv(Lat, x, Psi->AddData[k].WannierCentre, X) 2231 for (i=0;i<NDIM;i++) // build gauge-translated r_bar evaluation point 2232 r_bar[i] = sawtooth(Lat,X,i); 2233 // ShiftGaugeOrigin(P,truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i),i); 2234 //truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i); 2235 factor += Psi1R[i0] * (r_bar[cross_lookup_1[0]] * Psi1R[i0]); 2236 } 2237 MPI_Allreduce (&factor, &Factor, 1, MPI_DOUBLE, MPI_SUM, P->Par.comm_ST_Psi); 2238 Factor *= R->FactorDensityR; // discrete integration constant 2239 fprintf(stderr,"(%i) normalization factor of Phi^(RxP%i)_{%i} is %lg\n", P->Par.me, type, k, Factor); 2240 Factor = 1./sqrt(fabs(Factor)); //Factor/fabs(Factor) */ 2241 Factor = 1.; 2220 2242 for (n0=0;n0<N0;n0++) // only local points on x axis 2221 2243 for (n[1]=0;n[1]<N[1];n[1]++) … … 2232 2254 // ShiftGaugeOrigin(P,truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i),i); 2233 2255 //truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i); 2234 2235 2256 Current = Psip0R[i0] * (r_bar[cross_lookup_1[0]] * Psi1R[i0]); 2236 2257 Current += (Psi0R[i0] * r_bar[cross_lookup_1[0]] * Psip1R[i0]); … … 2238 2259 ////if (CurrentDensity[index+j*NDIM] != (fftw_real *) Dens0->DensityArray[CurrentDensity0 + index+j*NDIM] || i0<0 || i0>=Dens0->LocalSizeR || (index+j*NDIM)<0 || (index+j*NDIM)>=NDIM*NDIM) Error(SomeError,"FillCurrentDensity: CurrentDensity[] corrupted"); 2239 2260 CurrentDensity[index+l_1*NDIM][i0] -= Current; // note: sign of cross product resides in Current itself (here: plus) 2240 2241 2261 Current = - Psip0R[i0] * (r_bar[cross_lookup_3[2]] * Psi1R[i0]); 2242 2262 Current += - (Psi0R[i0] * r_bar[cross_lookup_3[2]] * Psip1R[i0]);
Note:
See TracChangeset
for help on using the changeset viewer.