mechanism to act upon tokens read from the input ".win" file input is parsed and interpreted (any errors are identified) and the library data structure (variable common_data), already setup by w90_input_setopt, is modified
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(lib_common_type), | intent(inout) | :: | common_data | |||
| integer, | intent(in) | :: | istdout | |||
| integer, | intent(in) | :: | istderr | |||
| integer, | intent(out) | :: | ierr |
subroutine w90_input_reader(common_data, istdout, istderr, ierr) !! mechanism to act upon tokens read from the input ".win" file !! input is parsed and interpreted (any errors are identified) and !! the library data structure (variable common_data), already setup by w90_input_setopt, is modified ! w90_input_setopt() processes options stored in common_data%settings (must be empty here; emptied by w90_input_setopt call) ! w90_input_reader() processes options stored in common_data%in_data (from .win file) use w90_comms, only: valid_communicator use w90_error_base, only: w90_error_type use w90_error, only: set_error_input, set_error_fatal, set_error_alloc, code_mpi use w90_readwrite, only: w90_readwrite_in_file, w90_readwrite_clean_infile use w90_wannier90_readwrite, only: w90_wannier90_readwrite_read implicit none ! arguments integer, intent(in) :: istdout, istderr integer, intent(out) :: ierr type(lib_common_type), intent(inout) :: common_data ! local variables type(w90_error_type), allocatable :: error logical :: cp_pp ierr = 0 if (.not. valid_communicator(common_data%comm)) then ! this is a problem: how do we exit using the parallel error handler when the communicator is unknown? write (istderr, *) ' Error: parallel Wannier90 library invoked with invalid communicator, exiting. Use w90_set_comm()!' ierr = code_mpi return end if if (allocated(common_data%settings%entries)) then call set_error_fatal(error, & 'Error: input reader called when unspent options present (setopt must be called first)', & common_data%comm) call prterr(error, ierr, istdout, istderr, common_data%comm) return end if ! read data from .win file to internal string array call w90_readwrite_in_file(common_data%settings, common_data%seedname, error, common_data%comm) if (allocated(error)) then call prterr(error, ierr, istdout, istderr, common_data%comm) return end if ! set options corresponding to string array from .win file call w90_wannier90_readwrite_read(common_data%settings, common_data%band_plot, & common_data%dis_control, common_data%dis_spheres, & common_data%dis_manifold, common_data%fermi_energy_list, & common_data%fermi_surface_data, common_data%output_file, & common_data%wvfn_read, common_data%wann_control, & common_data%real_space_ham, common_data%kpoint_path, & common_data%w90_system, common_data%tran, & common_data%print_output, common_data%wann_plot, & common_data%ws_region, common_data%real_lattice, & common_data%w90_calculation, common_data%physics%bohr, & common_data%sitesym%symmetrize_eps, common_data%num_bands, & common_data%num_kpts, common_data%num_wann, & common_data%optimisation, common_data%calc_only_A, cp_pp, & common_data%gamma_only, common_data%lsitesymmetry, & common_data%use_bloch_phases, common_data%seedname, & istdout, error, common_data%comm) if (allocated(error)) then call prterr(error, ierr, istdout, istderr, common_data%comm) return end if ! remove any remaining acceptable keywords; anything that remains is an input error call w90_readwrite_clean_infile(common_data%settings, istdout, common_data%seedname, error, & common_data%comm) if (allocated(error)) then call prterr(error, ierr, istdout, istderr, common_data%comm) return end if if (allocated(common_data%settings%in_data)) deallocate (common_data%settings%in_data) end subroutine w90_input_reader