      program FigV01 ! BB June 012017.
c Gravitational units G=c=1.
c Parameter values inspired by Mercury orbit.
      implicit real*8 (a-h,o-z)
      logical ltest
      parameter(iuo=6,iud=8,ngnu=2000)
      parameter(c=2.998d+08) ! 2.998d+08 [m/s] = 1 -> c.
      parameter(G=6.674d-11) ! 6.674d-11 [m^3 kg^{-1} s^{-2}] = 1 -> G.
      parameter(y=365.d00*24.d00*3600.d0)  ! Year in [s].
      parameter(ym=116.d00*24.d00*3600.d0) ! FigV01 year in [s].
      parameter(rmin=2.8d10,rmax=2.8d11)   ! Distance range to sun [m].
      parameter(sm=1477.d00)    ! Sun mass [m].
      parameter(h=1.d07)        ! Angular momentum [m].
      ltest=.false.
      if(ltest) stop "FigV01: ltest."
      ltest=.true.
      write(iuo,'(/," sm [m], rmax [m] =",2g12.4,/)') sm,rmax
      h2=h**2
      tmr=2*sm*rmax
      write(iuo,'(" h2 [m^2], tmr [m^2] =",2g12.4,/)') h2,tmr
c
      dr=(rmax-rmin)/ngnu
      open(iud,file="V01.d",form='formatted',status='unknown')
      do i=0,ngnu
        r=rmin+i*dr
        xn1=2*sm/r        ! 1. Newton contribution.
        xn2=(h/r)**2      ! 2. Newton contribution.
        vn=xn2-xn1        ! Newton effective potential.
        tmr=2*sm*r
        vnn=(h2-tmr)/r**2 ! vnn=vn tested.
c xn1 and gr have the same sign (negative contributions)
        gr=2*sm*h**2/r**3 ! Schwarzschild gravity contribution.
        vg=vn-gr          ! Gravity effective potential.
        dv=vg-vn
        write(iud,'(i9,4g16.7)') i,r,vn,vg,dv
      enddo
      close(iud)
      stop "FigV01: all done."
      end
