      subroutine evolve ( Teff, fM_h, fM_he )
************************************************************************
*  This is the white dwarf evolution code as written by Martin         *
*  Schwarzschild. Subsequent modifications made by:                    *
*  Version         Author(s)                                           *
*  WDEC 1.0        Kutter & Savedoff   (1969, ApJ, 157, 1021)          *
*  WDEC 2.0        D.Q. Lamb           (1975, ApJ, 200, 306)           *
*  WDEC 3.0        D.E. Winget                                         *
*  WDEC 4.0        S.D. Kawaler                                        *
*  WDEC 5.0        M.A. Wood           (aka WDXD)                      *
*  WDEC 6.0        P.A. Bradley        (aka WDXDL, WDEC6)              *
*  WDEC 7.0        M.H. Montgomery     (aka WDXDFIT)                   *
*  Specialized for Metacomputer use by Travis Metcalfe, 1998/1999      *
************************************************************************
      implicit double precision(a-h,o-z)

      common/contrl/ds,g,sm,wc,it,nite,ja,jb,j,k,l
      common/writeit/writeit
      common/oldval/bold,teold 
      common/ifail/ifail
      common/thresh/thresh
      common/deldg/deldg
      common/ixswch/ixswch
      common/idiffus/idiffus
      common/mixl/ aml,mls
      common/wprep/iprep
      common/dprep/aa(20,500), ecv(400), ext(400), exr(400)
      common/kill/ killit, nxmods, ikill
      common/tfit/tfit(100),told,ifit,itfit,nite1
      common/comptmp/amhyhe_tmp,amheca_tmp
      common/idone/itconverged
      common/crash/itcrashed,irestart

      logical writeit
      logical killit
      irestart = 0
 666  killit = .false.
      ikill = 0
      itconverged = 0
      itcrashed = 0

*** fix temperature *** 
      tfit(1) = Teff

*** fix H and He boundaries ***
*      amhyhe_tmp = 10**(-1.*fM_h)
* use: above for DAs, below for DBs
      amhyhe_tmp = 0.0

      amheca_tmp = 10**(-1.*fM_he)

      itfit=0
      ifit=1

      call openem
*
* read from input file
*
      read(7,*) thresh,deldg,ixswch, iprep, idiffus
      read(7,*) aml, mls
      nxmods = 5
*
* initialize variables
*
      ifail = 0
      bold = 0.
      teold = 0.
*
* main program
*
      call read1
      call read2
      if ( idiffus .eq. 1 ) call setprof
    1 call write1
    2 call begin
    3 call calc(line)
      if (itcrashed.eq.1) then
         irestart = irestart + 1
         goto 666
      endif
      if ( line .eq. 2 ) then 
         call cshell
      elseif ( line .eq. 1 ) then
         call gshell
      endif
      if ( nite.eq.1) call write2
      if ( it .lt. 0 ) then
         call interp
         goto 3
      else
         call end(line)
      endif
      if ( itconverged .eq. 1 ) return
      if ( killit ) then
         return
      endif
      go to (1,2,10),line
 
10    continue

      return
      end 

************************************************************************

