text:
      SUBROUTINE G5TRIN(NVALS,ISTART)
C
C          ------------------------------------------------
C          ROUTINE NO. (5014)   VERSION (A7.3B)   11:FEB:85
C          ------------------------------------------------
C
C          THIS GETS <NVALS> TRIPLETS FROM THE TRANGRID FILE
C          AND PLACES THEM IN [IFUNIB], STARTING AT <ISTART>.
C
C          ** THIS VERSION ALLOWS NON-STANDARD ERROR HANDLING **
C
C
      LOGICAL TEROUT
C
      COMMON /T5TBUF/ IFUNIB(257)
      COMMON /T5TERR/ INERR,TEROUT
      COMMON /T5TINP/ KTRNMI,KTRNDI,INPBUF(26),INBUFP,INLINE
C
C
      LEFT= NVALS
      IHERE= ISTART
      IF (INBUFP.GT.26) GO TO 2
    1   LIMIT= INBUFP+LEFT-1
        IF (LIMIT.GT.26) LIMIT= 26
C
        DO 100 LOAD= INBUFP,LIMIT
          IFUNIB(IHERE)= INPBUF(LOAD)
          IHERE= IHERE+1
  100   CONTINUE
C
        LEFT= LEFT-(LIMIT-INBUFP+1)
        INBUFP= LIMIT+1
        IF (LEFT.LE.0) GO TO 3
C
C          NO READ IS ATTEMPTED AFTER AN INPUT ERROR HAS OCCURRED.
C
    2   IF (INERR.NE.0) RETURN
C
        INLINE= INLINE+1
        READ(KTRNDI,101,END= 901,ERR= 902) INPBUF
  101   FORMAT(26I3)
        INBUFP= 1
        GO TO 1
C
    3 RETURN
C
C          IF AN ERROR IS ENCOUNTERED, A READ SHUT-DOWN IS MADE.
C
  901 INERR= 1
      IF (TEROUT) CALL G5ERMS
      RETURN
C
  902 INERR= 2
      IF (TEROUT) CALL G5ERMS
      RETURN
      END

max_stars_repo_name: ZedThree/GHOST

max_issues_repo_name: ZedThree/GHOST

max_forks_repo_name: ZedThree/GHOST


text:
What Is UC Davis Fall Welcome:
Fall Welcome is the time period from the beginning of September to the UC Davis Homecoming football game. For fall 2011 this time period is September 1  October 15, 2011. During this time campus organizations and departments hold events to help new students transition to life at UC Davis. The Fall Welcome Planning Committee is made up of UC Davis students and staff who aim to provide opportunities for all students (new and current) to engage in the campus community and participate in the historical traditions of UC Davis. All students are encouraged to look at the Fall Welcome webpage (http://fallwelcome.ucdavis.edu) for a list of events.  The calendar portion of the Fall Welcome page goes live in early august.

Website Features
Some features of the website, in addition to the Fall Welcome Event Calendar, are links to new student resources.   Created by students, for students, links are organized into the following categories:

1. New Student Resources  The Fall Welcome committee assembled a list of resources to help new UC Davis students get involved and acclimated to the campus.  (You can also check out the Freshman Guide here on the wiki)
2. What Is an Aggie?  Students new to UC Davis, at some point, must ask an important question: What is an Aggie?
3. Get Involved!  There are many opportunities at UC Davis to get involved. Look through the following list for organizations youd like to become involved with, check out their websites, and contact them to get involved.

New events will constantly be added so check the website often or email if you have questions.

A Few Traditional Fall Welcome Events:
Aggie Pack Welcome Rally at Aggie Stadium
New Student Resource Fair at Hutch Field
Outdoor Movie Night New for 2011 at Aggie Stadium
Chancellors Convocation at Jackson Hall in the Mondavi Center
The Buzz http://thebuzz.ucdavis.edu/ on the Quad

Departments and Student Organizations Can Register Events:
Campus departments and student organizations who wish to advertise their Fall Welcome events on the online calendar may do so by completing the online registration at http://fallwelcome.ucdavis.edu by July 31st.  The calendar will be available online at the beginning of August. Additionally, in order for student organizations to register they must be registered with the Center for Student Involvement (CSI) for the 201112 academic year and must have confirmation on the location of the event.

ext: f

max_stars_repo_name: voflo/Search

max_issues_repo_name: voflo/Search

max_forks_repo_name: voflo/Search


text:
MODULE m_read_old_inp
  IMPLICIT NONE
CONTAINS
  SUBROUTINE read_old_inp(input,atoms,cell,stars,sym,noco,vacuum,forcetheo,&
       sliceplot,banddos,enpara,xcpot,kpts,hybinp,&
       oneD)
    USE m_types_input
    USE m_types_atoms
    USE m_types_cell
    USE m_types_sym
    USE m_types_noco
    USE m_types_vacuum
    USE m_types_banddos
    USE m_types_hybinp
    USE m_types_xcpot_inbuild_nofunction
    USE m_types_forcetheo
    USE m_types_kpts
    USE m_types_enpara
    USE m_types_oneD
    USE m_types_sliceplot
    USE m_types_stars
    USE m_types_sphhar
    USE m_fleur_init_old
    USE m_atompar
    USE m_constants

    TYPE(t_input),INTENT(OUT):: input
    TYPE(t_atoms),INTENT(OUT):: atoms
    TYPE(t_cell) ,INTENT(OUT):: cell
    TYPE(t_sym)  ,INTENT(OUT):: sym
    TYPE(t_noco) ,INTENT(OUT):: noco
    TYPE(t_vacuum) ,INTENT(OUT):: vacuum
    TYPE(t_banddos),INTENT(OUT):: banddos
    TYPE(t_hybinp) ,INTENT(OUT):: hybinp
    TYPE(t_xcpot_inbuild_nf),INTENT(OUT)::xcpot
    TYPE(t_oned) ,INTENT(OUT):: oned
    TYPE(t_sliceplot),INTENT(OUT):: sliceplot
    TYPE(t_stars),INTENT(OUT):: stars
    TYPE(t_enpara) ,INTENT(OUT):: enpara

    TYPE(t_forcetheo):: forcetheo
    TYPE(t_kpts) ,INTENT(OUT):: kpts

    !local only

    TYPE(t_sphhar)       ::sphhar
    TYPE(t_atompar)      :: ap
    INTEGER              :: n,grid(3)
    LOGICAL              :: l_enparaok

    CALL fleur_init_old(&
         input,atoms,sphhar,cell,stars,sym,noco,vacuum,&
         sliceplot,banddos,enpara,xcpot,kpts,hybinp,&
         oneD,grid) !kpt grid not used...

    CALL sym%init(cell,input%film)

    !Generate speciesnames
    ALLOCATE(atoms%speciesname(atoms%ntype))
    DO n=1,atoms%ntype
      write(atoms%speciesname(n),"(a,a,i0)") namat_const(atoms%nz(n)),"-",n
    ENDDO
    IF (.not.allocated(atoms%label)) THEN
      allocate(atoms%label(atoms%nat))
      atoms%label=""
    ENDIF
    !convert enpara
    l_enparaok=.false.
    If (all(abs(enpara%el0)<1E10))THEN
      IF (All(Abs(Enpara%El0-Nint(Enpara%El0))<1e-9)) Then
        Enpara%Qn_el=Nint(Enpara%El0)
        l_enparaok=.true.
        if (atoms%nlotot>0) THEN
          IF (all(abs(enpara%ello0-Nint(Enpara%ello0))<1e-9)) THEN
            enpara%qn_ello=Nint(enpara%ello0)
          ELSE
            l_enparaok=.false.
          ENDIF
        ENDIF
      ENDIF
    ENDIF
    IF (.NOT.l_enparaok) THEN
      CALL enpara%init(atoms%ntype,atoms%nlod,input%jspins,.true.,atoms%nz)
      call judft_warn("Enpara not found or not set to integer values. Using defaults")
    ENDIF

    DO n=1,atoms%ntype
       ap=find_atompar(atoms%nz(n),atoms%rmt(n))
       IF (atoms%nlo(n).NE.LEN_TRIM(ap%lo)/2) CALL judft_warn("Number of LOs changed in new version.")
       call atoms%econf(n)%init(ap%econfig)
    END DO

  END SUBROUTINE read_old_inp
 END MODULE m_read_old_inp

max_stars_repo_name: MRedies/FLEUR

max_issues_repo_name: MRedies/FLEUR

max_forks_repo_name: MRedies/FLEUR


text:
! File VersionID:
!   $Id: penmon.for 184 2010-11-19 11:12:27Z kroes006 $
! ----------------------------------------------------------------------
      subroutine PenMon (logf,swscre,daymeteo,lat,alt,altw,a,b,rcs,
     & rad,tav,hum,win,rsc,es0,et0,ew0,swcf,ch,flbaresoil,daylp,
     & flmetdetail,irecord,nmetdetail,albedo,tmn,tmx,rsw)
! ----------------------------------------------------------------------
!     date               : 14/01/99
!     purpose            : calculation of potential evaporation &
!                          transpiration rates from a bare soil surface,
!                          a dry and a wet crop canopy;
!                          based on the penman - monteith approach.
! global
!     formal parameters  : (i = input, o = output)
!     logf    Internal number of logbook output file *.LOG ............i
!     swscre  Switch of screen display:  0 = no display; ..............i
!             1 = summary water balance; 2 = daynumber
!     daymeteo  daynumber (january 1st = 1) [-]........................i
!     lat    latitude [degr.,dec.degr., n=+,s=-].......................i
!     alt    altitude above mean sea level [m].........................i
!     altw   altitude of wind speed measurement [m] ...................i
!     a      first  angstrom coefficient [-]...........................i
!     b      second angstrom coefficient [-]...........................i
!     rcs    reflection coefficient soil [-]...........................i
!     albedo reflection coefficient crop [-]...........................i
!     rad    incoming short wave radiation [j/m2/d]....................i
!     tav    average temperature (24 hour) [C].........................i
!     hum    vapour pressure [kpa].....................................i
!     win    windspeed at 2 m height [m/s].............................i
!     rsc    minimum canopy resistance of dry crop [s/m]...............i
!     rsw    canopy resistance of intercepted water [s/m]..............i
!     swcf   switch use crop factor (=1) or crop height (=2)...........i
!     ch     crop height [cm]..........................................i
!     es0    potential evaporation rate from a wet bare soil [mm/d]....o
!     et0    potential transpiration rate from a dry crop [mm/d].......o
!     ew0    potential transpiration rate from a wet crop [mm/d].......o
!
! local
!     ckarman von karman constant [-]
!     zm      height of wind speed [cm]
!     zh      height of temperature and humidity measurement [cm]
!     d       zero displacement of wind profile [cm]
!     zom     roughness parameter for momentum [cm]
!     zoh     roughness parameter for heat and vapour [cm]
!     zmeasw  altitude of wind speed measurement [m] ...................i
! ----------------------------------------------------------------------
      implicit none
! global
      integer daymeteo,swcf,logf,swscre,irecord,nmetdetail
      real*8  lat,alt,altw,albedo,tmn,tmx,ch
      real*8  a,b,rcs,rsc,rsw,es0,et0,ew0,hum,rad,tav,win
      logical flbaresoil,flmetdetail
! local
      real*8  lambda,atmtr,cosld,dayl,delta,dsinb,dsinbe,dso,ea
      real*8  ed,etaerc,etaers,etaerw,etradc,etrads,etradw
      real*8  gamma,gammoc,gammos,gammow,palt,rac,ras,raw,cp
      real*8  relssd,rho,rnc,rnl,rns,rnw,rss,sinld,tavk,tkv
      real*8  ud,vpd,daylp,gs,gc,gw,radial,dec,aob,tmnk,tmxk
      real*8  ckarman, chgrass, chsoil, d, dgrass
      real*8  zm, zmeasw, zmeash, zom, zomgrass, zh,zoh
      real*8  zact, dact, zomact, fact, fmeas
      real*8  sunrise,sunset,startrec,endrec,t1,t2,pi,sc
      character messag*200
! local parameters
      data    chgrass  /12.0d0/      ! height of reference crop grassland [cm]
      data    zmeash   /200.0d0/     ! default height of humidity and temperature measurement [cm !]
      data    ckarman  /0.41d0/      ! von karman constant [-]
      data    chsoil   /0.1d0/       ! nihil crop height for a wet bare soil [cm]
      data    pi       /3.141593d0/  ! number pi
! ----------------------------------------------------------------------

! --- conversion to cm
      zmeasw = 100.0d0 * altw

! --- avoid zero crop height
      if (flbaresoil) then
        ch = chgrass
      else
        if (swcf.eq.1) then
          ch = chgrass
        else
          ch = max (ch,0.1d0)
        endif
      endif

! --- conversion of temperature from [c] to [k]
      tavk = tav+273.15d0
      tmnk = tmn+273.15d0
      tmxk = tmx+273.15d0

! --- atmospheric pressure at elevation alt [kpa]
      palt = 101.3d0*((tavk-0.0065d0*alt)/tavk)**5.26

! --- latent heat of vaporization [mj/kg]
      lambda = 2.501d0-0.002361d0*tav

! --- saturation vapour pressure [kpa]
      if (flmetdetail) then
        ea = 0.611d0*exp(17.27d0*tav/(tav+237.3d0))
      else
        ea = 0.3055d0*(exp(17.27d0*tmn/(tmn+237.3d0)) +
     &                 exp(17.27d0*tmx/(tmx+237.3d0)))
      endif

! --- measured vapour pressure not to exceed saturated vapour pressure
      ed = min(hum,ea)
! --- vapour pressure deficit [kpa]
      vpd = ea-ed

! --- slope vapour pressure curve [kpa/c]
      delta = 4098.0d0*ea/(tav+237.3d0)**2

! --- psychrometric constant [kpa/c]
      gamma = 0.00163d0*palt/lambda

! --- atmospheric density [kg/m3]
      tkv = tavk/(1.0d0-0.378d0*ed/palt)
      rho = 3.486d0*palt/tkv

! --- specific heat moist air [kj/kg/c]
      cp = 622.0d0*gamma*lambda/palt

! --- aerodynamic resistance [s/m] - soil, crop & wet crop

! -   day wind [m/s] for daily records, avoid zero windspeed
      ud = max (win, 0.0001d0)

!     adjust wind speed if crop height deviates from measurement height of wind speed
!     assuming equal wind speed at 100 meter (1.0d4 cm !) above the soil surface
!     (all length-units in cm ! )
      if (ch.gt.zmeash .or. zmeasw.gt.zmeash) then
        dgrass = 2.0d0/3.0d0 * chgrass
        zomgrass = 0.123d0 * chgrass
        fmeas = log((1.0d4-dgrass)/zomgrass) /
     &         log((zmeasw-dgrass)/zomgrass)
        zact = max(ch,200.0d0)
        dact = 2.0d0/3.0d0 * ch
        zomact = 0.123d0 * ch
       fact = log((zact-dact)/zomact) / log((1.0d4-dact)/zomact)
       ud = ud * fact * fmeas
      endif

! -   constants to determine aerodynamic resistance
      zm = max(ch,zmeash)     ! measured height of wind speed measurement [cm !]
      zh = zm                 ! height of humidity and temperature measurement [cm !]
      d = 2.0d0/3.0d0 * ch   ! zero displacement of wind profile [cm !]
      zom = 0.123d0 * ch       ! roughness parameter for momentum [cm]
      zoh = 0.1d0 * zom        ! roughness parameter for heat and vapour [cm]
! -   aerodynamic resistance for dry and wet crop
      rac = log ((zm - d)/zom) * log((zh - d)/zoh) / ckarman**2/ud
      raw = rac

! -   aerodynamic resistance for bare wet soil with a crop height set to 0.1 cm
      d = 2.0d0/3.0d0 * chsoil ! zero displacement of wind profile at low height [cm !]
      zom = 0.123d0 * chsoil     ! roughness parameter for momentum at low height [cm]
      zoh = 0.1d0 * zom          ! roughness parameter for heat and vapour [cm]
      ras = log ((zm - d)/zom) * log((zh - d)/zoh) / ckarman**2/ud

! --- surface resistance of wet soil [s/m]
      rss = 0.0d0

! --- modified psychrometric constant [kpa/c] - soil, crop & wet crop
      gammos = gamma*(1.0d0+rss/ras)
      gammoc = gamma*(1.0d0+rsc/rac)
      gammow = gamma*(1.0d0+rsw/raw)

! --- net short wave radiation [mj/m**2/d] - soil, crop & wet crop
      rns = (1.0d0-rcs)*rad/1000000.0d0
      rnc = (1.0d0-albedo)*rad/1000000.0d0
      rnw = (1.0d0-albedo)*rad/1000000.0d0

! --- procedure to derive extraterrestrial radiation [mj/m2/day]
      if (flmetdetail) then

! ---   declination of the sun as a function of daynr
        radial = pi/180.d0
        dec = -asin(sin(23.45d0*radial)*
     &                        cos(2.d0*pi*dble(daymeteo+10)/365.0d0))
! ---   some intermediate variables
        sinld = sin(radial*lat)*sin(dec)
        cosld = cos(radial*lat)*cos(dec)
        aob = sinld/cosld
! ---   calculation of astronomical daylength
        if (aob.lt.-1.0d0) then
          messag='Warning: latitude above polar circle, daylength= 0hrs'
          call warn ('Astro',messag,logf,swscre)
        else if (aob.gt.1.0d0) then
          messag='Warning: latitude within polar circle,daylength=24hrs'
          call warn ('Astro',messag,logf,swscre)
        else
          dayl  = 12.0d0*(1.0d0+2.0d0*asin(aob)/pi)
        endif

!       Solar constant [j/m2/day]
        sc = 118.08d6*(1.0d0+0.033d0*cos (2.0d0*pi*daymeteo/365.d0))

! ---   Extraterrestrial radiation of current period (dso) [j/m2/day]
        sunrise = 0.5d0 - dayl / 48.d0
        sunset = 0.5d0 + dayl / 48.d0
        startrec = dble(real(irecord-1)/real(nmetdetail))
        endrec = dble(real(irecord)/real(nmetdetail))

        if (endrec .lt. sunrise) then
          dso = 0.d0
        else if (startrec .gt. sunset) then
          dso = 0.d0
        else if (startrec .lt. sunrise) then
! ---     solar time angle at beginning of radiation period
          t1 = (sunrise - 0.5d0) * 2.d0 * pi
! ---     solar time angle at end of radiation period
          t2 = (endrec - 0.5d0) * 2.d0 * pi
          dso = sc/2.d0/pi*((t2 - t1)*sinld + cosld*(sin(t2) - sin(t1)))
     &          * nmetdetail
        else if (endrec .gt. sunset) then
! ---     solar time angle at beginning of radiation period
          t1 = (startrec - 0.5d0) * 2.d0 * pi
! ---     solar time angle at end of radiation period
          t2 = (sunset - 0.5d0) * 2.d0 * pi
          dso = sc/2.d0/pi*((t2 - t1)*sinld + cosld*(sin(t2) - sin(t1)))
     &          * nmetdetail
        else
! ---     solar time angle at beginning of radiation period
          t1 = (startrec - 0.5d0) * 2.d0 * pi
! ---     solar time angle at end of radiation period
          t2 = (endrec - 0.5d0) * 2.d0 * pi
          dso = sc/2.d0/pi*((t2 - t1)*sinld + cosld*(sin(t2) - sin(t1)))
     &          * nmetdetail
        endif

      else
! ---   just daily extraterrestrial radiation (one record per day)
        call astro(logf,swscre,daymeteo,lat,
     &           dayl,daylp,sinld,cosld,dsinb,dsinbe,dso)
      endif

! --- net long wave radiation (mj/m2/d)
      atmtr = 0.0d0

      if (dso.gt.1.0d-5)  atmtr = rad/dso
      relssd = max(min((atmtr-a)/b,1.0d0),0.0d0)

!      rnl = 4.9d-9*tavk**4*(0.34d0-0.14d0*sqrt(ed))*(0.1d0+0.9d0*relssd)
      rnl = 4.9d-9* 0.5d0 * (tmxk**4 + tmnk**4) *
     &      (0.34d0-0.14d0*sqrt(ed))*(0.1d0+0.9d0*relssd)

! --- soil heat flux [mj/m2/d]
      if (flmetdetail) then
        if ((startrec+endrec)/2.d0 .gt. sunrise .and.
     &      (startrec+endrec)/2.d0 .lt. sunset) then
! ---     daytime period
          gs = 0.1d0 * (rns - rnl)
          gc = 0.1d0 * (rnc - rnl)
          gw = 0.1d0 * (rnw - rnl)
        else
! ---     nighttime period
          gs = 0.5d0 * (rns - rnl)
          gc = 0.5d0 * (rnc - rnl)
          gw = 0.5d0 * (rnw - rnl)
        endif
      else
! --- daily record, net flux negligable
        gs = 0.d0
        gc = 0.d0
        gw = 0.d0
      endif

! --- aerodynamic term of the pm equation [mm/d] - soil, crop & wet crop
      etaers = (86.4d0/lambda)*(1.0d0/(delta+gammos))*(rho*cp*vpd/ras)
      etaerc = (86.4d0/lambda)*(1.0d0/(delta+gammoc))*(rho*cp*vpd/rac)
      etaerw = (86.4d0/lambda)*(1.0d0/(delta+gammow))*(rho*cp*vpd/raw)

! --- radiation term of the pm equation [mm/d] - soil, crop & wet crop
      etrads = delta/(delta+gammos)*(rns-rnl-gs)*1.0d0/lambda
      etradc = delta/(delta+gammoc)*(rnc-rnl-gc)*1.0d0/lambda
      etradw = delta/(delta+gammow)*(rnw-rnl-gw)*1.0d0/lambda

! --- sum of both terms [mm/d] - soil, crop and wet crop
      es0 = max (0.0d0,etaers+etrads)
      et0 = max (0.0d0,etaerc+etradc)
      ew0 = max (0.0d0,etaerw+etradw)

      return
      end

ext: for


text:
-makelib xcelium_lib/xilinx_vip -sv \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi4stream_vip_axi4streampc.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi_vip_axi4pc.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/xil_common_vip_pkg.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi4stream_vip_pkg.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi_vip_pkg.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi4stream_vip_if.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/axi_vip_if.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/clk_vip_if.sv" \
  "C:/Xilinx/Vivado/2020.1/data/xilinx_vip/hdl/rst_vip_if.sv" \
-endlib
-makelib xcelium_lib/xpm -sv \
  "C:/Xilinx/Vivado/2020.1/data/ip/xpm/xpm_cdc/hdl/xpm_cdc.sv" \
  "C:/Xilinx/Vivado/2020.1/data/ip/xpm/xpm_memory/hdl/xpm_memory.sv" \
-endlib
-makelib xcelium_lib/xpm \
  "C:/Xilinx/Vivado/2020.1/data/ip/xpm/xpm_VCOMP.vhd" \
-endlib
-makelib xcelium_lib/axi_infrastructure_v1_1_0 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/ec67/hdl/axi_infrastructure_v1_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/axi_vip_v1_1_7 -sv \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/ce6c/hdl/axi_vip_v1_1_vl_rfs.sv" \
-endlib
-makelib xcelium_lib/processing_system7_vip_v1_0_9 -sv \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/6b56/hdl/processing_system7_vip_v1_0_vl_rfs.sv" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../bd/pynq/ip/pynq_processing_system7_0_0/sim/pynq_processing_system7_0_0.v" \
-endlib
-makelib xcelium_lib/xbip_utils_v3_0_10 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/d117/hdl/xbip_utils_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/axi_utils_v2_0_6 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/1971/hdl/axi_utils_v2_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xbip_pipe_v3_0_6 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7468/hdl/xbip_pipe_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xbip_dsp48_wrapper_v3_0_4 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/cdbf/hdl/xbip_dsp48_wrapper_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xbip_dsp48_addsub_v3_0_6 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/910d/hdl/xbip_dsp48_addsub_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xbip_dsp48_multadd_v3_0_6 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/b0ac/hdl/xbip_dsp48_multadd_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xbip_bram18k_v3_0_6 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/d367/hdl/xbip_bram18k_v3_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/mult_gen_v12_0_16 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/ce84/hdl/mult_gen_v12_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/floating_point_v7_1_10 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/248c/hdl/floating_point_v7_1_rfs.vhd" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_AXILiteS_s_axi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_fadd_32ns_32bkb.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_fcmp_32ns_32dEe.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_fmul_32ns_32cud.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_gmem_m_axi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mac_mul_sub_jbC.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mac_muladd_1mb6.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mac_muladd_1ocq.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mac_muladd_8pcA.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_16ns_32nfYi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_16ns_32shbi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_32ns_16ng8j.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_mul_8ns_kbM.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_mul_16nsibs.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_mul_16nsncg.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_mul_mul_16s_lbW.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv_sdiv_19s_9nseOg.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/verilog/Conv.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/ip/Conv_ap_fadd_7_full_dsp_32.vhd" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/ip/Conv_ap_fcmp_2_no_dsp_32.vhd" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7130/hdl/ip/Conv_ap_fmul_3_max_dsp_32.vhd" \
  "../../../bd/pynq/ip/pynq_Conv_0_0/sim/pynq_Conv_0_0.vhd" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_AXILiteS_s_axi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_fadd_32ns_32bkb.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_fcmp_32ns_32eOg.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_fdiv_32ns_32cud.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_gmem_m_axi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mac_muladd_1ncg.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mac_muladd_1ocq.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_16ns_32nhbi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_32ns_16ng8j.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_32s_16nsibs.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_mul_8ns_lbW.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_mul_16nsjbC.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_mul_16nsmb6.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_mul_mul_16s_kbM.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_udiv_16ns_8nfYi.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool_uitofp_32ns_dEe.v" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/verilog/Pool.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/ip/Pool_ap_fadd_7_full_dsp_32.vhd" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/ip/Pool_ap_fcmp_2_no_dsp_32.vhd" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/ip/Pool_ap_fdiv_28_no_dsp_32.vhd" \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/54f6/hdl/ip/Pool_ap_uitofp_6_no_dsp_32.vhd" \
  "../../../bd/pynq/ip/pynq_Pool_0_0/sim/pynq_Pool_0_0.vhd" \
-endlib
-makelib xcelium_lib/lib_cdc_v1_0_2 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/ef1e/hdl/lib_cdc_v1_0_rfs.vhd" \
-endlib
-makelib xcelium_lib/proc_sys_reset_v5_0_13 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/8842/hdl/proc_sys_reset_v5_0_vh_rfs.vhd" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../bd/pynq/ip/pynq_rst_ps7_0_50M_0/sim/pynq_rst_ps7_0_50M_0.vhd" \
-endlib
-makelib xcelium_lib/generic_baseblocks_v2_1_0 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/b752/hdl/generic_baseblocks_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/axi_register_slice_v2_1_21 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/2ef9/hdl/axi_register_slice_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/fifo_generator_v13_2_5 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/276e/simulation/fifo_generator_vlog_beh.v" \
-endlib
-makelib xcelium_lib/fifo_generator_v13_2_5 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/276e/hdl/fifo_generator_v13_2_rfs.vhd" \
-endlib
-makelib xcelium_lib/fifo_generator_v13_2_5 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/276e/hdl/fifo_generator_v13_2_rfs.v" \
-endlib
-makelib xcelium_lib/axi_data_fifo_v2_1_20 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/47c9/hdl/axi_data_fifo_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/axi_crossbar_v2_1_22 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/b68e/hdl/axi_crossbar_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../bd/pynq/ip/pynq_xbar_0/sim/pynq_xbar_0.v" \
-endlib
-makelib xcelium_lib/axi_protocol_converter_v2_1_21 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/8dfa/hdl/axi_protocol_converter_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../bd/pynq/ip/pynq_auto_pc_0/sim/pynq_auto_pc_0.v" \
-endlib
-makelib xcelium_lib/axi_clock_converter_v2_1_20 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/7589/hdl/axi_clock_converter_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/blk_mem_gen_v8_4_4 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/2985/simulation/blk_mem_gen_v8_4.v" \
-endlib
-makelib xcelium_lib/axi_dwidth_converter_v2_1_21 \
  "../../../../pynq.srcs/sources_1/bd/pynq/ipshared/07be/hdl/axi_dwidth_converter_v2_1_vl_rfs.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  "../../../bd/pynq/ip/pynq_auto_us_0/sim/pynq_auto_us_0.v" \
  "../../../bd/pynq/ip/pynq_auto_pc_1/sim/pynq_auto_pc_1.v" \
  "../../../bd/pynq/ip/pynq_auto_us_1/sim/pynq_auto_us_1.v" \
  "../../../bd/pynq/ip/pynq_auto_pc_2/sim/pynq_auto_pc_2.v" \
  "../../../bd/pynq/sim/pynq.v" \
-endlib
-makelib xcelium_lib/xil_defaultlib \
  glbl.v
-endlib


! Susy QPI
! This program outputs data used to plot
! the QPI spectrum of the Kondo Lattice Model
! using a supersymmetric representation
!
! by Eric Mascot
!
!==============================================================
! susy_qpi    Set experimental data and frequency
!==============================================================

program susy_qpi
  implicit none
  include "inc/susy_qpi.f90"

  call date_and_time(date,time)
  open(10, file="susy_qpi.log", position="append", status="unknown")
    write(10,*)
    write(10,*) "******************START: susy_qpi********************"
    write(10,*) "DATE: "//date//" TIME: "//time
  close(10)

! Set constants
  Pi=4.0_dp*datan(1.0_dp)

  do i=1,4
!     do j=1,4
!       do k=0,4

! Set experimental data
        t   = 1_dp
        mu  = 0.1_dp*t
        x0  = 0.02_dp
        epsf= 0.1_dp*x0
        Uc  = 0.1_dp*i
        Uf  = 0.1_dp*i
        V   = 0.1_dp

! Set up matrix as an array of size 16
        Gkinv = (/ complex(dp) :: &
             0,  V, -Uc,  0, &
             V,  0,   0, Uf, &
           -Uc,  0,   0,  V, &
             0, Uf,   V,  0 /)
        Gkqinv = (/ complex(dp) :: &
             0,  V, -Uc,  0, &
             V,  0,   0, Uf, &
           -Uc,  0,   0,  V, &
             0, Uf,   V,  0 /)

        call write_data(0.0_dp,0.4_dp)
!       end do
!     end do
  end do

  open(10, file="susy_qpi.log", position="append", status="old")
    write(10,*) "********************END: susy_qpi********************"
    write(10,*)
  close(10)
end program susy_qpi

!==============================================================
! write_data  Writes data to OMEGA_susy_qpi.dat
!   om        real part of frequency
!   del       imaginary part of frequency
!==============================================================

subroutine write_data(om, del)
  use sqlite
  implicit none
  include "inc/write_data.f90"

! Start timer
  call cpu_time(start)
  call date_and_time(date,time)
  filename = date//time//".dat"
  write(title, '("w=", f0.2, "+", f0.2, "i", &
    &" V=", f0.2, " U_c=", f0.2, " U_f=", f0.2)') om, del, V, Uc, Uf

! frequency
  omega = dcmplx(om,del)

! Set column properties for sqlite
  call sqlite3_open( 'data.db', db )
  allocate( column(15) )
  call sqlite3_column_props( column(1), "t", SQLITE_REAL )
  call sqlite3_column_props( column(2), "mu", SQLITE_REAL )
  call sqlite3_column_props( column(3), "x0", SQLITE_REAL )
  call sqlite3_column_props( column(4), "epsf", SQLITE_REAL )
  call sqlite3_column_props( column(5), "V", SQLITE_REAL )
  call sqlite3_column_props( column(6), "Uc", SQLITE_REAL )
  call sqlite3_column_props( column(7), "Uf", SQLITE_REAL )
  call sqlite3_column_props( column(8), "omega", SQLITE_REAL )
  call sqlite3_column_props( column(9), "delta", SQLITE_REAL )
  call sqlite3_column_props( column(10), "qx", SQLITE_REAL )
  call sqlite3_column_props( column(11), "qy", SQLITE_REAL )
  call sqlite3_column_props( column(12), "result", SQLITE_REAL )
  call sqlite3_column_props( column(13), "absresult", SQLITE_REAL )
  call sqlite3_column_props( column(14), "date", SQLITE_CHAR, 8 )
  call sqlite3_column_props( column(15), "time", SQLITE_CHAR, 4 )
  call sqlite3_create_table( db, "susy_qpi", column)
  call sqlite3_create_table( db, "runs", column)

  call sqlite3_set_column( column(1), t )
  call sqlite3_set_column( column(2), mu )
  call sqlite3_set_column( column(3), x0 )
  call sqlite3_set_column( column(4), epsf )
  call sqlite3_set_column( column(5), V )
  call sqlite3_set_column( column(6), Uc )
  call sqlite3_set_column( column(7), Uf )
  call sqlite3_set_column( column(8), om )
  call sqlite3_set_column( column(9), del )
  call sqlite3_set_column( column(14), date )
  call sqlite3_set_column( column(15), time )

! Start log
  open(log, file="susy_qpi.log", position="append", status="old")
    write(log,*)
    write(log,*) "======================================"
    write(log,*) "t:     ", t
    write(log,*) "mu:    ", mu
    write(log,*) "x0:    ", x0
    write(log,*) "epsf:  ", epsf
    write(log,*) "V:     ", V
    write(log,*) "Uc:    ", Uc
    write(log,*) "Uf:    ", Uf
    write(log,*) "omega: ", omega
    write(log,*) "date:  ", date
    write(log,*) "time:  ", time
  close(log)

! Settings for dcuhre
  a(1) = -1.0_dp*Pi
  b(1) = Pi
  a(2) = -1.0_dp*Pi
  b(2) = Pi
  minpts = 2000
  maxpts = 60000000
  abserr = 1e-6_dp
  relerr = 1e-3_dp

! Step through 1/8 triangle of BZ
  steps=100
  qstep=Pi/(steps*1.0_dp)

  do iqx=0,steps
    qx=iqx*qstep
    do iqy = 0,iqx
      qy=iqy*qstep
!     Integrate sG0 subroutine
      call dcuhre(ndim, nfun, a, b, minpts, maxpts, sG0, &
                  abserr, relerr, 0, nwork, 0, result,&
                  absest, neval, ifail, work)
!     Log results
      if (ifail>0) then
        open(log, file="susy_qpi.log", position="append", status="old")
        write(log,*) "ERROR: DCUHRE exit code ", ifail
        close(log)
      end if

      call sqlite3_begin( db )

      call sqlite3_set_column( column(10), qx )
      call sqlite3_set_column( column(11), qy )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), -qx )
      call sqlite3_set_column( column(11), qy )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), qx )
      call sqlite3_set_column( column(11), -qy )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), -qx )
      call sqlite3_set_column( column(11), -qy )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), qy )
      call sqlite3_set_column( column(11), qx )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), qy )
      call sqlite3_set_column( column(11), -qx )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), -qy )
      call sqlite3_set_column( column(11), qx )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_set_column( column(10), -qy )
      call sqlite3_set_column( column(11), -qx )
      call sqlite3_set_column( column(12), result(1) )
      call sqlite3_set_column( column(13), dabs(result(1)) )
      call sqlite3_insert( db, 'susy_qpi', column )

      call sqlite3_commit( db )
    end do
  end do

  call sqlite3_begin( db )
  call sqlite3_insert( db, 'runs', column)
  call sqlite3_commit( db )
  call sqlite3_close( db )

  open(log, file="susy_qpi.log", position="append", status="old")
    call cpu_time(end)
    write(log,*) "CALCULATION TIME: ", end-start
  close(log)

! Export plot to png
  call system('sqlite3 -column data.db "select distinct qx, qy, absresult from susy_qpi where date='&
    //date//' and time='//time//' order by qx, qy;" | awk -f add_blanks.awk > data/'//filename)
  call system('gnuplot -e ''filename="'//filename//'"; name="'//trim(title)//'"'' plot.gp')
end subroutine write_data

!==============================================================
! sG0         Integrand for dcuhre
!   ndim      number of variables
!   z         variables for integration
!   nfun      number of components of integral
!   f         value of integrand
!==============================================================

subroutine sG0(ndim, z, nfun, f)
  implicit none
  include "inc/sG0.f90"

  kx = z(1)
  ky = z(2)
  kqx=kx+qx
  kqy=ky+qy

  epsk    = -2.0_dp * t * (dcos(kx)     + dcos(ky))     - mu
  epskpQ  = -2.0_dp * t * (dcos(kx+Pi)  + dcos(ky+Pi))  - mu
  epskq   = -2.0_dp * t * (dcos(kqx)    + dcos(kqy))    - mu
  epskqpQ = -2.0_dp * t * (dcos(kqx+Pi) + dcos(kqy+Pi)) - mu

  chik    = -2.0_dp * x0 * (dcos(kx)     + dcos(ky))     - epsf
  chikpQ  = -2.0_dp * x0 * (dcos(kx+Pi)  + dcos(ky+Pi))  - epsf
  chikq   = -2.0_dp * x0 * (dcos(kqx)    + dcos(kqy))    - epsf
  chikqpQ = -2.0_dp * x0 * (dcos(kqx+Pi) + dcos(kqy+Pi)) - epsf

  Gkinv(1)   = omega - epsk
  Gkinv(6)   = omega - chik
  Gkinv(11)  = omega - epskpQ
  Gkinv(16)  = omega - chikpQ
  Gkqinv(1)  = omega - epskq
  Gkqinv(6)  = omega - chikq
  Gkqinv(11) = omega - epskqpQ
  Gkqinv(16) = omega - chikqpQ

  call invert4x4(Gkinv, Gk, status)
  if ( status>0 ) then
    open(log, file="susy_qpi.log", position="append", status="old")
    write(log,*) "ERROR: Singular matrix "
    write(log,*) Gkinv
    close(log)
  end if
  call invert4x4(Gkqinv, Gkq, status)
  if ( status>0 ) then
    open(log, file="susy_qpi.log", position="append", status="old")
    write(log,*) "ERROR: Singular matrix "
    write(log,*) Gkqinv
    close(log)
  end if

  f(1)=dimag(Gk(1)*Gkq(1))

end subroutine sG0