TABLE OF CONTENTS
ABINIT/importxyz [ Functions ]
NAME
importxyz
FUNCTION
Examine the input string, to see whether data from xyz file(s) has to be incorporated. For each such xyz file, translate the relevant information into intermediate input variables compatible with the usual ABINIT formatting, then append it to the input string.
COPYRIGHT
Copyright (C) 2002-2017 ABINIT group (MJV). 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
string_raw*(strln)=raw string of character from input file (with original case) strln=maximal number of character of string, as declared in the calling routine
OUTPUT
SIDE EFFECTS
lenstr=actual number of character in string string_upper*(strln)=string of character the string (with upper case) from the input file, to which the xyz data are appended to it
PARENTS
m_ab7_invars_f90,parsefile
CHILDREN
append_xyz,incomprs,wrtout
SOURCE
40 #if defined HAVE_CONFIG_H 41 #include "config.h" 42 #endif 43 44 #include "abi_common.h" 45 46 47 subroutine importxyz (lenstr,string_raw,string_upper,strln) 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 'importxyz' 57 use interfaces_14_hidewrite 58 use interfaces_42_parser 59 use interfaces_57_iovars, except_this_one => importxyz 60 !End of the abilint section 61 62 implicit none 63 64 !Arguments ------------------------------------ 65 !scalars 66 integer,intent(in) :: strln 67 integer,intent(inout) :: lenstr 68 character(len=*),intent(in) :: string_raw 69 character(len=*),intent(inout) :: string_upper 70 71 !Local variables------------------------------- 72 character :: blank=' ' 73 !scalars 74 integer :: dtset_len,ixyz,ii,index_already_done,index_xyz_fname 75 integer :: index_xyz_fname_end,index_xyz_token,kk 76 character(len=2) :: dtset_char 77 character(len=500) :: message 78 character(len=fnlen) :: xyz_fname 79 80 !************************************************************************ 81 82 index_already_done=1 83 ixyz=0 84 85 do ! Infinite do-loop, to identify the presence of the xyzFILE token 86 87 index_xyz_token=index(string_upper(index_already_done:lenstr),"XYZFILE") 88 if(index_xyz_token==0)exit 89 90 ixyz=ixyz+1 91 if(ixyz==1)then 92 write(message,'(80a)')('=',ii=1,80) 93 call wrtout(ab_out,message,'COLL') 94 end if 95 96 ! The xyzFILE token has been identified 97 index_xyz_token=index_already_done+index_xyz_token-1 98 99 ! Find the related dataset tag, and length 100 dtset_char=string_upper(index_xyz_token+7:index_xyz_token+8) 101 if(dtset_char(1:1)==blank)dtset_char(2:2)=blank 102 dtset_len=len_trim(dtset_char) 103 104 ! Find the name of the xyz file 105 index_xyz_fname=index_xyz_token+8+dtset_len 106 index_xyz_fname_end=index(string_upper(index_xyz_fname:lenstr),blank) 107 108 if(index_xyz_fname_end ==0 )then 109 write(message, '(5a,i4,2a)' )& 110 & 'Could not find the name of the xyz file.',ch10,& 111 & 'index_xyz_fname_end should be non-zero, while it is :',ch10,& 112 & 'index_xyz_fname_end=',index_xyz_fname_end,ch10,& 113 & 'Action: check the filename that was provided after the XYZFILE input variable keyword.' 114 MSG_ERROR(message) 115 end if 116 117 index_xyz_fname_end=index_xyz_fname_end+index_xyz_fname-1 118 119 index_already_done=index_xyz_fname_end 120 121 xyz_fname=repeat(blank,fnlen) ! Initialize xyz_fname to a blank line 122 xyz_fname=string_raw(index_xyz_fname:index_xyz_fname_end-1) 123 124 write(message, '(3a)') ch10,& 125 & ' importxyz : Identified token XYZFILE, referring to file ',trim(xyz_fname) 126 call wrtout(std_out,message,'COLL') 127 call wrtout(ab_out,message,'COLL') 128 129 ! Append the data from the xyz file to the string, and update the length of the string 130 call append_xyz(dtset_char,lenstr,string_upper,xyz_fname,strln) 131 132 ! erase the file name from string_upper 133 string_upper(index_xyz_fname:index_xyz_fname_end-1) = blank 134 135 end do 136 137 if (index_already_done > 1) then 138 xyz_fname=repeat(blank,fnlen) ! Initialize xyz_fname to a blank line 139 call append_xyz("-1",lenstr,string_upper,xyz_fname,strln) 140 end if 141 142 if(ixyz/=0)then 143 call incomprs(string_upper,lenstr) 144 ! A blank is needed at the beginning of the string 145 do kk=lenstr,1,-1 146 string_upper(kk+1:kk+1)=string_upper(kk:kk) 147 end do 148 string_upper(1:1)=blank 149 lenstr=lenstr+1 150 write(message,'(a,80a,a)')ch10,('=',ii=1,80),ch10 151 call wrtout(ab_out,message,'COLL') 152 end if 153 154 end subroutine importxyz