k-dot-p 0.1

kdotp::libkdotp::wavefunction Namespace Reference

Classes

class  cartesian_effective_mass

Functions

___const unsigned int get_cartesian_effective_mass_block_index (unsigned int i, unsigned int eigvec, unsigned int L)
double get_average_with_cartesian_effective_mass_block (double *block, unsigned int eigvec, unsigned int L, double *func)
GError * init_density_1d_from_cartesian_effective_mass_block (double *block, unsigned int eigvec, unsigned int L, double dx, struct density_1d *density)
double get_cartesian_effective_mass_block_max_delta (double *block1, unsigned vec1, double *block2, unsigned vec2, unsigned int L)

Function Documentation

double kdotp::libkdotp::wavefunction::get_average_with_cartesian_effective_mass_block ( double *  block,
unsigned int  eigvec,
unsigned int  L,
double *  func 
)

Gets the average of a function with an eigenvector in the block of eigvecs

Parameters:
blockthe block to get the eigenvector
eigvecwhich eigenvector in the block
Lnumber of grid sites in a wavefunc
valuespointer to an array of doubles holding the function across the wavefunction
Returns:
the expectation value of the function

Definition at line 41 of file wavefunction_cartesian_effective_mass.c++.

Referenced by calculate_alpha_for_structure(), and main().

                                                                                                                               {
  double avg = 0;
  for(unsigned int i=0; i<L; i++) avg += block[L*eigvec + i]*block[L*eigvec + i]*func[i];
  return avg;
      }

Here is the caller graph for this function:

___const unsigned int kdotp::libkdotp::wavefunction::get_cartesian_effective_mass_block_index ( unsigned int  i,
unsigned int  eigvec,
unsigned int  L 
)

Gets the index into a block (returned by e.g. LAPACK) of eigenvecs

Parameters:
igrid site of the eigenvector
eigvecwhich eigenvec in the block
Lthe number of grid sites

Definition at line 37 of file wavefunction_cartesian_effective_mass.c++.

                                                                                                                          {
  return L*eigvec + i;
      }
double kdotp::libkdotp::wavefunction::get_cartesian_effective_mass_block_max_delta ( double *  block1,
unsigned  vec1,
double *  block2,
unsigned  vec2,
unsigned int  L 
)

Definition at line 64 of file wavefunction_cartesian_effective_mass.c++.

Referenced by calculate_alpha_for_structure(), and main().

                                                                                                                                        {
  //fprintf(stderr, "In get_cartesian_effective_mass_block_max_delta:\n");
  if((block1 == NULL) || (block2 == NULL)) return -1;
  double max_change = fabs(block1[L*vec1]*block1[L*vec1] - block2[L*vec2]*block2[L*vec2]);
  register double change;
  for(unsigned int i=1; i<L; i++) {
    change = fabs(block1[L*vec1+i]*block1[L*vec1+i] - block2[L*vec2+i]*block2[L*vec2+i]);
    //fprintf(stderr, "\t%u: change=%g maxchange=%g (%g-%g)\n", i, change, max_change, block1[L*vec1+i]*block1[L*vec1+i], block2[L*vec2+i]*block2[L*vec2+i]);
    if(change > max_change) max_change = change;
  }
  //fprintf(stderr, "\tmaxchange=%g\n",  max_change);
  return fabs(max_change);
      }

Here is the caller graph for this function:

GError * kdotp::libkdotp::wavefunction::init_density_1d_from_cartesian_effective_mass_block ( double *  block,
unsigned int  eigvec,
unsigned int  L,
double  dx,
struct density_1d *  density 
)

Sets the points to the density from this wavefunction.

Parameters:
blockthe block of eigenvalues
eigvecwhich eigenvector to use in the block
Lthe number of points in each wave function in the block
dxinter-node spacing
densitypre-allocated structure to store density in.
Returns:
pointer to GError
Note:
the density has already been allocated!

Definition at line 56 of file wavefunction_cartesian_effective_mass.c++.

References unlikely, and WAVEFUNCTION_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN.

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

                                                                                                                                                             {
  if(unlikely(density->N != L)) return g_error_new(WAVEFUNCTION_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 1, "::kdotp::libkdotp::wavefunction::wavefunction_cartesian_effective_mass.c++::init_density_1d_from_carteisan_effective_mass_block: allocated size of the density's storage (%u) and the number of points in the %u-th eigenvector (%u) don't agree!", density->N, eigvec, L);
  density->dx = dx;
  density->N = L;
  for(unsigned int i=0; i<L; i++) density->storage[i] = block[L*eigvec + i]*block[L*eigvec + i];
  return NULL;
      }

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines