TABLE OF CONTENTS
ABINIT/appdig [ Functions ]
NAME
appdig
FUNCTION
Using input string "string" and integer "integ", make a string named 'strinn' by concatenating digits of "integ" with characters of "string"; return final string in "strinn". Can also treat initial empty string, then simply returns the integer in the form of a string
INPUTS
integ=nonnegative integer whose digits will be appended to string string=string to which digits will be appended
OUTPUT
strinn=string//nn
SOURCE
58 subroutine appdig(integ,string,strinn) 59 60 !Arguments ------------------------------------ 61 !scalars 62 integer,intent(in) :: integ 63 character(len=*),intent(in) :: string 64 character(len=*),intent(out) :: strinn 65 66 !Local variables------------------------------- 67 !scalars 68 integer :: i,length,ndig 69 character(len=2) :: ncha 70 character(len=8) :: form 71 !character(len=500) :: msg 72 73 ! ************************************************************************* 74 75 ! Check that integer is nonnegative 76 !if (integ<0) then 77 ! write(msg,'(a,i0,a)') & 78 ! 'Input integer =',integ,' must not be <0. Argument integ was input as negative.' 79 ! ABI_BUG(msg) 80 !end if 81 82 ! Fill output string initially with blanks to end of dimensioned length 83 length=len(strinn) 84 do i=1,length 85 strinn(i:i)=' ' 86 end do 87 88 !Find nonwhitespace length of string 89 length=len_trim(string) 90 !Copy input character string into first part of output string 91 if(length>0)then 92 strinn(1:length)=string(1:length) 93 end if 94 95 !Find how many digits "integ" has 96 ndig=int(log10(real(integ)+0.50))+1 97 98 !Create a format for exact number of digits using internal write 99 write(unit=ncha,fmt='(i2)') ndig 100 form='(i'//ncha//')' 101 !Do internal write to get digits of integer into character string, 102 !placing digits into appropriate end of string. 103 write(unit=strinn(1+length:length+ndig),fmt=form) integ 104 !(Note that present version writes "1" or "2" for single digit, 105 !not "01" or "02". Latter may be preferable. Can be amended.) 106 ! 107 108 end subroutine appdig
ABINIT/m_abicore [ Modules ]
NAME
m_abicore
FUNCTION
COPYRIGHT
Copyright (C) 2008-2024 ABINIT group This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt .
SOURCE
15 #if defined HAVE_CONFIG_H 16 #include "config.h" 17 #endif 18 19 #include "abi_common.h" 20 21 module m_abicore 22 23 !use defs_basis 24 !use m_build_info 25 use m_profiling_abi 26 use m_specialmsg !, only : herald, specialmsg_setcount, specialmsg_getcount, specialmsg_mpisum, wrtout 27 !use m_errors 28 29 30 implicit none 31 32 public 33 34 contains !=====================================================