Changeset 8786c3 for pcp/src


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

CalculateChemicalShieldingByReciprocalCurrentDensity(): TestReciprocalCurrentDensity() outsourced

Part of CalculateChemicalShieldingByReciprocalCurrentDensity() was shifted to new function TestReciprocalCurrentDensity() that tested the reciprocal current density (J(G)=0)

Location:
pcp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified pcp/src/perturbed.c

    rd2f1b1 r8786c3  
    30623062  CurrentDensity[8] = (fftw_real *) Dens0->DensityArray[CurrentDensity8];
    30633063
    3064   if (P->Call.out[StepLeaderOut]) fprintf(stderr,"(%i) Checking J_{ij} (G=0) = 0 for each i,j ... \n",P->Par.me);
     3064  // inverse Fourier transform current densities
     3065  if (P->Call.out[LeaderOut]) fprintf(stderr,"(%i) Transforming and checking J_{ij} (G=0) = 0 for each i,j ... \n",P->Par.me);
    30653066  for (in=0;in<NDIM*NDIM;in++) {
    30663067    CalculateOneDensityC(Lat, R->LevS, Dens0, CurrentDensity[in], CurrentDensityC[in], factorDC);
    3067     tmp = sqrt(CurrentDensityC[in][0].re*CurrentDensityC[in][0].re+CurrentDensityC[in][0].im*CurrentDensityC[in][0].im);
    3068     if (GArray[0].GSq < MYEPSILON) {
    3069       if (in % NDIM == 0) fprintf(stderr,"(%i) ",P->Par.me);
    3070       if (tmp > MYEPSILON) {
    3071         fprintf(stderr,"J_{%i,%i} = |%e + i%e| < %e ? (%e)\t", in / NDIM, in%NDIM, CurrentDensityC[in][0].re, CurrentDensityC[in][0].im, MYEPSILON, tmp - MYEPSILON);
    3072       } else {
    3073         fprintf(stderr,"J_{%i,%i} ok\t", in / NDIM, in%NDIM);
    3074       }
    3075       if (in % NDIM == (NDIM-1)) fprintf(stderr,"\n");
    3076     }   
    3077   }
    3078 
     3068    TestReciprocalCurrent(P, CurrentDensityC[in], GArray, in);
     3069  }
     3070
     3071  // linking pointers to the arrays
    30793072  for (in=0;in<NDIM*NDIM;in++) {
    30803073    LockDensityArray(Dens0,in,real); // Psi1R
     
    33973390
    33983391  gsl_matrix_complex_free(H);
     3392}
     3393
     3394/** Test if G=0-component of reciprocal current is 0.
     3395 * In most cases we do not reach a numerical sensible zero as in MYEPSILON and remain satisfied as long
     3396 * as the integrated current density is very small (e.g. compared to single entries in the current density array)
     3397 * \param *P Problem at hand
     3398 * \param *CurrentC pointer to reciprocal current density
     3399 * \param *GArray pointer to array with G vectors
     3400 * \param in index of current component
     3401 * \sa TestCurrent() these two tests are equivalent and follow by fourier transformation
     3402 */
     3403void TestReciprocalCurrent(struct Problem *P, const fftw_complex *CurrentC, struct OneGData *GArray, int in)
     3404{
     3405  double tmp;
     3406  tmp = sqrt(CurrentC[0].re*CurrentC[0].re+CurrentC[0].im*CurrentC[0].im);
     3407  if ((P->Call.out[LeaderOut]) && (GArray[0].GSq < MYEPSILON)) {
     3408    if (in % NDIM == 0) fprintf(stderr,"(%i) ",P->Par.me);
     3409    if (tmp > MYEPSILON) {
     3410      fprintf(stderr,"J_{%i,%i} = |%e + i%e| < %e ? (%e)\t", in / NDIM, in%NDIM, CurrentC[0].re, CurrentC[0].im, MYEPSILON, tmp - MYEPSILON);
     3411    } else {
     3412      fprintf(stderr,"J_{%i,%i} ok\t", in / NDIM, in%NDIM);
     3413    }
     3414    if (in % NDIM == (NDIM-1)) fprintf(stderr,"\n");
     3415  }   
    33993416}
    34003417
  • TabularUnified pcp/src/perturbed.h

    rd2f1b1 r8786c3  
    4949void TestSawtooth(struct Problem *P, const int index);
    5050void TestCurrent(struct Problem *P, const int index);
     51void TestReciprocalCurrent(struct Problem *P, const fftw_complex *currentC, struct OneGData *GArray, int in);
    5152
    5253#endif /*PERTURBED_H_*/
Note: See TracChangeset for help on using the changeset viewer.