k-dot-p 0.1

kdotp::libkdotp::hamiltonian::cartesian_effective_mass Class Reference

#include <hamiltonian_cartesian_effective_mass.h++>

Collaboration diagram for kdotp::libkdotp::hamiltonian::cartesian_effective_mass:

List of all members.

Public Member Functions

int get_matrix_index (unsigned int row, unsigned int col)
int get_array_index (unsigned int row, unsigned int col)
void set_up_matrix ()
void update_matrix_with_internal_potential (double *old_potential)
void replace_internal_potential (double *new_potential)
double * get_eigenvectors_double (double eVmin, double eVmax, double **evals, int *n_eigs, GError **err)
double * get_eigenvectors_int (int imin, int imax, double **evals, int *n_eigs, GError **err)
double * get_eigenvectors (char VoI, double eVmin, double eVmax, int imin, int imax, double **evals, int *n_eigs, GError **err)
int get_parameter_function (int p, double *function)
 cartesian_effective_mass (struct libmodelxx::structure::generic_structure *gs, boundary_condition bc_, bool second_neighbor_)
 ~cartesian_effective_mass ()

Public Attributes

double * upper_diagonal
double * diagonal
double * matrix
double * Q
unsigned int L
double dx
enum boundary_condition bc
bool second_neighbor
int n_neighbors
double * internal_potential
struct effective_mass_propertiesproperties
libmodelxx::grid::cartesian_grid
< libmodelxx::structure::material *, 1, 1 > * 
matgrid
libmodelxx::grid::cartesian_grid
< double, 1, 1 > * 
potgrid

Private Member Functions

 cartesian_effective_mass ()
cartesian_effective_mass operator= (const cartesian_effective_mass &em)

Detailed Description

Definition at line 59 of file hamiltonian_cartesian_effective_mass.h++.


Constructor & Destructor Documentation

kdotp::libkdotp::hamiltonian::cartesian_effective_mass::cartesian_effective_mass ( struct libmodelxx::structure::generic_structure gs,
boundary_condition  bc_,
bool  second_neighbor_ 
)

Definition at line 66 of file hamiltonian_cartesian_effective_mass.c++.

References kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::a, bc, kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::data, diagonal, dx, kdotp::libkdotp::hamiltonian::effective_mass_properties::Ec, kdotp::libkdotp::hamiltonian::effective_mass_properties::epsilon, kdotp::libmodelxx::structure::material::get_property(), kdotp::libkdotp::hamiltonian::HARDWALL, internal_potential, kdotp::libmodelxx::grid::cartesian_grid< T, D, Nc >::L, L, kdotp::libmodelxx::structure::generic_structure::material_grid, matrix, n_neighbors, kdotp::libkdotp::hamiltonian::effective_mass_properties::ooms, kdotp::libkdotp::hamiltonian::effective_mass_properties::potential, kdotp::libmodelxx::structure::generic_structure::potential_grid, properties, second_neighbor, set_up_matrix(), and upper_diagonal.

  : upper_diagonal(NULL), 
    diagonal(NULL), 
    matrix(NULL), 
    Q(NULL), 
    bc(bc_), 
    second_neighbor(second_neighbor_), 
    internal_potential(NULL),
    matgrid(NULL),
    potgrid(NULL)
      {
  n_neighbors=second_neighbor_?2:1;
  matgrid = (matgrid_t*)(gs->material_grid);
  potgrid = (potgrid_t*)(gs->potential_grid);
  L = matgrid->L[0];
  /*Allocate and set the internal potential when we're constructed.*/
  internal_potential = (double*)malloc(sizeof(double)*L);
  /*The internal potential is initially set to 0*/
  for(unsigned int i=0; i<L; i++) internal_potential[i] = 0;
        if(bc == HARDWALL) {
    if(second_neighbor) {
      matrix = (double*)malloc(sizeof(double)*(n_neighbors+1)*L);
      if(matrix == NULL) {
        fprintf(stderr, "Error allocating matrix.\n");
        return;
      }
    }else{
      upper_diagonal = (double*)malloc(sizeof(double)*(L-1));
      if(upper_diagonal == NULL) {
        fprintf(stderr, "Error allocating upper diagonal.\n");
        return;
      }
      diagonal = (double*)malloc(sizeof(double)*L);
      if(diagonal == NULL) {
        fprintf(stderr, "Error allocating diagonal.\n");
        return;
      }
    }
  }else{
    matrix = (double*)malloc(sizeof(double)*L*L);
    if(matrix == NULL) {
      fprintf(stderr, "Error allocating matrix.\n");
      return;
    }
  }
  dx = matgrid->a[0];
  properties = (struct effective_mass_properties*)malloc(sizeof(struct effective_mass_properties)*L);
  if(properties == NULL) {
    fprintf(stderr, "Error allocating properties.\n");
    return;
  }
  int e2=0;
  double Eg, Ev;
  Eg = Ev = 0;
  for(unsigned int i=0; i<L; i++) {
    properties[i].ooms = 1.0/matgrid->data[i]->get_property("m_e_Gamma", &e2);
      if(e2 != 0) {
        fprintf(stderr, "hamiltonians::cartesian_effective_mass: ERROR getting m_e_Gamma (err=%d).\n", e2);
        e2=0;
      }
      properties[i].epsilon = matgrid->data[i]->get_property("epsilon_0", &e2);
      if(e2 != 0) {
        fprintf(stderr, "hamiltonians::cartesian_effective_mass: ERROR getting epsilon_0 (err=%d).\n", e2);
        e2=0;
      }
      Eg = matgrid->data[i]->get_property("E_g_Gamma", &e2);
      if(e2 != 0) {
        fprintf(stderr, "hamiltonians::cartesian_effective_mass: ERROR getting E_g_Gamma (err=%d).\n", e2);
        e2=0;
      }
      Ev = matgrid->data[i]->get_property("E_v", &e2);
      if(e2 != 0) {
        fprintf(stderr, "hamiltonians::cartesian_effective_mass: ERROR getting E_v (err=%d).\n", e2);
        e2=0;
      }
      properties[i].Ec = Ev + Eg;
      properties[i].potential = potgrid->data[i];
  }
  set_up_matrix();
      }

Here is the call graph for this function:

kdotp::libkdotp::hamiltonian::cartesian_effective_mass::~cartesian_effective_mass ( )

Definition at line 45 of file hamiltonian_cartesian_effective_mass.c++.

                                                          {
  /*We do a bunch of these frees.  Cluster them.  If they're not NULL, free them.
   *Note that these are pointers to pointers; we keep going until the array entry is NULL (if it's a real member of this class, it won't be NULL
   */
  void** things_to_free[] = {
    (void**)&upper_diagonal,
    (void**)&diagonal,
    (void**)&matrix,
    (void**)&Q,
    (void**)&internal_potential,
    /*don't free matgrid or potgrid; they are still in use!*/
    NULL
  };
  for(int i=0; things_to_free[i] != NULL; i++) {
    if(*things_to_free[i] != NULL) {
      free(*things_to_free[i]);
      *things_to_free[i] = NULL;
    }
  }
      }
kdotp::libkdotp::hamiltonian::cartesian_effective_mass::cartesian_effective_mass ( ) [inline, private]

Definition at line 162 of file hamiltonian_cartesian_effective_mass.h++.

{}

Member Function Documentation

int kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_array_index ( unsigned int  row,
unsigned int  col 
) [inline]

Converts an upper subdiagonal and index into an index into the array

Note:
that the 0 subdiagonal is the diagonal

Definition at line 94 of file hamiltonian_cartesian_effective_mass.h++.

References n_neighbors.

Referenced by set_up_matrix(), and update_matrix_with_internal_potential().

                                                                 {
    /*Addresses are (kd+1+i-j), j
     *i = row index
     *j = column index
     *row index = n_neighbors + 1 + i - j - 1 (start at 0 in C)
     *row index = n_neighbors + (i - j)
     *i, i+n (n-th column of 1st superdiag) ->
     *  j = i+n => row index = n_neighbors - n
     *             col index = i + n
     *there are n_neighbors + 1 rows.
     */
    return n_neighbors + (row - col) + (n_neighbors+1)*col;
    //return (n_neighbors - subdiagonal) + i*(n_neighbors+1);
  }

Here is the caller graph for this function:

double * kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_eigenvectors ( char  VoI,
double  eVmin,
double  eVmax,
int  imin,
int  imax,
double **  evals,
int *  n_eigs,
GError **  err 
)

Definition at line 294 of file hamiltonian_cartesian_effective_mass.c++.

References bc, diagonal, kdotp::libkdotp::hamiltonian::HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, L, matrix, n_neighbors, kdotp::libkdotp::hamiltonian::PERIODIC, Q, second_neighbor, and upper_diagonal.

Referenced by get_eigenvectors_double(), and get_eigenvectors_int().

                                                                                                                                                             {
  int info;
  if ((bc == PERIODIC) && (diagonal == NULL) && (upper_diagonal == NULL) && (Q == NULL)) {
    /*If we're not hardwall, we first have to reduce to tridiagonal.*/
    /*We're a symmetric matrix, but not tridiag.
     *Call DSYTRD to get the tri-diag matrix*/
    /*Call DORGTR to get the matrix Q to convert the eigenfunctions back to the position basis.*/
  } else if (second_neighbor && (diagonal == NULL) && (upper_diagonal == NULL) && (Q == NULL)) {
    /*We're a banded matrix.*/
    /*Call DSBTRD to get the tri-diagonal matrix and Q*/
    info = llw_real_double_sbtrd_a('V', 'U', L, n_neighbors, matrix, n_neighbors+1, &diagonal, &upper_diagonal, &Q);
    if(info != 0) {
      *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 1, "Got error from llw_real_double_sbtrd_a: %d\n", info);
      if(diagonal != NULL) {
        free(diagonal);
        diagonal = NULL;
      }
      if(upper_diagonal != NULL) {
        free(upper_diagonal);
        upper_diagonal = NULL;
      }
      if(Q != NULL) {
        free(Q);
        Q = NULL;
      }
      return NULL;
    }
  }
  double *eigvecs;
  int n_eigvecs;
  int* isuppz;
  info = llw_real_double_stegr_a('V', VoI, L, diagonal, upper_diagonal, eVmin, eVmax, imin, imax, n_eigs, evals, &eigvecs, &n_eigvecs, &isuppz);
  if((n_eigvecs <= *n_eigs) || (info != 0)) {
    if(n_eigvecs <= *n_eigs) {
      *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 6, "in return from llw_real_double_stegr_a: failed to get same number or more eigenvec storage than there were eigenvals (%d and %d, respectively)", n_eigvecs, *n_eigs);
    }else{
      if(info < 0) {
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 1, "Bad argument to LAPACK call DSTEGR: %d\n", -info);
      }else if(info < 10) {
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 2, "Error in BLAS call DLARRE called by LAPACK call DSGEGR: %d\n", info);
      }else if(info < 20) {
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 3, "Error in BLAS call DLARRV called by LAPACK call DSGEGR: %d\n", info/2);
      }else if(info == 100) {
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 5, "Error in liblapackwrap llw_real_double_stegr_a: malloc failed (%d)\n", info/100);
      }else{
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 4, "Got error (info=%d) from DSTEGR, but don't know what it means.\n", info);
      }
    }
    fprintf(stderr, "Got error; freeing evals\n");
    free(*evals);
    free(eigvecs);
    *evals=NULL;
    eigvecs=NULL;
  }else{
    free(isuppz);
    if(Q != NULL) {
      fprintf(stderr, "Transforming eigenvectors by Q.\n");
      double* final_eigvecs = NULL;
      double one = 1.0;
      info = llw_real_double_gemm_a('N', 'N', L, n_eigvecs, L, &one, Q, L, eigvecs, L, &final_eigvecs);
      if(info != 0) {
        *err = g_error_new(HAMILTONIAN_CARTESIAN_EFFECTIVE_MASS_GERROR_DOMAIN, 4, "Got error (info=%d) from llw_real_double_gemmm_a\n", info);
        if(final_eigvecs != NULL) free(final_eigvecs);
        return eigvecs;
      }
      free(eigvecs);
      return final_eigvecs;
    }
  }
  return eigvecs;
      }

Here is the caller graph for this function:

double* kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_eigenvectors_double ( double  eVmin,
double  eVmax,
double **  evals,
int *  n_eigs,
GError **  err 
) [inline]

Definition at line 115 of file hamiltonian_cartesian_effective_mass.h++.

References get_eigenvectors().

                                                                                                         {
    return get_eigenvectors('V', eVmin, eVmax, 0, 0, evals, n_eigs, err);
  }

Here is the call graph for this function:

double* kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_eigenvectors_int ( int  imin,
int  imax,
double **  evals,
int *  n_eigs,
GError **  err 
) [inline]

Definition at line 118 of file hamiltonian_cartesian_effective_mass.h++.

References get_eigenvectors().

                                                                                              {
    return get_eigenvectors('I', 0, 0, imin, imax, evals, n_eigs, err);
  }

Here is the call graph for this function:

int kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_matrix_index ( unsigned int  row,
unsigned int  col 
) [inline]

Converts row column into matrix array address

Definition at line 90 of file hamiltonian_cartesian_effective_mass.h++.

References L.

Referenced by set_up_matrix(), and update_matrix_with_internal_potential().

{return col + row*L;}

Here is the caller graph for this function:

int kdotp::libkdotp::hamiltonian::cartesian_effective_mass::get_parameter_function ( int  p,
double *  function 
) [inline]

Gets a parameter across the structure

Parameters:
pthe effective mass parameter
functionarray to store the function in
Returns:
Error code: 1 if the parameter was invalid 0 success

Definition at line 129 of file hamiltonian_cartesian_effective_mass.h++.

References kdotp::libkdotp::hamiltonian::effective_mass_properties::Ec, kdotp::libkdotp::hamiltonian::EC, kdotp::libkdotp::hamiltonian::effective_mass_properties::epsilon, kdotp::libkdotp::hamiltonian::EPSILON, internal_potential, L, kdotp::libkdotp::hamiltonian::MSTAR, kdotp::libkdotp::hamiltonian::effective_mass_properties::ooms, kdotp::libkdotp::hamiltonian::OOMSTAR, kdotp::libkdotp::hamiltonian::effective_mass_properties::potential, kdotp::libkdotp::hamiltonian::POTENTIAL, properties, and kdotp::libkdotp::hamiltonian::TOTAL_POTENTIAL.

Referenced by main().

                                                      {
    for(unsigned int i=0; i<L; i++) {
      switch(p) {
      case OOMSTAR:
        function[i] = properties[i].ooms;
        break;
      case MSTAR:
        function[i] = 1.0/properties[i].ooms;
        break;
      case POTENTIAL:
        function[i] = properties[i].potential;
        break;
      case TOTAL_POTENTIAL:
        function[i] = properties[i].potential + internal_potential[i];
        //fprintf(stderr, "total_potential@%u: %g = extern (%g) + intern (%g)\n", i, function[i], properties[i].potential, internal_potential[i]);
        break;
      case EC:
        function[i] = properties[i].Ec;
        break;
      case EPSILON:
        function[i] = properties[i].epsilon;
        break;
      default:
        return 1;
      }
    }
    return 0;
  }

Here is the caller graph for this function:

cartesian_effective_mass kdotp::libkdotp::hamiltonian::cartesian_effective_mass::operator= ( const cartesian_effective_mass em) [inline, private]

Definition at line 163 of file hamiltonian_cartesian_effective_mass.h++.

{return *this;}
void kdotp::libkdotp::hamiltonian::cartesian_effective_mass::replace_internal_potential ( double *  new_potential)

Replaces the internal_potential array and then calls update_matrix_with_internal_potential()

Definition at line 165 of file hamiltonian_cartesian_effective_mass.c++.

References internal_potential, and update_matrix_with_internal_potential().

                                                                                     {
  double *old_potential = internal_potential;
        internal_potential = new_potential;
  update_matrix_with_internal_potential(old_potential);
  free(old_potential);
      }

Here is the call graph for this function:

void kdotp::libkdotp::hamiltonian::cartesian_effective_mass::set_up_matrix ( )

This sets the matrices to their new values.

Definition at line 172 of file hamiltonian_cartesian_effective_mass.c++.

References bc, diagonal, dx, kdotp::libkdotp::hamiltonian::effective_mass_properties::Ec, get_array_index(), get_matrix_index(), kdotp::libkdotp::hamiltonian::HARDWALL, kdp::constants::hbar, internal_potential, L, kdp::constants::m0, matrix, n_neighbors, kdotp::libkdotp::hamiltonian::effective_mass_properties::ooms, kdotp::libkdotp::hamiltonian::effective_mass_properties::potential, properties, second_neighbor, and upper_diagonal.

Referenced by cartesian_effective_mass().

                                                   {
  /*Set the values of our matrix members to 0 to ensure they're properly initialized before we go setting specific numbers*/
        if(bc == HARDWALL) {
    if(second_neighbor) {
      for(long unsigned i = 0; i<(n_neighbors+1)*L; i++) matrix[i] = 0;
    }else{
      for(unsigned int i=0; i<(L-1); i++) {
        upper_diagonal[i] = diagonal[i] = 0;
      }
      diagonal[L-1]=0;
    }
  }else{
    for(long unsigned int i=0; i<(L*L); i++) matrix[i] = 0;
  }
  int e2=0;
  /*hbar^2/d^2 in the notebook on April 29*/
        double dconsts = -hbar*hbar/(m0*dx*dx)*1e18;
        //double dconsts = -1/(nm_to_bohr(matgrid->a[0])*nm_to_bohr(matgrid->a[0]));
  /*Set up the constants for the diagonal, superdiagonal, and second superdiagonal for first nearest neighbor*/
  //double diag_const=-dconsts;
  double diag_const=-dconsts/4.0;
  double sd1_const=dconsts/4.0;
  double sd2_const=0;
  if(second_neighbor) {
    /*Modify our consts for second-nearest-neighbor*/
    dconsts /= 48;
    diag_const=-60*dconsts;
    sd1_const=16*dconsts;
    sd2_const=-dconsts;
  }
  
  //fprintf(stderr, "dconsts: hbar=%g m0=%g a[0]=%g dconsts=%g\n", hbar, m0, dx, dconsts);
  double ooms=0, ooms_prev=0, ooms_next=0, ooms_prev2=0, ooms_next2=0;
  /*Initialize the current ooms.*/
  ooms = properties[0].ooms;
  ooms_next = properties[1].ooms;
  for(unsigned int i=0; i<L; i++, ooms_prev2 = ooms_prev, ooms_prev=ooms, ooms=ooms_next, ooms_next = ooms_next2) {
    if(i < L-2) {
      ooms_next2 = properties[i+2].ooms;
    }
    char *s;
    //fprintf(stderr, "%05u(%s): ooms_prev2=%g ooms_prev=%g ooms=%g ooms_next=%g ooms_next2=%g Ev+Eg=%g\n", i, "(?)", ooms_prev2, ooms_prev, ooms, ooms_next, ooms_next2, properties[i].Ec);
    if(bc == HARDWALL) {
      if(!second_neighbor) {
        /*Note the minus sign, because the potential is acting on an electron.*/
        //diagonal[i] = Eg + Ev - potgrid->data[i] + diag_const*ooms;
        diagonal[i] = properties[i].Ec - properties[i].potential - internal_potential[i] + diag_const*(2*ooms + ooms_next + ooms_prev);
        //fprintf(stderr, "%05d: Eg+Ev=%g ooms_prev=%g ooms=%g d=%g ", i, Eg+Ev, ooms_prev, ooms, diagonal[i]);
        if(i != L-1) {
    /*note that ooms_next will not get updated on the last site (address would be out of the array)*/
    upper_diagonal[i] = sd1_const*(ooms + ooms_next);
    //fprintf(stderr, "ooms_next=%g ud=%g\n", ooms_next, upper_diagonal[i]);
              //}else{
    //fprintf(stderr, "(last; no ud)\n");
        }
      }else{
        /////////////////////////////////////////////////////////////////
        //TODO: Need to fill in the appropriate constants.
        /////////////////////////////////////////////////////////////////
        /*First, the diagonal*/
        matrix[get_array_index(i, i)] = properties[i].Ec - properties[i].potential - internal_potential[i] + diag_const*ooms;
        if(i != L-1) {
    if(i != L-2) {
      /*Second superdiagonal*/
      matrix[get_array_index(i, i+2)] = sd2_const*(ooms + ooms_next2);
    }
    /*Superdiagonal*/
    matrix[get_array_index(i, i+1)] = sd1_const*(ooms + ooms_next);
        }
        //fprintf(stderr, "%05u: d=%g u=%g u2=%g\n", i, matrix[get_array_index(i, i)], matrix[get_array_index(i, i+1)], matrix[get_array_index(i, i+2)]);
      }
    }else{
      /////////////////////////////////////////////////////////////////
      //TODO: Need to fill in the appropriate constants.
      /////////////////////////////////////////////////////////////////
      /*Mostly same as for hardwall, but now we have an explicit matrix*/
      matrix[get_matrix_index(i,i)] = properties[i].Ec - properties[i].potential - internal_potential[i] + diag_const*ooms;
      if(i == 0) {
        /*Previous ooms is the final gridsite, since we have periodic BCs*/
        ooms_prev = properties[L-1].ooms;
        matrix[get_matrix_index(i, i+1)] = sd1_const*(ooms + ooms_next);
        matrix[get_matrix_index(i, L-1)] = sd1_const*(ooms + ooms_prev);
        if(second_neighbor) {
    ooms_prev2 = properties[L-2].ooms;
    matrix[get_matrix_index(i, i+2)] = sd2_const*(ooms + ooms_next2);
    matrix[get_matrix_index(i, L-2)] = sd2_const*(ooms + ooms_prev2);
        }
      }else if(i == L-1) {
        /*Next ooms is the *first* gridsite
         *We've already gotten the previous value (in the for loop)*/
        ooms_next = properties[0].ooms;
        /*Previous value is the final gridsite, since we have periodic BCs*/
        matrix[get_matrix_index(i, 0)] = sd1_const*(ooms + ooms_next);
        matrix[get_matrix_index(i, i-1)] = sd1_const*(ooms + ooms_prev);
        if(second_neighbor) {
    ooms_next2 = properties[1].ooms;
    matrix[get_matrix_index(i, 1)] = sd2_const*(ooms + ooms_next);
    matrix[get_matrix_index(i, i-2)] = sd2_const*(ooms + ooms_prev);
        }
      }else{
        /*We already have the prev ooms, but we need to fetch the next one.*/
        matrix[get_matrix_index(i, i+1)] = sd1_const*(ooms + ooms_next);
        matrix[get_matrix_index(i, i-1)] = sd1_const*(ooms + ooms_prev);
        if(second_neighbor) {
    if(i == L-2) {
      ooms_next2 = properties[0].ooms;
      matrix[get_matrix_index(i, 0)] = sd2_const*(ooms + ooms_next2);
      matrix[get_matrix_index(i, i-2)] = sd2_const*(ooms + ooms_prev2);
    } else if(i == 1) {
      ooms_prev2 = properties[L-1].ooms;
      matrix[get_matrix_index(i, i+2)] = sd2_const*(ooms + ooms_next2);
      matrix[get_matrix_index(i, L-1)] = sd2_const*(ooms + ooms_prev2);
    } else {
      matrix[get_matrix_index(i, i+2)] = sd2_const*(ooms + ooms_next2);
      matrix[get_matrix_index(i, i-2)] = sd2_const*(ooms + ooms_prev2);
    }
        }
      }
    }
  }
      }

Here is the call graph for this function:

Here is the caller graph for this function:

void kdotp::libkdotp::hamiltonian::cartesian_effective_mass::update_matrix_with_internal_potential ( double *  old_potential)

Call this if only the internal potential was set.

Definition at line 147 of file hamiltonian_cartesian_effective_mass.c++.

References bc, diagonal, get_array_index(), get_matrix_index(), kdotp::libkdotp::hamiltonian::HARDWALL, internal_potential, L, matrix, and second_neighbor.

Referenced by replace_internal_potential().

                                                                                                {
  /*Remember when updating that the pot for an electron is -1 V[i].
   *Therefore, when updating, we *add* the old one to the previous diagonal terms to remove it,
   *  and the *subtract* the new one (or, subtract the difference, as below; saves an op)
   */
  for(unsigned int i=0; i<L; i++) {
    if(bc == HARDWALL) {
      if(!second_neighbor) {
        diagonal[i] -= internal_potential[i] - old_potential[i];
      }else{
        matrix[get_array_index(i, i)] -=  internal_potential[i] - old_potential[i];
      }
    }else{
      matrix[get_matrix_index(i,i)] -= internal_potential[i] - old_potential[i];
    }
  }
      }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

For periodic boundary conditions

Note:
that the matrix here is column-major, for compatibility with ACML
that this is also used for banded matrices; use banded_index to get the index.

Definition at line 72 of file hamiltonian_cartesian_effective_mass.h++.

Referenced by cartesian_effective_mass(), get_eigenvectors(), set_up_matrix(), and update_matrix_with_internal_potential().

For periodic multi-neighbor hardwall BCs, we need Q to get the eigenstates back in the original basis.

Definition at line 74 of file hamiltonian_cartesian_effective_mass.h++.

Referenced by get_eigenvectors().

Sets up the effective mass Hamiltonian for later calculations

Parameters:
structhe generic structure to be set up for calculating
bcthe boundary conditions on the calculation

Definition at line 66 of file hamiltonian_cartesian_effective_mass.h++.

Referenced by cartesian_effective_mass(), get_eigenvectors(), and set_up_matrix().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines