error_base.F90 Source File


Files dependent on this one

sourcefile~~error_base.f90~~AfferentGraph sourcefile~error_base.f90 error_base.F90 sourcefile~comms.f90 comms.F90 sourcefile~comms.f90->sourcefile~error_base.f90 sourcefile~error.f90 error.F90 sourcefile~error.f90->sourcefile~error_base.f90 sourcefile~error.f90->sourcefile~comms.f90 sourcefile~io.f90 io.F90 sourcefile~io.f90->sourcefile~error_base.f90 sourcefile~io.f90->sourcefile~comms.f90 sourcefile~library_extra.f90 library_extra.F90 sourcefile~library_extra.f90->sourcefile~error_base.f90 sourcefile~library_extra.f90->sourcefile~comms.f90 sourcefile~library_extra.f90->sourcefile~error.f90 sourcefile~library_extra.f90->sourcefile~io.f90 sourcefile~library_interface.f90 library_interface.F90 sourcefile~library_extra.f90->sourcefile~library_interface.f90 sourcefile~kmesh.f90 kmesh.F90 sourcefile~library_extra.f90->sourcefile~kmesh.f90 sourcefile~overlap.f90 overlap.F90 sourcefile~library_extra.f90->sourcefile~overlap.f90 sourcefile~readwrite.f90 readwrite.F90 sourcefile~library_extra.f90->sourcefile~readwrite.f90 sourcefile~wannier90_readwrite.f90 wannier90_readwrite.F90 sourcefile~library_extra.f90->sourcefile~wannier90_readwrite.f90 sourcefile~library_interface.f90->sourcefile~error_base.f90 sourcefile~library_interface.f90->sourcefile~comms.f90 sourcefile~library_interface.f90->sourcefile~error.f90 sourcefile~library_interface.f90->sourcefile~io.f90 sourcefile~disentangle.f90 disentangle.F90 sourcefile~library_interface.f90->sourcefile~disentangle.f90 sourcefile~library_interface.f90->sourcefile~kmesh.f90 sourcefile~library_interface.f90->sourcefile~overlap.f90 sourcefile~plot.f90 plot.F90 sourcefile~library_interface.f90->sourcefile~plot.f90 sourcefile~library_interface.f90->sourcefile~readwrite.f90 sourcefile~transport.f90 transport.F90 sourcefile~library_interface.f90->sourcefile~transport.f90 sourcefile~library_interface.f90->sourcefile~wannier90_readwrite.f90 sourcefile~wannierise.f90 wannierise.F90 sourcefile~library_interface.f90->sourcefile~wannierise.f90 sourcefile~berry.f90 berry.F90 sourcefile~berry.f90->sourcefile~comms.f90 sourcefile~berry.f90->sourcefile~error.f90 sourcefile~berry.f90->sourcefile~io.f90 sourcefile~get_oper.f90 get_oper.F90 sourcefile~berry.f90->sourcefile~get_oper.f90 sourcefile~postw90_common.f90 postw90_common.F90 sourcefile~berry.f90->sourcefile~postw90_common.f90 sourcefile~postw90_types.f90 postw90_types.F90 sourcefile~berry.f90->sourcefile~postw90_types.f90 sourcefile~spin.f90 spin.F90 sourcefile~berry.f90->sourcefile~spin.f90 sourcefile~utility.f90 utility.F90 sourcefile~berry.f90->sourcefile~utility.f90 sourcefile~wan_ham.f90 wan_ham.F90 sourcefile~berry.f90->sourcefile~wan_ham.f90 sourcefile~tetrahedron.f90 tetrahedron.F90 sourcefile~berry.f90->sourcefile~tetrahedron.f90 sourcefile~boltzwann.f90 boltzwann.F90 sourcefile~boltzwann.f90->sourcefile~comms.f90 sourcefile~boltzwann.f90->sourcefile~error.f90 sourcefile~boltzwann.f90->sourcefile~io.f90 sourcefile~dos.f90 dos.F90 sourcefile~boltzwann.f90->sourcefile~dos.f90 sourcefile~boltzwann.f90->sourcefile~get_oper.f90 sourcefile~boltzwann.f90->sourcefile~postw90_types.f90 sourcefile~boltzwann.f90->sourcefile~readwrite.f90 sourcefile~boltzwann.f90->sourcefile~spin.f90 sourcefile~boltzwann.f90->sourcefile~utility.f90 sourcefile~boltzwann.f90->sourcefile~wan_ham.f90 sourcefile~c_interface.f90 c_interface.F90 sourcefile~c_interface.f90->sourcefile~library_interface.f90 sourcefile~disentangle.f90->sourcefile~comms.f90 sourcefile~disentangle.f90->sourcefile~error.f90 sourcefile~disentangle.f90->sourcefile~io.f90 sourcefile~sitesym.f90 sitesym.F90 sourcefile~disentangle.f90->sourcefile~sitesym.f90 sourcefile~disentangle.f90->sourcefile~utility.f90 sourcefile~dos.f90->sourcefile~comms.f90 sourcefile~dos.f90->sourcefile~error.f90 sourcefile~dos.f90->sourcefile~io.f90 sourcefile~dos.f90->sourcefile~get_oper.f90 sourcefile~dos.f90->sourcefile~postw90_common.f90 sourcefile~dos.f90->sourcefile~postw90_types.f90 sourcefile~dos.f90->sourcefile~spin.f90 sourcefile~dos.f90->sourcefile~utility.f90 sourcefile~dos.f90->sourcefile~wan_ham.f90 sourcefile~geninterp.f90 geninterp.F90 sourcefile~geninterp.f90->sourcefile~comms.f90 sourcefile~geninterp.f90->sourcefile~error.f90 sourcefile~geninterp.f90->sourcefile~io.f90 sourcefile~geninterp.f90->sourcefile~get_oper.f90 sourcefile~geninterp.f90->sourcefile~postw90_common.f90 sourcefile~geninterp.f90->sourcefile~postw90_types.f90 sourcefile~geninterp.f90->sourcefile~utility.f90 sourcefile~geninterp.f90->sourcefile~wan_ham.f90 sourcefile~get_oper.f90->sourcefile~comms.f90 sourcefile~get_oper.f90->sourcefile~error.f90 sourcefile~get_oper.f90->sourcefile~io.f90 sourcefile~get_oper.f90->sourcefile~postw90_types.f90 sourcefile~get_oper.f90->sourcefile~utility.f90 sourcefile~gyrotropic.f90 gyrotropic.F90 sourcefile~gyrotropic.f90->sourcefile~comms.f90 sourcefile~gyrotropic.f90->sourcefile~error.f90 sourcefile~gyrotropic.f90->sourcefile~io.f90 sourcefile~gyrotropic.f90->sourcefile~berry.f90 sourcefile~gyrotropic.f90->sourcefile~get_oper.f90 sourcefile~gyrotropic.f90->sourcefile~postw90_common.f90 sourcefile~gyrotropic.f90->sourcefile~postw90_types.f90 sourcefile~gyrotropic.f90->sourcefile~spin.f90 sourcefile~gyrotropic.f90->sourcefile~utility.f90 sourcefile~gyrotropic.f90->sourcefile~wan_ham.f90 sourcefile~hamiltonian.f90 hamiltonian.F90 sourcefile~hamiltonian.f90->sourcefile~comms.f90 sourcefile~hamiltonian.f90->sourcefile~error.f90 sourcefile~hamiltonian.f90->sourcefile~io.f90 sourcefile~hamiltonian.f90->sourcefile~utility.f90 sourcefile~kmesh.f90->sourcefile~comms.f90 sourcefile~kmesh.f90->sourcefile~error.f90 sourcefile~kmesh.f90->sourcefile~io.f90 sourcefile~kmesh.f90->sourcefile~utility.f90 sourcefile~kpath.f90 kpath.F90 sourcefile~kpath.f90->sourcefile~comms.f90 sourcefile~kpath.f90->sourcefile~error.f90 sourcefile~kpath.f90->sourcefile~io.f90 sourcefile~kpath.f90->sourcefile~berry.f90 sourcefile~kpath.f90->sourcefile~get_oper.f90 sourcefile~kpath.f90->sourcefile~postw90_common.f90 sourcefile~kpath.f90->sourcefile~postw90_types.f90 sourcefile~kpath.f90->sourcefile~spin.f90 sourcefile~kpath.f90->sourcefile~utility.f90 sourcefile~kslice.f90 kslice.F90 sourcefile~kslice.f90->sourcefile~comms.f90 sourcefile~kslice.f90->sourcefile~error.f90 sourcefile~kslice.f90->sourcefile~io.f90 sourcefile~kslice.f90->sourcefile~berry.f90 sourcefile~kslice.f90->sourcefile~get_oper.f90 sourcefile~kslice.f90->sourcefile~postw90_common.f90 sourcefile~kslice.f90->sourcefile~postw90_types.f90 sourcefile~kslice.f90->sourcefile~spin.f90 sourcefile~kslice.f90->sourcefile~utility.f90 sourcefile~kslice.f90->sourcefile~wan_ham.f90 sourcefile~overlap.f90->sourcefile~comms.f90 sourcefile~overlap.f90->sourcefile~error.f90 sourcefile~overlap.f90->sourcefile~io.f90 sourcefile~overlap.f90->sourcefile~sitesym.f90 sourcefile~overlap.f90->sourcefile~utility.f90 sourcefile~plot.f90->sourcefile~comms.f90 sourcefile~plot.f90->sourcefile~error.f90 sourcefile~plot.f90->sourcefile~io.f90 sourcefile~plot.f90->sourcefile~hamiltonian.f90 sourcefile~plot.f90->sourcefile~utility.f90 sourcefile~ws_distance.f90 ws_distance.F90 sourcefile~plot.f90->sourcefile~ws_distance.f90 sourcefile~postw90.f90 postw90.F90 sourcefile~postw90.f90->sourcefile~comms.f90 sourcefile~postw90.f90->sourcefile~error.f90 sourcefile~postw90.f90->sourcefile~io.f90 sourcefile~postw90.f90->sourcefile~berry.f90 sourcefile~postw90.f90->sourcefile~boltzwann.f90 sourcefile~postw90.f90->sourcefile~dos.f90 sourcefile~postw90.f90->sourcefile~geninterp.f90 sourcefile~postw90.f90->sourcefile~gyrotropic.f90 sourcefile~postw90.f90->sourcefile~kmesh.f90 sourcefile~postw90.f90->sourcefile~kpath.f90 sourcefile~postw90.f90->sourcefile~kslice.f90 sourcefile~postw90.f90->sourcefile~postw90_common.f90 sourcefile~postw90_readwrite.f90 postw90_readwrite.F90 sourcefile~postw90.f90->sourcefile~postw90_readwrite.f90 sourcefile~postw90.f90->sourcefile~postw90_types.f90 sourcefile~postw90.f90->sourcefile~readwrite.f90 sourcefile~postw90.f90->sourcefile~spin.f90 sourcefile~postw90_common.f90->sourcefile~comms.f90 sourcefile~postw90_common.f90->sourcefile~error.f90 sourcefile~postw90_common.f90->sourcefile~io.f90 sourcefile~postw90_common.f90->sourcefile~postw90_types.f90 sourcefile~postw90_common.f90->sourcefile~utility.f90 sourcefile~postw90_common.f90->sourcefile~ws_distance.f90 sourcefile~postw90_readwrite.f90->sourcefile~comms.f90 sourcefile~postw90_readwrite.f90->sourcefile~error.f90 sourcefile~postw90_readwrite.f90->sourcefile~postw90_types.f90 sourcefile~postw90_readwrite.f90->sourcefile~readwrite.f90 sourcefile~postw90_readwrite.f90->sourcefile~utility.f90 sourcefile~postw90_types.f90->sourcefile~comms.f90 sourcefile~readwrite.f90->sourcefile~comms.f90 sourcefile~readwrite.f90->sourcefile~error.f90 sourcefile~readwrite.f90->sourcefile~io.f90 sourcefile~readwrite.f90->sourcefile~utility.f90 sourcefile~sitesym.f90->sourcefile~comms.f90 sourcefile~sitesym.f90->sourcefile~error.f90 sourcefile~sitesym.f90->sourcefile~utility.f90 sourcefile~spin.f90->sourcefile~comms.f90 sourcefile~spin.f90->sourcefile~error.f90 sourcefile~spin.f90->sourcefile~get_oper.f90 sourcefile~spin.f90->sourcefile~postw90_common.f90 sourcefile~spin.f90->sourcefile~postw90_types.f90 sourcefile~spin.f90->sourcefile~utility.f90 sourcefile~transport.f90->sourcefile~comms.f90 sourcefile~transport.f90->sourcefile~error.f90 sourcefile~transport.f90->sourcefile~io.f90 sourcefile~transport.f90->sourcefile~hamiltonian.f90 sourcefile~utility.f90->sourcefile~comms.f90 sourcefile~utility.f90->sourcefile~error.f90 sourcefile~w90chk2chk.f90 w90chk2chk.F90 sourcefile~w90chk2chk.f90->sourcefile~io.f90 sourcefile~w90spn2spn.f90 w90spn2spn.F90 sourcefile~w90spn2spn.f90->sourcefile~io.f90 sourcefile~wan_ham.f90->sourcefile~comms.f90 sourcefile~wan_ham.f90->sourcefile~error.f90 sourcefile~wan_ham.f90->sourcefile~get_oper.f90 sourcefile~wan_ham.f90->sourcefile~postw90_common.f90 sourcefile~wan_ham.f90->sourcefile~postw90_types.f90 sourcefile~wan_ham.f90->sourcefile~utility.f90 sourcefile~wannier90_readwrite.f90->sourcefile~error.f90 sourcefile~wannier90_readwrite.f90->sourcefile~io.f90 sourcefile~wannier90_readwrite.f90->sourcefile~readwrite.f90 sourcefile~wannier90_readwrite.f90->sourcefile~utility.f90 sourcefile~wannier_prog.f90 wannier_prog.F90 sourcefile~wannier_prog.f90->sourcefile~comms.f90 sourcefile~wannier_prog.f90->sourcefile~error.f90 sourcefile~wannier_prog.f90->sourcefile~io.f90 sourcefile~wannier_prog.f90->sourcefile~library_extra.f90 sourcefile~wannier_prog.f90->sourcefile~library_interface.f90 sourcefile~wannier_prog.f90->sourcefile~sitesym.f90 sourcefile~wannierise.f90->sourcefile~comms.f90 sourcefile~wannierise.f90->sourcefile~error.f90 sourcefile~wannierise.f90->sourcefile~io.f90 sourcefile~wannierise.f90->sourcefile~hamiltonian.f90 sourcefile~wannierise.f90->sourcefile~sitesym.f90 sourcefile~wannierise.f90->sourcefile~utility.f90 sourcefile~wannierise.f90->sourcefile~wannier90_readwrite.f90 sourcefile~ws_distance.f90->sourcefile~comms.f90 sourcefile~ws_distance.f90->sourcefile~error.f90 sourcefile~ws_distance.f90->sourcefile~io.f90 sourcefile~ws_distance.f90->sourcefile~utility.f90 sourcefile~tetrahedron.f90->sourcefile~utility.f90

Source Code

!-*- mode: F90 -*-!
!------------------------------------------------------------!
! Copyright (C) 2026 Wannier Developer Group                 !
!                                                            !
! This library is free software; you can redistribute it     !
! and/or modify it under the terms of the GNU Lesser General !
! Public License as published by the Free Software           !
! Foundation; either version 2.1 of the License, or (at your !
! option) any later version.                                 !
!                                                            !
! This library is distributed in the hope that it will be    !
! useful,but WITHOUT ANY WARRANTY; without even the implied  !
! warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR    !
! PURPOSE.  See the GNU Lesser General Public License for    !
! more details.                                              !
!                                                            !
! You should have received a copy of the GNU Lesser General  !
! Public License along with this library; if not, see        !
! <https://www.gnu.org/licenses/>.                           !
!                                                            !
! The webpage of the Wannier90 code is                       !
! <https://www.wannier.org>.                                 !
!                                                            !
! The Wannier90 code is hosted on GitHub                     !
! <https://github.com/wannier-developers/wannier90>          !
!------------------------------------------------------------!

module w90_error_base
  !! Module to handle errors

  implicit none

  public

  !! Codify error state with integer code and human readable string
  type w90_error_type
    integer :: code
    character(len=128) :: message
#ifdef W90DEV
  contains
    final :: untrapped_error
#endif
  end type w90_error_type

  integer, parameter :: code_remote = -99 ! special code for error triggered by other mpi rank
  integer, parameter :: code_deactivated = -888 ! special code for error triggered by other mpi rank

contains

  subroutine untrapped_error(err)
    type(w90_error_type), intent(in) :: err
    ! this routine should never be called, so write to stderr and call "stop" in desparation
    if (err%code == code_deactivated) return
    write (0, *) "UNTRAPPED ERROR: ", err%code
    write (0, *) "UNTRAPPED ERROR: ", err%message
    stop
  end subroutine untrapped_error

  subroutine set_base_error(err, mesg, code)
    type(w90_error_type), allocatable, intent(out) :: err
    character(len=*), intent(in) :: mesg
    integer, intent(in) :: code
    allocate (err)
    err%message = trim(mesg)
    err%code = code
  end subroutine set_base_error

  ! the following is required by subroutines of the comms module
  subroutine recv_error(err)
    type(w90_error_type), allocatable, intent(out) :: err
    allocate (err)
    err%code = code_remote
  end subroutine recv_error

end module w90_error_base