~ubuntu-branches/debian/stretch/abinit/stretch

1 by Christophe Prud'homme
Import upstream version 5.3.4.dfsg
1
!{\src2tex{textfont=tt}}
2
!!****f* ABINIT/int2char4
3
!! NAME
4
!! int2char4
5
!!
6
!! FUNCTION
7
!! Convert an integer number to ("2") a character(len=4)
8
!! Makes sure that the integer is between 0 and 9999
9
!!
10
!! COPYRIGHT
11
!! Copyright (C) 2002-2007 ABINIT group (XG).
12
!! This file is distributed under the terms of the
13
!! GNU General Public License, see ~abinit/COPYING
14
!! or http://www.gnu.org/copyleft/gpl.txt .
15
!! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
16
!!
17
!! INPUTS
18
!!  iint=integer to be converted
19
!!
20
!! OUTPUT
21
!!  string=character string
22
!!
23
!! SIDE EFFECTS
24
!!
25
!! PARENTS
26
!!      anascr,contract_int_list,gstate,iofn1,optic,read_wfrspa,respfn,scfcv
27
!!      scfcv3,symgamma,tddft,tetrahedron
28
!!
29
!! CHILDREN
30
!!      leave_new,wrtout
31
!!
32
!! SOURCE
33
34
#if defined HAVE_CONFIG_H
35
#include "config.h"
36
#endif
37
38
subroutine int2char4(iint,string)
39
40
 use defs_basis
41
42
!This section has been created automatically by the script Abilint (TD). Do not modify these by hand.
43
#ifdef HAVE_FORTRAN_INTERFACES
44
 use interfaces_01manage_mpi
45
#endif
46
!End of the abilint section
47
48
 implicit none
49
50
!Arguments ------------------------------------
51
!scalars
52
 integer,intent(in) :: iint
53
 character(len=4),intent(out) :: string
54
55
!Local variables-------------------------------
56
!scalars
57
 character(len=500) :: message
58
59
! *************************************************************************
60
61
 if(iint<0 .or. iint>9999)then
62
  write(message, '(a,a,a,a,a,a,i10)' ) ch10,&
63
&  ' int2char4: ERROR -',ch10,&
64
&  '  The integer argument should be between 0 and 9999, while',ch10,&
65
&  '  it is ',iint
66
    call wrtout(6,message,'COLL')
67
    call leave_new('COLL')
68
 end if
69
 if(iint<10)then
70
  write(string,'("000",i1)')iint
71
 else if(iint<100)then
72
  write(string,'("00",i2)')iint
73
 else if(iint<1000)then
74
  write(string,'("0",i3)')iint
75
 else
76
  write(string,'(i4)')iint
77
 end if
78
79
end subroutine int2char4
80
!!***