anchor.diff:  
           ! Now system initialisation is complete (boo), act on the other options.
           call read_restart_in(lua_state, opts, restart_in)
  -        call read_reference_t(lua_state, opts, sys, reference)
  +        call read_reference_t(lua_state, opts, reference, sys)
           call get_qmc_state(lua_state, have_restart_state, qmc_state_restart)
           ! load balancing not implemented in DMQMC--just use defaults.
           call warn_unused_args(lua_state, keys, opts)
  
positive.code:         call read_semi_stoch_in(lua_state, opts, qmc_in, semi_stoch_in)
          call read_restart_in(lua_state, opts, restart_in)
          call read_load_bal_in(lua_state, opts, load_bal_in)
          call read_reference_t(lua_state, opts, sys, reference)
  
          call get_qmc_state(lua_state, have_restart_state, qmc_state_restart)
  
  
negative.code: 
          type(flu_State), intent(inout) :: lua_state
          integer, intent(in) :: opts
          type(reference_t), intent(out) :: ref
          type(sys_t), intent(in), optional :: sys
          character(*), intent(in), optional :: ref_table_name
  
          integer :: ref_table, err
          integer, allocatable :: err_arr(:)
          character(17), parameter :: keys(3) = [character(17) :: 'det', 'hilbert_space_det', 'ex_level']
          ! Avoid using allocatable strings here for old compiler support.
          character(100) :: ref_name
  
          ! Set to full space/a problematic value by default.
          ref%ex_level = -1
          if (present(sys)) ref%ex_level = sys%nel
  
          ref_name = 'reference'
          if (present(ref_table_name)) then
              if (len(ref_name) > len(ref_table_name)) call stop_all('read_reference_t', 'ref_name size too large.')
              ref_name = ref_table_name
          end if
  
          if (aot_exists(lua_state, opts, ref_name)) then
  
              call aot_table_open(lua_state, opts, ref_table, ref_name)
  
              ! Optional arguments requiring special handling.
  
  