~nickpapior/siesta/tddft-work

« back to all changes in this revision

Viewing changes to Util/Gen-basis/local_die.F

  • Committer: Rafi Ullah
  • Date: 2017-08-30 14:09:10 UTC
  • mfrom: (611.1.19 trunk)
  • Revision ID: rraffiu@gmail.com-20170830140910-bhu0osuh4d59wn8e
Merged with trunk-630

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
! ---
2
 
! Copyright (C) 1996-2016       The SIESTA group
3
 
!  This file is distributed under the terms of the
4
 
!  GNU General Public License: see COPYING in the top directory
5
 
!  or http://www.gnu.org/copyleft/gpl.txt .
6
 
! See Docs/Contributors.txt for a list of contributors.
7
 
! ---
8
 
!--------------------------------------------------
9
 
! Stand-alone 'die' routine for use by libraries and
10
 
! low-level modules.
11
 
!
12
 
! Each program using the module or library needs to
13
 
! provide a routine with the proper interface, but
14
 
! accomodating the needs and conventions of the program.
15
 
! For example, in Siesta:
16
 
!
17
 
!   - The use of a Siesta-specific 'mpi_siesta' module.
18
 
!   - The need to have the pxf functionality.
19
 
!   - The use of 'unit 6' as output.
20
 
!
21
 
! Routines using this functionality should include
22
 
! the following
23
 
!
24
 
!     interface
25
 
!      subroutine die(str)
26
 
!      character(len=*), intent(in)  :: str
27
 
!      end subroutine die
28
 
!     end interface
29
 
!
30
 
!------------------------------------------------------
31
 
 
32
 
      subroutine die(str)
33
 
 
34
 
      use parallel, only : Node
35
 
#ifdef MPI
36
 
      use mpi_siesta
37
 
#endif
38
 
 
39
 
      character(len=*), intent(in)  :: str
40
 
 
41
 
#ifdef MPI
42
 
      integer MPIerror
43
 
#endif
44
 
 
45
 
! Even though formally (in MPI 1.X), only the master node
46
 
! can do I/O, in those systems that allow it having each
47
 
! node state its complaint can be useful.
48
 
 
49
 
!!                                       if (Node.eq.0) then
50
 
      write(6,'(a)') trim(str)
51
 
      write(0,'(a)') trim(str)
52
 
      write(6,'(a,i4)') 'Stopping Program from Node: ', Node
53
 
      write(0,'(a,i4)') 'Stopping Program from Node: ', Node
54
 
!!                                       endif
55
 
      if (Node .eq. 0) then
56
 
         call pxfflush(6)
57
 
         call pxfflush(0)
58
 
      endif
59
 
 
60
 
#ifdef MPI
61
 
      call MPI_Abort(MPI_Comm_World,1,MPIerror)
62
 
      stop
63
 
#else
64
 
      call pxfabort()
65
 
#endif
66
 
      end subroutine die