Changeset 807e8a
- Timestamp:
- May 30, 2008, 3:48:16 PM (17 years ago)
- Children:
- 9842d8
- Parents:
- 0fe2ca
- Files:
-
- 3 edited
-
molecuilder/configure.ac (modified) (1 diff)
-
pcp/configure.ac (modified) (1 diff)
-
pcp/src/perturbed.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/configure.ac
r0fe2ca r807e8a 36 36 # Checks for library functions. 37 37 # check for GNU Scientific Library 38 AC_ CHECK_LIB(blas,main)38 AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas) 39 39 AC_CHECK_LIB(gsl,main) 40 40 -
pcp/configure.ac
r0fe2ca r807e8a 179 179 # check for GNU Scientific Library 180 180 #AC_CHECK_LIB(m,main) 181 AC_ CHECK_LIB(blas,main)182 AC_CHECK_LIB(gsl, main)181 AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas) 182 AC_CHECK_LIB(gsl, main) 183 183 184 184 dnl Check for "extern inline", using a modified version -
pcp/src/perturbed.c
r0fe2ca r807e8a 360 360 double lambda, Lambda; 361 361 double RElambda10, RELambda10; 362 //double RElambda01, RELambda01; 362 363 const fftw_complex *source = LevS->LPsi->LocalPsi[l]; 363 364 fftw_complex *grad = P->Grad.GradientArray[ActualGradient]; … … 472 473 // "-" due to purely imaginary wave function is on left hand side, thus becomes complex conjugated: i -> -i 473 474 // (-i goes into pert. op., "-" remains when on right hand side) 474 RElambda10 = GradSP(P,LevS,varphi_1,TempPsi_0) * sqrt(Psi->LocalPsiStatus[l].PsiFactor * Psi->LocalPsiStatus[l_normal].PsiFactor);475 //RElambda01 = -GradSP(P,LevS,varphi_0,TempPsi_1) * sqrt(Psi->LocalPsiStatus[l].PsiFactor * Psi->LocalPsiStatus[l_normal].PsiFactor);475 RElambda10 = GradSP(P,LevS,varphi_1,TempPsi_0) * sqrt(Psi->LocalPsiStatus[l].PsiFactor * Psi->LocalPsiStatus[l_normal].PsiFactor); 476 //RElambda01 = GradSP(P,LevS,varphi_0,TempPsi_1) * sqrt(Psi->LocalPsiStatus[l].PsiFactor * Psi->LocalPsiStatus[l_normal].PsiFactor); 476 477 477 478 MPI_Allreduce ( &RElambda10, &RELambda10, 1, MPI_DOUBLE, MPI_SUM, P->Par.comm_ST_Psi); … … 622 623 } 623 624 624 #define stay_above 0.00 1 //!< value above which the coefficient of the wave function will always remain625 #define stay_above 0.00001 //!< value above which the coefficient of the wave function will always remain 625 626 626 627 /** Finds the minimum of perturbed energy in regards of actual wave function. … … 673 674 double LocalSP, PsiSP; 674 675 double dEdt0, ddEddt0, ConDirHConDir, ConDirConDir;//, sourceHsource; 675 double E0, E, delta;676 //double E0, E, dE, ddE, delta, dcos, dsin;677 //double EI, dEI, ddEI, deltaI, dcosI, dsinI;676 //double E0, E, delta; 677 double E0, E, dE, ddE, delta, dcos, dsin; 678 double EI, dEI, ddEI, deltaI, dcosI, dsinI; 678 679 //double HartreeddEddt0, XCddEddt0; 679 680 double d[4],D[4], Diff; … … 707 708 x = .5*LevS->GArray[g].GSq; 708 709 // FIXME: Good way of accessing reciprocal Lev0 Density coefficients on LevS! (not so trivial) 709 //x += sqrt(Dens->DensityCArray[HGDensity][g].re*Dens->DensityCArray[HGDensity][g].re+Dens->DensityCArray[HGDensity][g].im*Dens->DensityCArray[HGDensity][g].im);710 x += sqrt(Dens->DensityCArray[HGDensity][g].re*Dens->DensityCArray[HGDensity][g].re+Dens->DensityCArray[HGDensity][g].im*Dens->DensityCArray[HGDensity][g].im); 710 711 x -= T/(double)Num; 711 712 K = x/(x*x+stay_above*stay_above); … … 797 798 d[1] = GradSP(P,LevS,ConDir,HConDir); 798 799 d[2] = GradSP(P,LevS,ConDir,ConDir); 799 d[3] = 0 .;800 d[3] = 0; 800 801 801 802 // gather results … … 808 809 ConDirHConDir = D[1]; 809 810 ConDirConDir = D[2]; 811 //sourceHsource = D[3]; 810 812 ddEddt0 = 0.0; 811 813 //if (ConDir != P->Grad.GradientArray[ConDirGradient]) Error(SomeError,"FindPerturbedMinimum: ConDir corrupted"); 812 814 //if (H1c_grad != P->Grad.GradientArray[H1cGradient]) Error(SomeError,"FindPerturbedMinimum: H1c_grad corrupted"); 815 //fprintf(stderr, "lambda*PsiFactor %lg vs. sourceHSource %lg\n", Lat->Psi.AddData[R->ActualLocalPsiNo].Lambda * Psi->LocalPsiStatus[R->ActualLocalPsiNo].PsiFactor, sourceHsource); 816 // note: they really are exactly the same! 813 817 ddEddt0 = Calculate2ndPerturbedDerivative(P, LevS->LPsi->LocalPsi[p], source, ConDir, Lat->Psi.AddData[R->ActualLocalPsiNo].Lambda * Psi->LocalPsiStatus[R->ActualLocalPsiNo].PsiFactor, ConDirHConDir, ConDirConDir); 818 //ddEddt0 = 1.e+5; 814 819 815 820 for (i=MAXOLD-1; i > 0; i--) … … 822 827 //if (isnan(ddEddt0)) { fprintf(stderr,"(%i) WARNING in CalculateLineSearch(): ddEddt0_%i[%i] = NaN!\n", P->Par.me, i, 0); Error(SomeError, "NaN-Fehler!"); } 823 828 824 ////deltaI = CalculateDeltaI(E0, dEdt0, ddEddt0,825 ////&EI, &dEI, &ddEI, &dcosI, &dsinI);826 ////delta = deltaI; E = EI; dE = dEI; ddE = ddEI; dcos = dcosI; dsin = dsinI;827 if (ddEddt0 > 0) {828 delta = - dEdt0/ddEddt0;829 E = E0 + delta * dEdt0 + delta*delta/2. * ddEddt0;830 } else {831 delta = 0.;832 E = E0;833 fprintf(stderr,"(%i) Taylor approximation leads not to minimum!\n",P->Par.me);834 }829 deltaI = CalculateDeltaI(E0, dEdt0, ddEddt0, 830 &EI, &dEI, &ddEI, &dcosI, &dsinI); 831 delta = deltaI; E = EI; dE = dEI; ddE = ddEI; dcos = dcosI; dsin = dsinI; 832 // if (ddEddt0 > 0) { 833 // delta = - dEdt0/ddEddt0; 834 // E = E0 + delta * dEdt0 + delta*delta/2. * ddEddt0; 835 // } else { 836 // delta = 0.; 837 // E = E0; 838 // fprintf(stderr,"(%i) Taylor approximation leads not to minimum!\n",P->Par.me); 839 // } 835 840 836 841 // shift energy delta values … … 872 877 * As wave functions are stored in the reciprocal basis set, the application is straight-forward, 873 878 * for every G vector, the by \a index specified component is multiplied with the respective 874 * coefficient. Afterwards, 1/i is applied by flipping real and imaginary components (and an additional minus sign on the new imaginary term).879 * coefficient. Afterwards, 1/i is applied by flipping real and imaginary components and an additional minus sign on the new imaginary term. 875 880 * \param *P Problem at hand 876 881 * \param *source complex coefficients of wave function \f$\varphi(G)\f$ … … 1495 1500 result += Elambda; 1496 1501 //fprintf(stderr,"(%i) 1st: Elambda = \t%lg\n", P->Par.me, Elambda); 1497 1502 1498 1503 E1 = 2.*GradSP(P,LevS,ConDir,H1c_grad) * sqrt(Psi->AllPsiStatus[ActNum].PsiFactor*Psi->LocalPsiStatus[R->ActualLocalPsiNo].PsiFactor); 1499 1504 result += E1; … … 1532 1537 struct RunStruct *R = &P->R; 1533 1538 struct Psis *Psi = &P->Lat.Psi; 1534 //struct Lattice *Lat = &P->Lat;1535 //struct Energy *E = Lat->E;1539 struct Lattice *Lat = &P->Lat; 1540 struct Energy *E = Lat->E; 1536 1541 double result = 0.; 1537 double Con0 = 0., Elambda = 0. ;//, E0 = 0., E1 = 0.;1538 //int i;1542 double Con0 = 0., Elambda = 0., Elambda2 = 0., E0 = 0., E1 = 0.; 1543 int i; 1539 1544 const int state = R->CurrentMin; 1540 1545 //const int l_normal = R->ActualLocalPsiNo - Psi->TypeStartIndex[state] + Psi->TypeStartIndex[Occupied]; … … 1543 1548 Con0 = 2.*ConDirHConDir; 1544 1549 result += Con0; 1545 ////E0 = -2.*sourceHsource;1546 ////result += E0;1547 ////E1 = -E->PsiEnergy[Perturbed1_0Energy][R->ActualLocalPsiNo] - E->PsiEnergy[Perturbed0_1Energy][R->ActualLocalPsiNo];1548 // //result += E1;1550 E0 = -2.*sourceHsource; 1551 result += E0; 1552 E1 = -E->PsiEnergy[Perturbed1_0Energy][R->ActualLocalPsiNo] - E->PsiEnergy[Perturbed0_1Energy][R->ActualLocalPsiNo]; 1553 //result += E1; 1549 1554 //fprintf(stderr,"(%i) 2nd: E1 = \t%lg\n", P->Par.me, E1); 1550 1551 ////for (i=0;i<Lat->Psi.NoOfPsis;i++) { 1552 //// if (i != ActNum) Elambda += Psi->lambda[i][ActNum]*Psi->Overlap[i][ActNum]+ Psi->lambda[ActNum][i]*Psi->Overlap[ActNum][i]; // overlap contains PsiFactor 1553 ////} 1554 ////Elambda = Psi->lambda[ActNum][ActNum]*Psi->Overlap[ActNum][ActNum]; 1555 Elambda = 2.*Psi->lambda[ActNum][ActNum]*ConDirConDir; 1556 result -= Elambda; 1557 1558 //fprintf(stderr,"(%i) 2ndPerturbedDerivative: Result = Con0 + E0 + E1 + Elambda + dEdt0_XC + ddEddt0_XC + dEdt0_H + ddEddt0_H = %lg + %lg + %lg + %lg + %lg + %lg + %lg + %lg = %lg\n", P->Par.me, Con0, E0, E1, Elambda, VolumeFactorR*dEdt0_XC, VolumeFactorR*ddEddt0_XC, dEdt0_H, ddEddt0_H, result); 1555 1556 for (i=0;i<Lat->Psi.NoOfPsis;i++) { 1557 if (i != ActNum) 1558 Elambda += Psi->lambda[i][ActNum]*Psi->Overlap[i][ActNum]+ Psi->lambda[ActNum][i]*Psi->Overlap[ActNum][i]; // overlap contains PsiFactor 1559 } 1560 Elambda = Psi->lambda[ActNum][ActNum]*Psi->Overlap[ActNum][ActNum]; 1561 result += Elambda; 1562 Elambda2 = 2.*Psi->lambda[ActNum][ActNum]*ConDirConDir; 1563 result -= Elambda2; 1564 1565 //fprintf(stderr,"(%i) 2ndPerturbedDerivative: Result = Con0 + E0 + E1 + Elambda + Elambda2 = %lg + %lg + %lg + %lg + %lg = %lg\n", P->Par.me, Con0, E0, E1, Elambda, Elambda2, result); 1559 1566 1560 1567 return (result); … … 2206 2213 } 2207 2214 2208 int wished= -1;2215 int CurrentOrbital = -1; 2209 2216 FILE *file = fopen(P->Call.MainParameterFile,"r"); 2210 if (!ParseForParameter(0,file,"Orbital",0,1,1,int_type,& wished, 1, optional)) {2217 if (!ParseForParameter(0,file,"Orbital",0,1,1,int_type,&CurrentOrbital, 1, optional)) { 2211 2218 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital missing, using: All!\n"); 2212 wished= -1;2213 } else if ( wished!= -1) {2214 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: %i.\n", wished);2219 CurrentOrbital = -1; 2220 } else if (CurrentOrbital != -1) { 2221 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: %i.\n", CurrentOrbital); 2215 2222 } else { 2216 2223 if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: All.\n"); … … 2220 2227 // Commence grid filling 2221 2228 for (k=Psi->TypeStartIndex[Occupied];k<Psi->TypeStartIndex[Occupied+1];k++) // every local wave functions adds up its part of the current 2222 if ((k + P->Par.me_comm_ST_PsiT*(Psi->TypeStartIndex[UnOccupied]-Psi->TypeStartIndex[Occupied]) == wished) || (wished== -1)) { // compare with global number2229 if ((k + P->Par.me_comm_ST_PsiT*(Psi->TypeStartIndex[UnOccupied]-Psi->TypeStartIndex[Occupied]) == CurrentOrbital) || (CurrentOrbital == -1)) { // compare with global number 2223 2230 if (P->Call.out[StepLeaderOut]) fprintf(stderr,"(%i)Calculating Current Density Summand of type %s for Psi (%i/%i) ... \n", P->Par.me, R->MinimisationName[type], Psi->LocalPsiStatus[k].MyGlobalNo, k); 2224 2231 //ActNum = k - Psi->TypeStartIndex[Occupied] + Psi->TypeStartIndex[1] * Psi->LocalPsiStatus[k].my_color_comm_ST_Psi; // global number of unperturbed Psi … … 2278 2285 for (n[2]=0;n[2]<N[2];n[2]++) { 2279 2286 i0 = n[2]+N[2]*(n[1]+N[1]*n0); 2280 n[0]=n0 + N0*myPE; // global relative coordinate: due to partit oning of x-axis in PEPGamma>1 case2287 n[0]=n0 + N0*myPE; // global relative coordinate: due to partitioning of x-axis in PEPGamma>1 case 2281 2288 fac[0] = (double)n[0]/(double)N[0]; 2282 2289 fac[1] = (double)n[1]/(double)N[1]; … … 3500 3507 for (i=0;i<NDIM;i++) 3501 3508 fprintf(stderr,"\t%lg",gsl_vector_get(eval,i)); 3509 fprintf(stderr,"\n"); 3502 3510 } 3503 3511 if (P->Call.out[ValueOut]) { 3504 3512 if (P->Call.out[ReadOut]) 3505 fprintf(stderr,"moment : %e\n", iso);3513 fprintf(stderr,"moment : %e\n", iso); 3506 3514 else 3507 3515 fprintf(stderr,"%e\n", iso); 3508 3516 } 3509 if (P->Call.out[ReadOut]) { 3517 if (P->Call.out[ReadOut]) { 3510 3518 fprintf(stderr,"anisotropy : %e\n", delta_moment); 3511 3519 fprintf(stderr,"asymmetry : %e\n", eta);
Note:
See TracChangeset
for help on using the changeset viewer.
