TABLE OF CONTENTS


ABINIT/chkint_ne [ Functions ]

[ Top ] [ Functions ]

NAME

 chkint_ne

FUNCTION

 Checks the value of an input integer variable against a list, and
 write a sophisticated error message when the value appears in the list.
 A few conditions might have been checked before calling chkint,
 and these are mentioned in the error message.

 See the examples in the NOTES

COPYRIGHT

 Copyright (C) 1998-2017 ABINIT group (XG)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

INPUTS

 advice_change_cond= if 1, and if an error is detected, will
  advice to change the value of the conditions.
 cond_number= number of conditions checked before calling chkint.
 cond_string(cond_number)= name of the variables associated to the conditions.
 cond_values(cond_number)= value of the variables associated to the conditions.
 input_name=name of the input variable to be checked
 input_value=value of the input variable to be checked
 list_number=number of NOT allowed values (maximum 40).
 list_values=list of allowed values
 unit=unit number for clean output file

OUTPUT

  (only side effect)

 SIDE EFFECT
 ierr= switch it to 1 if an error was detected. No action otherwise.

NOTES

 cond_values(cond_number) or list_values(list_number)
 must be between -99 and 999 to be printed correctly.

 for the time being, at most 3 conditions are allowed.

PARENTS

      chkinp

CHILDREN

      chkint_prt

SOURCE

 53 #if defined HAVE_CONFIG_H
 54 #include "config.h"
 55 #endif
 56 
 57 #include "abi_common.h"
 58 
 59 
 60 subroutine chkint_ne(advice_change_cond,cond_number,cond_string,cond_values,&
 61 &  ierr,input_name,input_value,&
 62 &  list_number,list_values,unit)
 63 
 64  use defs_basis
 65  use m_profiling_abi
 66 
 67 !This section has been created automatically by the script Abilint (TD).
 68 !Do not modify the following lines by hand.
 69 #undef ABI_FUNC
 70 #define ABI_FUNC 'chkint_ne'
 71  use interfaces_57_iovars, except_this_one => chkint_ne
 72 !End of the abilint section
 73 
 74  implicit none
 75 
 76 !Arguments ------------------------------------
 77 !scalars
 78  integer,intent(in) :: advice_change_cond,cond_number,input_value,list_number
 79  integer,intent(in) :: unit
 80  integer,intent(inout) :: ierr
 81  character(len=*),intent(in) :: input_name
 82 !arrays
 83  integer,intent(in) :: cond_values(4),list_values(list_number)
 84  character(len=*),intent(inout) :: cond_string(4)
 85 
 86 !Local variables-------------------------------
 87 !scalars
 88  integer :: ilist,minmax_flag,minmax_value,ok
 89 
 90 !******************************************************************
 91 
 92 !Checks the allowed values
 93  ok=1
 94  if(list_number>0)then
 95    do ilist=1,list_number
 96      if(input_value == list_values(ilist))ok=0
 97    end do
 98  end if
 99  minmax_flag=2
100  minmax_value=0
101 
102 !If there is something wrong, compose the message, and print it
103  if(ok==0)then
104    call chkint_prt(advice_change_cond,cond_number,cond_string,cond_values,&
105 &   ierr,input_name,input_value,&
106 &   list_number,list_values,minmax_flag,minmax_value,unit)
107  end if
108 
109 ! reset all cond_strings
110  cond_string(:)='#####'
111 
112 end subroutine chkint_ne