V3FIT
siesta_error.f90
1 !*******************************************************************************
4 !
5 ! Note separating the Doxygen comment block here so detailed decription is
6 ! found in the Module not the file.
7 !
9 !*******************************************************************************
10  MODULE siesta_error
11  USE v3_utilities, ONLY: assert
12  USE shared_data, Only: lrecon
13 
14  IMPLICIT NONE
15 
16 !*******************************************************************************
17 ! module parameters
18 !*******************************************************************************
20  INTEGER, PARAMETER :: siesta_error_no_error = 0
21 
22 ! Bit positions for the various error conditions.
24  INTEGER, PARAMETER :: siesta_error_assert = 0
26  INTEGER, PARAMETER :: siesta_error_block_tri = 1
28  INTEGER, PARAMETER :: siesta_error_general = 2
30  INTEGER, PARAMETER :: siesta_error_allocation = 3
32  INTEGER, PARAMETER :: siesta_error_io = 4
33 
34 !*******************************************************************************
35 ! module variables.
36 !*******************************************************************************
37  INTEGER :: siesta_error_state = siesta_error_no_error
38 
39  CONTAINS
40 !*******************************************************************************
41 ! SETTER SUBROUTINES
42 !*******************************************************************************
43 !-------------------------------------------------------------------------------
51 !-------------------------------------------------------------------------------
52  SUBROUTINE siesta_error_set_error(error_code, message)
53  USE descriptor_mod, ONLY: iam
54 
55  IMPLICIT NONE
56 
57 ! Declare Arguments
58  INTEGER, INTENT(in) :: error_code
59  CHARACTER (len=*), INTENT(in) :: message
60 
61 ! Start of executable code.
62  siesta_error_state = ibset(siesta_error_state, error_code)
63 
64  CALL assert(lrecon, message)
65  IF (iam .EQ. 0) WRITE (*,*) trim(message)
66 
67  END SUBROUTINE
68 
69 !-------------------------------------------------------------------------------
75 !-------------------------------------------------------------------------------
76  SUBROUTINE siesta_error_clear_error(error_code)
77 
78  IMPLICIT NONE
79 
80 ! Declare Arguments
81  INTEGER, INTENT(in) :: error_code
82 
83 ! Start of executable code.
84  siesta_error_state = ibclr(siesta_error_state, error_code)
85 
86  END SUBROUTINE
87 
88 !-------------------------------------------------------------------------------
92 !-------------------------------------------------------------------------------
93  SUBROUTINE siesta_error_clear_all
94 
95  IMPLICIT NONE
96 
97 ! Start of executable code.
98  siesta_error_state = siesta_error_no_error
99 
100  END SUBROUTINE
101 
102  END MODULE
shared_data::lrecon
logical lrecon
Output extra information to the restart file that will be used by V3FIT.
Definition: shared_data.f90:232
v3_utilities::assert
Definition: v3_utilities.f:55
siesta_error
This module contains all the code needed to define error.
Definition: siesta_error.f90:10
shared_data
This file contains variables and parameters used by many modules in SIESTA.
Definition: shared_data.f90:10