23     type (str_socrates_options), 
intent(inout) :: socrates_opt
 
   31             (
log_error, 
"Socrates and lwrad_exponential both enabled, switch off on in config - STOP")
 
   35     if (.not. current_state%th%active) 
then 
   37             (
log_error, 
"Socrates called with theta inactive, this is not supported - STOP")
 
   40     socrates_opt%cloud_representation = &
 
   42     if (socrates_opt%cloud_representation == 5) 
then  
   44        if (current_state%number_q_fields < 1) 
then  
   49     else if (socrates_opt%cloud_representation == 2 .or. socrates_opt%cloud_representation == 1) 
then 
   55                (
log_error, 
"Socrates called for cloudy sky but no microphysics scheme enabled - STOP")
 
   57        if (current_state%passive_q ) 
then 
   59                (
log_error, 
"Socrates called for cloudy sky but q is passive so not cloud or vapour - STOP")
 
   61        if (current_state%number_q_fields < 2) 
then  
   63                (
log_error, 
"Socrates called for clear and cloud sky calc but no vapour or cloud field - STOP")
 
   80        if (socrates_opt%mphys_nq_l > 0) &
 
   82        if (socrates_opt%mphys_nq_r > 0) &
 
   84        if (socrates_opt%mphys_nq_i > 0) &
 
   86        if (socrates_opt%mphys_nq_s > 0) &
 
   88        if (socrates_opt%mphys_nq_g > 0) &
 
   92        socrates_opt%l_use_ndrop = 
options_get_logical(current_state%options_database, 
"l_use_ndrop")
 
   93        if ((socrates_opt%l_fix_re .and. socrates_opt%l_use_ndrop) .or. &
 
   94             (.not. socrates_opt%l_fix_re .and. .not. socrates_opt%l_use_ndrop)) 
then 
   96                      (
log_error, 
"Socrates - l_fix_re and l_use_ndrop both true or both false, please pick one - STOP")
 
   98        if (socrates_opt%l_fix_re) 
then 
   99           socrates_opt%fixed_cloud_re = 
options_get_real(current_state%options_database, 
"fixed_cloud_re")
 
  100           socrates_opt%fixed_ice_re = 
options_get_real(current_state%options_database, 
"fixed_ice_re")
 
  102                (
log_info, 
"Socrates - using fixed cloud effective radius"//trim(
conv_to_string(socrates_opt%fixed_cloud_re)))
 
  104                (
log_info, 
"Socrates - using fixed ice effective radius"//trim(
conv_to_string(socrates_opt%fixed_ice_re)))
 
  106        if (socrates_opt%l_use_ndrop) 
then 
  107           socrates_opt%rho_water = 
options_get_real(current_state%options_database, 
"rho_water")
 
  108           socrates_opt%kparam = 
options_get_real(current_state%options_database, 
"kparam")
 
  109           socrates_opt%l_use_liu_spec = 
options_get_logical(current_state%options_database, 
"l_use_liu_spec")
 
  110           if (socrates_opt%mphys_nd_l > 0) 
then 
  113                 socrates_opt%fixed_ice_re = 
options_get_real(current_state%options_database, 
"fixed_ice_re")
 
  115                      (
log_info, 
"Socrates using prognostic cloud number from CASIM, fixed ice re="&
 
  119                      (
log_error, 
"Socrates - casim not enabled so no prognostic nd - STOP")
 
  123              socrates_opt%fixed_cloud_number = 
options_get_real(current_state%options_database, 
"fixed_cloud_number")
 
  124              socrates_opt%fixed_ice_re = 
options_get_real(current_state%options_database, 
"fixed_ice_re")
 
  126                   (
log_info, 
"Socrates using prescribed fix_cloud_number="&
 
  132             (
log_error, 
"Socrates config using unrecognised i_cloud_representation, check config - STOP")    
 
  139     socrates_opt%l_solar_fixed = &
 
  141     socrates_opt%l_no_solar = &
 
  143     socrates_opt%l_rad_calc = .false.
 
  145     if (socrates_opt%l_solar_fixed) 
then 
  146        socrates_opt%solar_fixed = 
options_get_real(current_state%options_database, 
"solar_fixed")
 
  147        socrates_opt%sec_fixed = 
options_get_real(current_state%options_database, 
"sec_fixed")
 
  148        if (socrates_opt%solar_fixed .lt. -1.0 .or. socrates_opt%sec_fixed .lt. -1.0) 
then 
  150                (
log_error, 
"Socrates - l_solar_fixed but solar_fixed and/or sec_fixed not set, check config - STOP")
 
  152        socrates_opt%l_variable_srf_albedo = 
options_get_logical(current_state%options_database, 
"l_variable_srf_albedo")
 
  153        if (socrates_opt%l_variable_srf_albedo) 
then 
  155                (
log_info, 
"Socrates - solar_fixed but variable srf albedo, default to fixed srf albedo")
 
  157        socrates_opt%surface_albedo = 
options_get_real(current_state%options_database, 
"surface_albedo")
 
  160        socrates_opt%rad_year  = 
options_get_real(current_state%options_database, 
"rad_start_year")
 
  161        if (socrates_opt%rad_year < 0.0) 
then 
  163                (
log_error, 
"Socrates - start year is negative, which is wrong, check config - STOP")
 
  166        socrates_opt%rad_start_day  = 
options_get_real(current_state%options_database, 
"rad_start_day")
 
  167        if (socrates_opt%rad_start_day < 0.0 .or. socrates_opt%rad_start_day > 360.0) 
then 
  169                (
log_error, 
"Socrates - start day is outside sensible range, check config - STOP")
 
  172        socrates_opt%rad_start_time = 
options_get_real(current_state%options_database,
"rad_start_time") 
 
  173        if (socrates_opt%rad_time_hours < 0.0 .or. socrates_opt%rad_time_hours > 24.0) 
then 
  175                (
log_error, 
"Socrates - start time is outside sensible range, check config - STOP")
 
  178        socrates_opt%rad_int_time = 
options_get_real(current_state%options_database, 
"rad_int_time")
 
  179        if (socrates_opt%rad_int_time <= 0.0) 
then 
  181                (
log_warn, 
"Socrates - rad_int_time less than 0.0, SOCRATES will be called every timestep")
 
  185        socrates_opt%l_variable_srf_albedo = 
options_get_logical(current_state%options_database, 
"l_variable_srf_albedo")
 
  186        if (socrates_opt%l_variable_srf_albedo) 
then 
  188             (
log_error, 
"Socrates config using variable surface albedo, but this has not been developed. Set to false - STOP")
 
  190        socrates_opt%surface_albedo = 
options_get_real(current_state%options_database, 
"surface_albedo")
 
  193        socrates_opt%latitude  = 
options_get_real(current_state%options_database, 
"latitude")
 
  194        if (socrates_opt%latitude < -90.0 .or. socrates_opt%latitude > 90.0) 
then 
  196                (
log_error, 
"Socrates - latitude is outside sensible range, check config - STOP")
 
  198        socrates_opt%longitude = 
options_get_real(current_state%options_database, 
"longitude")
 
  199        if (socrates_opt%longitude < -180.0 .or. socrates_opt%longitude > 180.0) 
then 
  201                (
log_error, 
"Socrates - longitude is outside sensible range, check config - STOP")
 
  205     if (socrates_opt%surface_albedo < 0.0 .or. socrates_opt%surface_albedo > 1.0) 
then 
  207             (
log_error, 
"Socrates - surface albedo outside sensible range, check config - STOP")
 
  210      socrates_opt%default_solar_constant =  &
 
  217      socrates_opt%co2_mmr = 5.94100e-4
 
  218      socrates_opt%n2o_mmr = 4.925e-7
 
  219      socrates_opt%ch4_mmr = 9.994e-7
 
  220      socrates_opt%o2_mmr = 0.2314
 
  221      socrates_opt%cfc12_mmr = 1.129e-9
 
  222      socrates_opt%cfc11_mmr = 2.225e-9
 
  223      socrates_opt%cfc113_mmr = 0.0
 
  224      socrates_opt%cfc114_mmr = 0.0
 
  225      socrates_opt%hcfc22_mmr = 0.0
 
  226      socrates_opt%hfc125_mmr = 0.0 
 
  227      socrates_opt%hfc134a_mmr = 0.0