Changeset 9bdd86
- Timestamp:
- Apr 22, 2008, 1:18:55 PM (17 years ago)
- Children:
- 4f1369
- Parents:
- cc9c36
- Location:
- pcp/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/perturbed.c
rcc9c36 r9bdd86 999 999 //else fprintf(stderr,"(%i) WCentre[%i] = %e \n",P->Par.me, index_r, Wcentre[index_r]); 1000 1000 MinImageConv(Lat,x, Wcentre, X); 1001 vector = sawtooth(Lat,X [index_r],index_r);1001 vector = sawtooth(Lat,X,index_r); 1002 1002 //vector = 1.;//sin((double)(n[index_r])/(double)((N[index_r]))*2*PI); 1003 1003 PsiCR[iS] = vector * TempPsiR[i0]; … … 1272 1272 MinImageConv(Lat, x, Wcentre, X); 1273 1273 PsiCR[iS] = //vector * TempPsiR[i0]; 1274 sawtooth(Lat,X [index[0]],index[0]) * TempPsiR [i0]1275 -sawtooth(Lat,X [index[2]],index[2]) * TempPsi2R[i0];1274 sawtooth(Lat,X,index[0]) * TempPsiR [i0] 1275 -sawtooth(Lat,X,index[2]) * TempPsi2R[i0]; 1276 1276 // ShiftGaugeOrigin(P,X,index[0]) * TempPsiR [i0] 1277 1277 // -ShiftGaugeOrigin(P,X,index[2]) * TempPsi2R[i0]; … … 1616 1616 * \param index component index for Lattice#RealBasisSQ 1617 1617 */ 1618 inline double sawtooth(struct Lattice *Lat, double L , const int index)1618 inline double sawtooth(struct Lattice *Lat, double L[NDIM], const int index) 1619 1619 { 1620 1620 double axis = sqrt(Lat->RealBasisSQ[index]); … … 1626 1626 //fprintf(stderr, "sawstart: %e\tsawend: %e\tsawfactor: %e\tL: %e\n", sawstart, sawend, sawfactor, L); 1627 1627 // transform and return (sawtooth profile checked, 04.08.06) 1628 L += axis/2.; // transform to 0 ... L1629 if (L < (sawstart*axis)) return (-axis/(2*sawfactor)*sin(L/(sawstart*axis)*PI/2.)); // first smooth transition from 0 ... -L/21630 if (L > (sawend*axis)) return ( axis/(2*sawfactor)*cos((L-sawend*axis)/(sawstart*axis)*PI/2.)); // second smooth transition from +L/2 ... 01628 L[index] += axis/2.; // transform to 0 ... L 1629 if (L[index] < (sawstart*axis)) return (-axis/(2*sawfactor)*sin(L[index]/(sawstart*axis)*PI/2.)); // first smooth transition from 0 ... -L/2 1630 if (L[index] > (sawend*axis)) return ( axis/(2*sawfactor)*cos((L[index]-sawend*axis)/(sawstart*axis)*PI/2.)); // second smooth transition from +L/2 ... 0 1631 1631 //fprintf(stderr,"L %e\t sawstart %e\t sawend %e\t sawfactor %e\t axis%e\n", L, sawstart, sawend, sawfactor, axis); 1632 1632 //return ((L - sawstart*axis) - axis/(2*sawfactor)); // area in between scale to -L/2 ... +L/2 1633 return (L - axis/2); // area in between return as it was1633 return (L[index] - axis/2); // area in between return as it was 1634 1634 } 1635 1635 … … 1663 1663 } 1664 1664 1665 return(sawtooth(Lat,x [index],index)); // still use sawtooth due to the numerical instability around the border region of the cell1665 return(sawtooth(Lat,x,index)); // still use sawtooth due to the numerical instability around the border region of the cell 1666 1666 } 1667 1667 … … 1687 1687 //fprintf(stderr,"(%i) x %e\t Axis/2 %e\n",P->Par.me, x, sqrt(Lat->RealBasisSQ[index])/2. ); 1688 1688 MinImageConv(Lat, n, Lat->RealBasisCenter, x); 1689 fprintf(stderr,"%e\t%e\n", n[index], sawtooth(Lat,n [index],index));1689 fprintf(stderr,"%e\t%e\n", n[index], sawtooth(Lat,n,index)); 1690 1690 } 1691 1691 } … … 2265 2265 MinImageConv(Lat, x, Psi->AddData[k].WannierCentre, X); 2266 2266 for (i=0;i<NDIM;i++) // build gauge-translated r_bar evaluation point 2267 r_bar[i] = sawtooth(Lat,X [i],i);2267 r_bar[i] = sawtooth(Lat,X,i); 2268 2268 // ShiftGaugeOrigin(P,X,i); 2269 2269 //X[i]; -
pcp/src/perturbed.h
rcc9c36 r9bdd86 43 43 void ReadSrcPerturbedPsis(struct Problem *P, enum PsiTypeTag type); 44 44 inline double ShiftGaugeOrigin(struct Problem *P, double r[NDIM], const int index); 45 inline double sawtooth(struct Lattice *Lat, const double L, const int index);45 inline double sawtooth(struct Lattice *Lat, double L[NDIM], const int index); 46 46 inline void MinImageConv(struct Lattice *Lat, const double R[NDIM], const double r[NDIM], double *result); 47 47 void test_fft_symmetry(struct Problem *P, const int l);
Note:
See TracChangeset
for help on using the changeset viewer.