TABLE OF CONTENTS


ABINIT/fappnd [ Functions ]

[ Top ] [ Functions ]

NAME

 fappnd

FUNCTION

 Create the modified root name to be used for output of density, potential,
 and geometry files. See the description of the iapp input variable.

COPYRIGHT

 Copyright (C) 1998-2018 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

 filnam= generic output root name
 iapp=indicates the eventual suffix to be appended to the generic output root
      (the suffixe depends on the presence of the suff (optional) argument.
        if 0 : no suffix to be appended (called directly from gstate)
        if positive : append "_SUF//iapp" (called from move or brdmin)
        if -1 : append "_SUF0" (called from brdmin)
        if -2, -3, -4, -5: append "_SUFA", ... ,"_SUFD", (called from move)
      SUF can be TIM (default) or IMG
 suff= --optional argument--indicates the suffixe to be appended:
       SUF=TIM (default) or SUF=IMG or ...

OUTPUT

 filapp= filename with appended string

PARENTS

      dtfil_init_time

CHILDREN

SOURCE

 39 #if defined HAVE_CONFIG_H
 40 #include "config.h"
 41 #endif
 42 
 43 #include "abi_common.h"
 44 
 45 
 46 subroutine fappnd(filapp,filnam,iapp,&
 47 &                 suff) ! optional argument
 48 
 49  use defs_basis
 50  use m_profiling_abi
 51  use m_errors
 52 
 53 !This section has been created automatically by the script Abilint (TD).
 54 !Do not modify the following lines by hand.
 55 #undef ABI_FUNC
 56 #define ABI_FUNC 'fappnd'
 57 !End of the abilint section
 58 
 59  implicit none
 60 
 61 !Arguments ------------------------------------
 62 !scalars
 63  integer,intent(in) :: iapp
 64  character(len=fnlen),intent(in) :: filnam
 65  character(len=fnlen),intent(out) :: filapp
 66  character(len=3),optional,intent(in) :: suff
 67 
 68 !Local variables-------------------------------
 69 !scalars
 70  integer :: ndig
 71  character(len=3) :: suffixe
 72  character(len=8) :: nchar
 73  character(len=500) :: msg
 74 
 75 ! *************************************************************************
 76 
 77  if(iapp==0)then
 78    filapp=trim(filnam)
 79  else
 80    suffixe="TIM"
 81    if (present(suff)) suffixe=trim(suff(1:3))
 82    if(iapp>0)then
 83 !    Create character string for filename. Determine the number of digits in iapp.
 84      ndig=int(log10(dble(iapp)+0.5_dp))+1
 85 !    Make integer format field of exact size (internal write)
 86 !    for assumed nchar string of 8 characters
 87      write(nchar, '(i8)' ) iapp
 88      if (ndig>8) then
 89        write(msg,'(5a,i0,2a,i0,2a)')&
 90 &       'Requested file name extension has more than the allowed 8 digits.',ch10,&
 91 &       'Action : resubmit the job with smaller value for ntime.',ch10,&
 92 &       'Value computed here was ndig=',ndig,ch10,&
 93 &       'iapp=',iapp,' filnam=',TRIM(filnam)
 94        MSG_ERROR(msg)
 95      end if
 96 !    Concatenate into character string, picking off exact number of digits
 97 !    The potential or density label will be appended in ioarr
 98      filapp=trim(filnam)//'_'//suffixe(1:3)//nchar(9-ndig:8)
 99    else if(iapp==-1)then
100      filapp=trim(filnam)//'_'//suffixe(1:3)//'0'
101    else if(iapp==-2)then
102      filapp=trim(filnam)//'_'//suffixe(1:3)//'A'
103    else if(iapp==-3)then
104      filapp=trim(filnam)//'_'//suffixe(1:3)//'B'
105    else if(iapp==-4)then
106      filapp=trim(filnam)//'_'//suffixe(1:3)//'C'
107    else if(iapp==-5)then
108      filapp=trim(filnam)//'_'//suffixe(1:3)//'D'
109    end if
110  end if
111 
112 end subroutine fappnd