!This subroutine initializes the parameters to be optimized as well as those to be used and not changed
!
      subroutine commonparameters(stargamma25,fkc25,fko25,alpha25,
     &ha_vcmax,hd_vcmax,sv_vcmax,ha_jmax,hd_jmax,sv_jmax,ha_tpu,
     &hd_tpu,sv_tpu,ha_gmeso,hd_gmeso,sv_gmeso,ha_darkresp,ha_stargamma,
     &ha_kc,ha_ko,abspt_lf_par,gascon,phifactor,thetafactor,betaPSII)
      implicit none
!-------Secondary parameters in A/Ci curve analysis----------------------
! stargamma25: the chloroplastic CO2 compensation point at 25oC
! fkc25:      the Michaelis constant for CO2 at 25oC when gmeso is not include [Pa]
! fko25:      the Michaelis constant for O2 at 25oC when gmeso is not include [Pa]
! alpha25:         The fraction of glycolate carbon not returned to the chloroplat [0-1]
      double precision stargamma25,fkc25,fko25,alpha25
!-------Parameters that define temperature responses---------------------
! ha_vcmax:  The activation energy (Ha) in Vcmax temperature response function [kJmol-1]
! hd_vcmax:  The deactivation energy (Hd) in Vcmax temperature response function [kJmol-1]
! sv_vcmax:  The entropy term (Sv) in Vcmax temperature response function [kJmol-1K-1]
! ha_jmax:  The activation energy (Ha) in jmax temperature response function [kJmol-1]
! hd_jmax:  The deactivation energy (Hd) in jmax temperature response function [kJmol-1]
! sv_jmax:  The entropy term (Sv) in jmax temperature response function [kJmol-1K-1]
! ha_tpu:  The activation energy (Ha) in tpu temperature response function [kJmol-1]
! hd_tpu:  The deactivation energy (Hd) in tpu temperature response function [kJmol-1]
! sv_tpu:  The entropy term (Sv) in tpu temperature response function [kJmol-1K-1]
! ha_gmeso:  The activation energy (Ha) in gmeso temperature response function [kJmol-1]
! hd_gmeso:  The deactivation energy (Hd) in gmeso temperature response function [kJmol-1]
! sv_gmeso:  The entropy term (Sv) in gmeso temperature response function [kJmol-1K-1]
!
! ha_darkresp: parameter in the temperature response function of dark respiration [kJmol-1]
! ha_stargamma: parameter in the temperature response function of the co2 compensation point [kJmol-1]
! ha_kc:      a CO2 Michaelis temp coefficient [kJmol-1]
! ha_ko:      a O2 Michaelis temp coefficient [kJmol-1]
! gascon: Universal gas constant J K-1 mol-1
! phifactor: modifies Bernacchi phiPSIImax
! thetafactor: modifies Bernacchi thetaPSII
! betaPSII: the fraction of absorbed light that reaches photosystem II (0.5)
      double precision ha_vcmax,hd_vcmax,sv_vcmax,ha_jmax,
     &hd_jmax,sv_jmax,ha_tpu,hd_tpu,sv_tpu,ha_gmeso,hd_gmeso,sv_gmeso,
     &ha_darkresp,ha_stargamma,ha_kc,ha_ko,phifactor,thetafactor,
     &betaPSII

!--------------Other parameters-------------------------------------------
! abspt_lf_par: leaf absorptance in PAR
      double precision abspt_lf_par,gascon
      
      gascon=8.314472d0
!
!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
!Parameters below this line will be used as inputs if not optimized from curve fitting 
!but as initial values if optimized. So they are not arbitrary values and should not be 
!changed unless there is a good reason.
!
!-------Secondary parameters---------------------------
!Considered universal but uncertain, also depend on whether mesophyll conductance is involked
!The subscript 1 is for fitting without mesophyll conductance; 2 is for fitting with mesophyll conductance
!Bernacchi et al. (2003) values
!      stargamma25=4.3d0
!      stargamma25=4.3d0
!      fkc25=41.0d0
!      fkc25=41.0d0
!      fko25=27710.0d0
!      fko25=27710.0d0
!
!S. von Caemmerer (2000) values
!      stargamma25=3.7d0
!      stargamma25=3.86d0
!      fkc25=40.4d0
!      fkc25=26.0d0
!      fko25=24800.0d0
!      fko25=17900.0d0

!Values used in Sharkey et al. (2007)
      stargamma25=3.743d0
      fkc25=27.238d0
      fko25=16582.0d0

!Jordan and Ogren (1984) values
!      stargamma25=4.5146d0
!      stargamma25=4.5146d0
!      fkc25=27.422d0
!      fkc25=27.422d0
!      fko25=41829.0d0
!      fko25=41829.0d0
      
      alpha25=0.0d0
!most models have alpha=0
!-----------------------------------------------------      
!Parameters in the generic Vcmax temperature response function.
!Leuning, Harley and Bernacchi can all be expressed in the same generic form
!Bernacchi et al. (2003) function
!      ha_vcmax=65.33d0
!      hd_vcmax=0.0d0
!      sv_vcmax=0.0d0

!S. von Caemmerer (2000) values
!      ha_vcmax=58.52d0
!      hd_vcmax=0.0d0
!      sv_vcmax=0.0d0 

!Leuning (2002) function
!      ha_vcmax=73.637d0
!      hd_vcmax=149.252d0
!      sv_vcmax=0.486d0

!Harley et al. (1992) function
!      ha_vcmax=116.3d0
!      hd_vcmax=202.9d0
!      sv_vcmax=0.65d0

!Values used in Sharkey et al. (2007)
      ha_vcmax=65.33d0
      hd_vcmax=0.0d0
      sv_vcmax=0.0d0
!
!-------------------------------------------------------
!Parameters in Jmax temperature response functions. All in unit of kJmol-1
!Leuning, Harley and Bernacchi can all be expressed in the same generic form          
!Bernacchi et al. (2003) function
!      ha_jmax=43.54d0
!      hd_jmax=0.0d0
!      sv_jmax=0.0d0

!S. von Caemmerer (2000) values
!      ha_jmax=37.0d0
!      hd_jmax=0.0d0
!      sv_jmax=0.0d0

!Leuning function
!      ha_jmax=50.3d0
!      hd_jmax=152.044d0
!      sv_jmax=0.495d0

!Harley functions
!      ha_jmax=79.5d0
!      hd_jmax=201.0d0
!      sv_jmax=0.65d0

!values used in Sharkey et al. (2007)
      ha_jmax=43.54d0
      hd_jmax=0.0d0
      sv_jmax=0.0d0
 
!June et al. function. The June et al function cannot be expressed in the generic form. Need to go to the
!Jmax temperature response function subroutine to change the form if this function is used
!      ha_jmax=30.0d0+273.15d0
!      hd_jmax=11.6d0
!      sv_jmax=0.18d0

!---------------------------------------------------------        
!Parameters in TPU temperature response function in kJmol-1
!Harley function
      ha_tpu=53.1d0
      hd_tpu=201.8d0
      sv_tpu=0.65d0

!Parameters in gmeso temperature response function
!Values from the functions in Bernacchi, et al. (2002), Plant Physiology, 130, 1992-1998.
      ha_gmeso=49.6d0
      hd_gmeso=437.4d0
      sv_gmeso=1.4d0
!Values from the function in Scafaro et al. (2011), PCE 34: 1999-2008
!      ha_gmeso=(45.22d0+29.17d0+48.26d0)/3.0d0
!      hd_gmeso=-9999.0d0
!      sv_gmeso=-9999.0d0
!---------------------------------------------------------     
!Parameters in the temperature response function for leaf mitochondrial (dark) respiration (kJmol-1)
!Parameters in the temp function for the choloraplastic CO2 compensation point (kJmol-1)           
!Parameters in the temp function of Kc
!Parameters in the temp function of Ko
!Bernacchi et al. (2003) parameters
!      ha_darkresp=46.39d0
!      ha_stargamma=37.83d0
!      ha_kc=79.43d0
!      ha_ko=36.38d0

!S. von Caemmerer (2000) values
!      ha_darkresp=66.4d0
!      ha_stargamma=23.4d0
!      ha_kc=59.36d0
!      ha_ko=35.94d0

!Jordan and Ogren (1984) parameters
!      ha_darkresp=66.4d0
!      ha_stargamma=29.213d0
!      ha_kc=70.372d0
!      ha_ko=14.351d0

!Values used in Sharkey et al. (2007)
      ha_darkresp=46.39d0
      ha_stargamma=24.46d0
      ha_kc=80.99d0
      ha_ko=23.72d0
               
!----------------------------------------------------------
!Leaf absorptance parameter in PAR
      abspt_lf_par=0.85d0
!
!!3/29/2014. Bernacchi method cannot fit A/PAR curves well. phifactor and thetafactor are
!estimated and used to modify his method when A/PAR curves are present.
! phifactor: modifies Bernacchi phiPSIImax
! thetafactor: modifies Bernacchi thetaPSII
      phifactor=1.0d0
      thetafactor=1.0d0
      betaPSII=0.5d0
      return
      end
