subroutine Krticka(id, L_phot, M_phot, R_phot, T_phot, w, ierr)
real(dp), intent(in) :: L_phot, M_phot, R_phot, T_phot ! photospheric values (cgs)
type (star_info), pointer :: s
integer, intent(in) :: id
integer, intent(out) :: ierr
logical, parameter :: dbg = .false.
real(dp), intent(out) :: w
real(dp) :: logMdot, logMdotcorr, logRmod, R1, logT, T1, T4
real(dp), parameter :: a = -22.7d0
real(dp), parameter :: b = 8.96d0
real(dp), parameter :: c = -1.42d0

call get_star_ptr(id,s,ierr) 

T1 = T_phot
logT = log10_cr(T1)
T4 = T1/1d4 
R1 = s% photosphere_r ! photospheric radius in Rsun units 
logRmod = (((-0.8656627d0 * logT + 16.22018d0) * logT - 112.2303d0) * logT + 341.6602d0) * logT - 387.0969d0 ! in  Rsun units, from Harmanec 1988 Eq. 3.

logMdot = & 
a & 
+ b * T4 &
+ c * pow_cr(T4,2d0)

logMdotcorr = logMdot + 4 * log10_cr(R1) - 4 * logRmod ! Mdot corrected for radius dependence 
w = exp10_cr(logMdotcorr) 

if (dbg) write(*,*) 'Krticka wind', w

end subroutine Krticka
