function CB_ei_SD(params,v,ne,Te,Zeff)
TYPE(KORC_PARAMS), INTENT(IN) :: params
REAL(rp), INTENT(IN) :: v
REAL(rp), INTENT(IN) :: ne
REAL(rp), INTENT(IN) :: Te
REAL(rp), INTENT(IN) :: Zeff
REAL(rp) :: CB_ei_SD
REAL(rp) :: CB_ei_temp
REAL(rp) :: x
INTEGER :: i
x = v/VTe(Te)
CB_ei_SD = (0.5_rp*Gammacee(v,ne,Te)/v)* &
(Zeff*CLogei(v,ne,Te)/CLogee(v,ne,Te))
if (params%bound_electron_model.eq.'HESSLOW') then
CB_ei_temp=CB_ei_SD
if ((cparams_ms%Zj(1).eq.0.0).and. &
(neut_prof.eq.'UNIFORM')) then
CB_ei_temp=CB_ei_temp+CB_ei_SD*cparams_ms%nz(1)/(ne* &
Zeff*CLogei(v,ne,Te))*g_j(1,v)
else if ((cparams_ms%Zj(1).eq.0.0).and. &
(neut_prof.eq.'HOLLOW')) then
CB_ei_temp=CB_ei_temp+CB_ei_SD*max(cparams_ms%nz(1)-ne,0._rp)/(ne* &
Zeff*CLogei(v,ne,Te))*g_j(1,v)
else
CB_ei_temp=CB_ei_temp+CB_ei_SD*cparams_ms%nz(1)/(cparams_ms%ne* &
Zeff*CLogei(v,ne,Te))*g_j(1,v)
endif
do i=2,cparams_ms%num_impurity_species
CB_ei_temp=CB_ei_temp+CB_ei_SD*cparams_ms%nz(i)/(cparams_ms%ne* &
Zeff*CLogei(v,ne,Te))*g_j(i,v)
end do
CB_ei_SD=CB_ei_temp
else if (params%bound_electron_model.eq.'ROSENBLUTH') then
CB_ei_temp=CB_ei_SD
do i=1,cparams_ms%num_impurity_species
CB_ei_temp=CB_ei_temp+CB_ei_SD*cparams_ms%nz(i)/cparams_ms%ne* &
(cparams_ms%Zo(i)-cparams_ms%Zj(i))/2._rp
end do
CB_ei_SD=CB_ei_temp
end if
end function CB_ei_SD