anchor.diff:             write(*,*) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
              s% which_atm_option = s% job% extras_cpar(1)
           endif
  -        
  +
  +! set ROTATION: extra param are set in inlist: star_job
  +        rot_full_off = s% job% extras_rpar(1) !1.2
  +        rot_full_on = s% job% extras_rpar(2) !1.8
  +
  +        if (rot_set_check == 0) then
  +            if (s% job% extras_rpar(3) > 0.0) then
  +                if (s% star_mass < rot_full_off) then
  +                    frac2 = 0.0
  +                else if (s% star_mass >= rot_full_off .and. s% star_mass <= rot_full_on) then
  +                    frac2 = (s% star_mass - rot_full_off) / (rot_full_on - rot_full_off)
  +                    frac2 = 0.5d0*(1 - cos(pi*frac2))
  +                else
  +                    frac2 = 1.0
  +                end if
  +                
  +                !check if ZAMS is achieved, then set rotation
  +                if ((abs(log10(s% L_nuc_burn_total * Lsun / s% L(1))) < 0.005) .and. (s% star_age > 1d2)) then
  +                    write(*,*) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
  +                    write(*,*) 'new omega_div_omega_crit, fraction', s% job% extras_rpar(3) * frac2, frac2
  +                    write(*,*) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
  +                    s% job% new_omega_div_omega_crit = s% job% extras_rpar(3) * frac2
  +                    s% job% set_near_zams_omega_div_omega_crit_steps = 10
  +                    rot_set_check = 1
  +                end if
  +            else
  +                write(*,*) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
  +                write(*,*) 'no rotation'
  +                write(*,*) '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
  +                rot_set_check = 1
  +            end if   
  +            
  +        end if
  +
   ! increase VARCONTROL and MDOT: increase varcontrol and Mdot when the model hits the TPAGB phase
           if ((s% initial_mass < 10) .and. (s% center_h1 < 1d-4) .and. (s% center_he4 < 1d-4)) then
               !try turning up Mdot
  
positive.code:     use star_def
      use const_def
      use crlibm_lib
      use rates_def
      use net_def
        
      implicit none
      
      real(dp) :: original_diffusion_dt_limit
      real(dp) :: burn_check = 0.0
      logical :: wd_diffusion = .false.
            
      contains
  
negative.code:         else
              call unpack_extra_info(s)
          end if
                        
  ! set VARCONTROL: for massive stars, turn up varcontrol gradually to help them evolve
          vct30 = 1e-4
          vct100 = 3e-3
  