k-dot-p 0.1

kdotp::libmetacalc::self_consistent Namespace Reference

Classes

class  self_consistent_potential

Typedefs

typedef double(* ooms_averager )(double *block, unsigned int eigvec, unsigned int L, double *func)
typedef double(* wavefunction_max_delta_callback )(double *block1, unsigned vec1, double *block2, unsigned vec2, unsigned L)

Functions

double get_Ef_2D (unsigned int Neigs, double *eigs, double *avg_ooms, int *last_eig, double total_density)
void potential_mixing_callback (int X, unsigned N, double dx, double *restrict to, double from, void *mixing_pct)

Typedef Documentation

typedef double(* kdotp::libmetacalc::self_consistent::ooms_averager)(double *block, unsigned int eigvec, unsigned int L, double *func)

Definition at line 43 of file calculation_self_consistent_potential.h++.

typedef double(* kdotp::libmetacalc::self_consistent::wavefunction_max_delta_callback)(double *block1, unsigned vec1, double *block2, unsigned vec2, unsigned L)

Definition at line 44 of file calculation_self_consistent_potential.h++.


Function Documentation

double kdotp::libmetacalc::self_consistent::get_Ef_2D ( unsigned int  Neigs,
double *  eigs,
double *  avg_ooms,
int *  last_eig,
double  total_density 
)

Gets the Fermi energy for a set of eigenvalues (2D DoS)

Parameters:
Neigsnumber of eigenvalues in the array (extras are OK; just don't have fewer eigs than this
eigsthe array of eigenvalues
last_eigpointer to an unsigned int to store the last eig. If this is the last one, we can't be sure that Ef is the correct Ef; there may be a higher-energy subband that would fill!
Returns:
the Fermi energy

Definition at line 33 of file calculation_self_consistent_potential.c++.

References kdp::constants::hbar, and kdp::constants::m0.

Referenced by kdotp::libmetacalc::self_consistent::self_consistent_potential< ::kdotp::libkdotp::hamiltonian::cartesian_effective_mass, 1 >::perform_calculation().

                                                                                                                {
  double sumA=0;
  double sumB=0;
  double Ef;
  for(unsigned int i=0; i<Neigs; i++) {
    /*Sum up from the individual subbands*/
    fprintf(stderr, "i=%u\n", i);
    sumA = sumB = 0;
    for(int j=i; j>=0; j--) {
      fprintf(stderr, "\tj=%d sumA=%g sumB=%g avg_ooms[%d]=%g eigs[%d]=%g\n", j, sumA, sumB, j, avg_ooms[j], j, eigs[j]);
      sumA += eigs[j]/avg_ooms[j];
      sumB += 1.0/avg_ooms[j];
    }
    Ef = (total_density*hbar*hbar/(2*M_PI*m0) + sumA)/sumB;
    fprintf(stderr, " Ef=%g: ", Ef);
    if((i==(Neigs-1)) || (Ef <= eigs[i+1])) {
      if(i==(Neigs-1)) {
        fprintf(stderr, " <eigs[%d]=%g\n", i+1, eigs[i+1]);
      }else{
        fprintf(stderr, " i==Neigs(%u)\n", Neigs);
      }
      *last_eig = i;
      return Ef;
    }else{
      fprintf(stderr, "\n");
    }
  }
  *last_eig=Neigs+1;
  return 0;
      }

Here is the caller graph for this function:

void kdotp::libmetacalc::self_consistent::potential_mixing_callback ( int  X,
unsigned  N,
double  dx,
double *restrict  to,
double  from,
void *  mixing_pct 
)

callback for mixing the potentials (search for "Mix the potentials" below)

Note:
simple: just add the two together!

callback for mixing the potentials (search for "Mix the potentials" below)

Definition at line 67 of file calculation_self_consistent_potential.c++.

Referenced by kdotp::libmetacalc::self_consistent::self_consistent_potential< ::kdotp::libkdotp::hamiltonian::cartesian_effective_mass, 1 >::perform_calculation().

                                                                                                                       {
  *to = from + (*to - from)*(*(double*)mixing_pct);
      }

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines