Changeset 0da6d5 for pcp


Ignore:
Timestamp:
Apr 22, 2008, 11:11:04 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
d2f1b1
Parents:
b0225a
Message:

FillCurrentDensity(): N is now ptr not array, commented-out Factor part included, verbosity changes

N that holds number of nodes per axis now just points to LatticeLevel structure instead of copying values.
Factor part was meant to balance P- against RxP-Perturbation, but proved futile so far.
some if (P->Call.out[ReadOut]) added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pcp/src/perturbed.c

    rb0225a r0da6d5  
    20912091  int k, j, i0;
    20922092  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;
    20972095  const int N0 = Lev0->Plan0.plan->local_nx;
    20982096  //int ActNum;
     
    21012099  MPI_Status status;
    21022100  int cross_lookup_1[4], cross_lookup_3[4], l_1 = 0, l_3 = 0;
     2101  double Factor;//, factor;
    21032102
    21042103  //fprintf(stderr,"(%i) FactoR %e\n", P->Par.me, R->FactorDensityR);
     
    21752174  int wished = -1;
    21762175  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");
    21792178    wished = -1;
    21802179  } 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);
    21822181  } else {
    2183     fprintf(stderr,"Desired Orbital is: All.\n");
     2182     if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: All.\n");
    21842183  }
    21852184  fclose(file);
     
    22182217        case Perturbed_P1:
    22192218        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.;
    22202242          for (n0=0;n0<N0;n0++)  // only local points on x axis
    22212243            for (n[1]=0;n[1]<N[1];n[1]++)
     
    22322254//                    ShiftGaugeOrigin(P,truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i),i);
    22332255                    //truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i);
    2234                
    22352256                Current = Psip0R[i0] * (r_bar[cross_lookup_1[0]] * Psi1R[i0]);
    22362257                Current += (Psi0R[i0] * r_bar[cross_lookup_1[0]] * Psip1R[i0]);
     
    22382259                ////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");
    22392260                CurrentDensity[index+l_1*NDIM][i0] -= Current; // note: sign of cross product resides in Current itself (here: plus)
    2240                
    22412261                Current = - Psip0R[i0] * (r_bar[cross_lookup_3[2]] * Psi1R[i0]);
    22422262                Current += - (Psi0R[i0] * r_bar[cross_lookup_3[2]] * Psip1R[i0]);
Note: See TracChangeset for help on using the changeset viewer.