Changeset 807e8a


Ignore:
Timestamp:
May 30, 2008, 3:48:16 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
9842d8
Parents:
0fe2ca
Message:

libblas needed for libgsl is now found via AC_SEARCH_LIB and list blas cblas gslblas gslcblas

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/configure.ac

    r0fe2ca r807e8a  
    3636# Checks for library functions.
    3737# check for GNU Scientific Library
    38 AC_CHECK_LIB(blas,main)
     38AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas)
    3939AC_CHECK_LIB(gsl,main)
    4040
  • pcp/configure.ac

    r0fe2ca r807e8a  
    179179# check for GNU Scientific Library
    180180#AC_CHECK_LIB(m,main)
    181 AC_CHECK_LIB(blas,main)
    182 AC_CHECK_LIB(gsl,main)
     181AC_SEARCH_LIBS(cblas_sdot, blas cblas gslblas gslcblas)
     182AC_CHECK_LIB(gsl, main)
    183183
    184184dnl Check for "extern inline", using a modified version
  • pcp/src/perturbed.c

    r0fe2ca r807e8a  
    360360  double lambda, Lambda;
    361361  double RElambda10, RELambda10;
     362  //double RElambda01, RELambda01;
    362363  const fftw_complex *source = LevS->LPsi->LocalPsi[l];
    363364  fftw_complex *grad = P->Grad.GradientArray[ActualGradient];
     
    472473  // "-" due to purely imaginary wave function is on left hand side, thus becomes complex conjugated: i -> -i
    473474  // (-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);
    476477 
    477478  MPI_Allreduce ( &RElambda10, &RELambda10, 1, MPI_DOUBLE, MPI_SUM, P->Par.comm_ST_Psi);
     
    622623}
    623624
    624 #define stay_above 0.001 //!< value above which the coefficient of the wave function will always remain
     625#define stay_above 0.00001 //!< value above which the coefficient of the wave function will always remain
    625626
    626627/** Finds the minimum of perturbed energy in regards of actual wave function.
     
    673674  double LocalSP, PsiSP;
    674675  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;
    678679  //double HartreeddEddt0, XCddEddt0;
    679680  double d[4],D[4], Diff;
     
    707708    x = .5*LevS->GArray[g].GSq;
    708709    // 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);
    710711    x -= T/(double)Num;
    711712    K = x/(x*x+stay_above*stay_above);
     
    797798  d[1] = GradSP(P,LevS,ConDir,HConDir);
    798799  d[2] = GradSP(P,LevS,ConDir,ConDir);
    799   d[3] = 0.;
     800  d[3] = 0;
    800801
    801802  // gather results 
     
    808809  ConDirHConDir = D[1];
    809810  ConDirConDir = D[2];
     811  //sourceHsource = D[3];
    810812  ddEddt0 = 0.0;
    811813  //if (ConDir != P->Grad.GradientArray[ConDirGradient]) Error(SomeError,"FindPerturbedMinimum: ConDir corrupted");
    812814  //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!
    813817  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;
    814819
    815820  for (i=MAXOLD-1; i > 0; i--)
     
    822827  //if (isnan(ddEddt0)) { fprintf(stderr,"(%i) WARNING in CalculateLineSearch(): ddEddt0_%i[%i] = NaN!\n", P->Par.me, i, 0); Error(SomeError, "NaN-Fehler!"); }
    823828
    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//  }
    835840
    836841  // shift energy delta values
     
    872877 * As wave functions are stored in the reciprocal basis set, the application is straight-forward,
    873878 * 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.
    875880 * \param *P Problem at hand
    876881 * \param *source complex coefficients of wave function \f$\varphi(G)\f$
     
    14951500  result += Elambda;
    14961501  //fprintf(stderr,"(%i) 1st: Elambda = \t%lg\n", P->Par.me, Elambda);
    1497 
     1502 
    14981503  E1 =  2.*GradSP(P,LevS,ConDir,H1c_grad) * sqrt(Psi->AllPsiStatus[ActNum].PsiFactor*Psi->LocalPsiStatus[R->ActualLocalPsiNo].PsiFactor);
    14991504  result += E1;
     
    15321537  struct RunStruct *R = &P->R;
    15331538  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;
    15361541  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;
    15391544  const int state = R->CurrentMin;
    15401545  //const int l_normal = R->ActualLocalPsiNo - Psi->TypeStartIndex[state] + Psi->TypeStartIndex[Occupied];
     
    15431548  Con0 = 2.*ConDirHConDir;
    15441549  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;
    15491554  //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);
    15591566
    15601567  return (result);
     
    22062213  }
    22072214 
    2208   int wished = -1;
     2215  int CurrentOrbital = -1;
    22092216  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)) {
    22112218     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);
    22152222  } else {
    22162223     if (P->Call.out[ReadOut]) fprintf(stderr,"Desired Orbital is: All.\n");
     
    22202227   // Commence grid filling
    22212228  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 number
     2229    if ((k + P->Par.me_comm_ST_PsiT*(Psi->TypeStartIndex[UnOccupied]-Psi->TypeStartIndex[Occupied]) == CurrentOrbital) || (CurrentOrbital == -1)) {  // compare with global number
    22232230    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);
    22242231    //ActNum = k - Psi->TypeStartIndex[Occupied] + Psi->TypeStartIndex[1] * Psi->LocalPsiStatus[k].my_color_comm_ST_Psi; // global number of unperturbed Psi
     
    22782285              for (n[2]=0;n[2]<N[2];n[2]++) {
    22792286                i0 = n[2]+N[2]*(n[1]+N[1]*n0);
    2280                 n[0]=n0 + N0*myPE; // global relative coordinate: due to partitoning of x-axis in PEPGamma>1 case
     2287                n[0]=n0 + N0*myPE; // global relative coordinate: due to partitioning of x-axis in PEPGamma>1 case
    22812288                fac[0] = (double)n[0]/(double)N[0];
    22822289                fac[1] = (double)n[1]/(double)N[1];
     
    35003507        for (i=0;i<NDIM;i++)
    35013508          fprintf(stderr,"\t%lg",gsl_vector_get(eval,i));
     3509        fprintf(stderr,"\n");
    35023510      }
    35033511      if (P->Call.out[ValueOut]) {
    35043512        if (P->Call.out[ReadOut])
    3505           fprintf(stderr,"moment  : %e\n", iso);
     3513          fprintf(stderr,"moment     : %e\n", iso);
    35063514        else
    35073515          fprintf(stderr,"%e\n", iso);
    35083516      }
    3509       if (P->Call.out[ReadOut]) {
     3517      if (P->Call.out[ReadOut]) { 
    35103518        fprintf(stderr,"anisotropy : %e\n", delta_moment);
    35113519        fprintf(stderr,"asymmetry  : %e\n", eta);
Note: See TracChangeset for help on using the changeset viewer.