Changeset 519b83 for pcp


Ignore:
Timestamp:
Apr 22, 2008, 11:48:46 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
473c2b
Parents:
f91abc
Message:

ShiftGaugeOrigin(): now takes whole vector as second argument (as index is given in the third anyway!)

Location:
pcp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pcp/src/perturbed.c

    rf91abc r519b83  
    12741274          sawtooth(Lat,X[index[0]],index[0]) * TempPsiR [i0]
    12751275         -sawtooth(Lat,X[index[2]],index[2]) * TempPsi2R[i0];
    1276 //          ShiftGaugeOrigin(P,X[index[0]],index[0]) * TempPsiR [i0]
    1277 //         -ShiftGaugeOrigin(P,X[index[2]],index[2]) * TempPsi2R[i0];
     1276//          ShiftGaugeOrigin(P,X,index[0]) * TempPsiR [i0]
     1277//         -ShiftGaugeOrigin(P,X,index[2]) * TempPsi2R[i0];
    12781278//        PsiCR[iS] = (x[index[0]] - Wcentre[index[0]]) * TempPsiR [i0] - (x[index[2]] - Wcentre[index[2]]) * TempPsi2R[i0];
    12791279      }
     
    14031403//         Psi2CR[iS] = sawtooth(Lat,X[cross(index_pxr,3)],cross(index_pxr,3)) * TempPsiR[i0];
    14041404        MinImageConv(Lat,x,Wcentre,X);
    1405         PsiCR[iS] = ShiftGaugeOrigin(P,X[cross(index_pxr,1)],cross(index_pxr,1)) * TempPsiR[i0];
    1406         Psi2CR[iS] = ShiftGaugeOrigin(P,X[cross(index_pxr,3)],cross(index_pxr,3)) * TempPsiR[i0];
     1405        PsiCR[iS] = ShiftGaugeOrigin(P,X,cross(index_pxr,1)) * TempPsiR[i0];
     1406        Psi2CR[iS] = ShiftGaugeOrigin(P,X,cross(index_pxr,3)) * TempPsiR[i0];
    14071407      }
    14081408 
     
    16411641 * the core region inadequately/only moderately well approximated by a plane-wave-pseudo-potential-method.
    16421642 * \param *P Problem at hand, containing Lattice and Ions
    1643  * \param r parameter r
     1643 * \param r coordinate vector
    16441644 * \param index index of the basis vector
    16451645 * \return \f$d(r)\f$
    16461646 * \note Continuous Set of Damped Gauge Transformations according to Keith and Bader
    16471647 */
    1648 inline double ShiftGaugeOrigin(struct Problem *P, double r, const int index)
     1648inline double ShiftGaugeOrigin(struct Problem *P, double r[NDIM], const int index)
    16491649{
    16501650  struct Ions *I = &P->Ion;
    16511651  struct Lattice *Lat = &P->Lat;
    1652   double x, tmp;
    1653   int is,ia;
     1652  double x[NDIM], tmp;
     1653  int is,ia, i;
    16541654 
    16551655  // loop over all ions to calculate the sum
    1656   x = r;
     1656  for(i=0;i<NDIM;i++)
     1657    x[i] = r[i];
    16571658  for (is=0; is < I->Max_Types; is++)
    1658     for (ia=0; ia < I->I[is].Max_IonsOfType; ia++) {
    1659       tmp = (r - I->I[is].R[NDIM*ia]);
    1660       x -= tmp*exp(- I->I[is].alpha[ia] * tpow(tmp,4));
    1661     }
    1662  
    1663   return(sawtooth(Lat,x,index));  // still use sawtooth due to the numerical instability around the border region of the cell
     1659    for (ia=0; ia < I->I[is].Max_IonsOfType; ia++)
     1660      for(i=0;i<NDIM;i++) {
     1661        tmp = (r[i] - I->I[is].R[NDIM*ia]);
     1662        x[i] -= tmp*exp(- I->I[is].alpha[ia] * tpow(tmp,4));
     1663      }
     1664 
     1665  return(sawtooth(Lat,x[index],index));  // still use sawtooth due to the numerical instability around the border region of the cell
    16641666}
    16651667
     
    22432245                for (i=0;i<NDIM;i++) // build gauge-translated r_bar evaluation point
    22442246                  r_bar[i] = sawtooth(Lat,X,i);
    2245 //                    ShiftGaugeOrigin(P,truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i),i);
     2247//                    ShiftGaugeOrigin(P,X,i);
    22462248                    //truedist(Lat, x[i], Psi->AddData[k].WannierCentre[i], i);
    22472249                factor += Psi1R[i0] * (r_bar[cross_lookup_1[0]] * Psi1R[i0]);
     
    22642266                for (i=0;i<NDIM;i++) // build gauge-translated r_bar evaluation point
    22652267                  r_bar[i] = sawtooth(Lat,X[i],i);
    2266 //                    ShiftGaugeOrigin(P,X[i],i);
     2268//                    ShiftGaugeOrigin(P,X,i);
    22672269                    //X[i];
    22682270                Current = Psip0R[i0] * (r_bar[cross_lookup_1[0]] * Psi1R[i0]);
  • pcp/src/perturbed.h

    rf91abc r519b83  
    4242void PlotVectorPlane(struct Problem *P, int B_Index, int n_orth);
    4343void ReadSrcPerturbedPsis(struct Problem *P, enum PsiTypeTag type);
    44 inline double ShiftGaugeOrigin(struct Problem *P, double r, const int index);
     44inline double ShiftGaugeOrigin(struct Problem *P, double r[NDIM], const int index);
    4545inline double sawtooth(struct Lattice *Lat, const double L, const int index);
    4646inline void MinImageConv(struct Lattice *Lat, const double R[NDIM], const double r[NDIM], double *result);
Note: See TracChangeset for help on using the changeset viewer.