62 real(ESPUTR_DP),
dimension(:,:,:),
allocatable,
save,
private ::
fitvalues
66 character(ESPUTR1993_FIRST_COL_WIDTH),
dimension(:),
allocatable,
save,
private ::
targets_names
70 character(ESPUTR1993_FIRST_COL_WIDTH),
dimension(:),
allocatable,
save,
private ::
projectiles_names
83 character(*),
intent(in) :: constantsFile
85 integer,
intent(out) :: err
86 integer,
parameter :: UNIT = 3
87 integer :: i, j, Nlines, res
88 character(ESPUTR_MAX_LINE_LENGTH) :: line
90 character(ESPUTR1993_FIRST_COL_WIDTH),
dimension(:),
allocatable :: lineCols
94 write(
esputr_unit, *)
"ERROR in esputr1993_init: esputr1993_init has already been called; &
95 &call esputr1993_deallocate first"
104 write(
esputr_unit, *)
"ERROR in esputr1993_init: error while determining header lines of " // trim(constantsfile)
112 write(
esputr_unit, *)
"ERROR in esputr1993_init: error while determining number of lines in "&
113 // trim(constantsfile), err
121 write(
esputr_unit, *)
"ERROR in esputr1993_init: file ",trim(constantsfile),
" contains no data"
126 open(unit, iostat=err, file=trim(constantsfile), status=
'old', action=
'read')
128 ifioerr:
if(err /= 0)
then
129 write(
esputr_unit, *)
"ERROR in esputr1993_init: cannot open file " // trim(constantsfile)
135 read(unit,
'(A)', iostat=err) line
137 write(
esputr_unit, *)
"ERROR in esputr1993_init while reading the comment (first lines) in " &
138 // trim(constantsfile)
146 read(unit,
'(A)', iostat=err) line
147 if(err /= 0)
goto 1100
151 write(
esputr_unit, *)
"ERROR in esputr1993_init: "//trim(constantsfile)//
" contains no data"
157 if(err /= 0)
goto 1200
159 if(err /= 0)
goto 1200
161 if(err /= 0)
goto 1200
163 if(err /= 0)
goto 1200
164 backspace(unit, iostat=err)
165 if(err /= 0)
goto 1300
166 read(unit, *, iostat=err) linecols
167 if(err /= 0)
goto 1100
170 read(unit, *, iostat=err) linecols(:)
171 if(err /= 0)
goto 1100
177 read(unit, *, iostat=err) linecols(1:2)
178 if(err /= 0)
goto 1300
180 if(err /= 0)
goto 1300
183 read(unit, *, iostat=err) line
184 if(err /= 0)
goto 1300
187 read(unit, *, iostat=err) line
188 if(err /= 0)
goto 1300
191 read(unit, *, iostat=err) linecols
192 if(err /= 0)
goto 1300
194 if(err /= 0)
goto 1300
197 read(unit, *, iostat=err) linecols
198 if(err /= 0)
goto 1300
200 if(err /= 0)
goto 1300
203 read(unit, *, iostat=err) linecols
204 if(err /= 0)
goto 1300
206 if(err /= 0)
goto 1300
210 write(
esputr_unit, *)
"ERROR in esputr1993_init: fitvalues are not sensible: ",&
219 deallocate(linecols, stat=err)
221 write(
esputr_unit, *)
"WARNING from esputr1993_init: problem while deallocating memory"
226 if(res /=0 .or. err /=0)
then
228 write(
esputr_unit, *)
"ERROR in esputr1993_init: the data are incorrect"
232 write(
esputr_unit, *)
"esputr1993_init: initialization from file "//trim(constantsfile)//
" completed"
237 1100
write(
esputr_unit, *)
"ERROR in esputr1993_init while reading the table header in " &
238 // trim(constantsfile)
242 1200
write(
esputr_unit, *)
"ERROR in esputr1993_init: could not allocate memory for ",
ntargets,&
244 nconstants,
" parameters for each combination"
248 1300
write(
esputr_unit, *)
"ERROR in esputr1993_init while reading " // trim(constantsfile) &
249 //
" for target number ",i,
" (NAME = ",trim(
targets_names(i)),
")"
272 integer,
intent(out) :: res
274 integer,
intent(out) :: err
276 integer :: itarg,iproj, n1,n2,m1,m2
277 real(ESPUTR_DP) :: E_tf, E_th, Q
284 write(
esputr_unit, *)
"ERROR detected in esputr1993_check: some or all arrays are not allocated"
295 write(
esputr_unit, *)
"ERROR detected in esputr1993_check: inconsistent array size"
297 write(
esputr_unit, *)
" NTARGETS , size(FITVALUES,2), size(PROJECTILES_NAMES,1) ",
ntargets,n2,m2
309 write(
esputr_unit, *)
"ERROR detected in esputr1993_check: wrong E_tf"
312 else if(e_th <= 0)
then
314 write(
esputr_unit, *)
"ERROR detected in esputr1993_check: wrong E_th"
319 write(
esputr_unit, *)
"ERROR detected in esputr1993_check: wrong Q"
330 integer,
intent(out) :: err
331 integer,
dimension(3) :: errs
337 if(.not. all(errs==0))
then
338 write(
esputr_unit, *)
"WARNING from esputr1993_deallocate: problem while deallocating memory"
353 character(*),
intent(in) :: proj
357 integer,
intent(out) :: err
362 write(
esputr_unit, *)
"ERROR in esputr1993_getProjectileId: arrays are not initialized"
363 write(
esputr_unit, *)
" Call esputr1993_init first!"
372 write(
esputr_unit, *)
"ERROR in esputr1993_getProjectileId: projectile "//trim(proj)//
" not found"
383 character(*),
intent(in) :: targ
387 integer,
intent(out) :: err
392 write(
esputr_unit, *)
"ERROR in esputr1993_getTargetId: arrays are not initialized"
393 write(
esputr_unit, *)
" Call esputr1993_init first!"
402 write(
esputr_unit, *)
"ERROR in esputr1993_getTargetId: target "//trim(targ)//
" not found"
416 real(ESPUTR_DP) function esputr1993_yn(E0, proj_id, targ_id, err)
418 real(ESPUTR_DP),
intent(in) :: E0
420 integer,
intent(in) :: proj_id
422 integer,
intent(in) :: targ_id
424 integer,
intent(out) :: err
426 real(ESPUTR_DP) :: Q, E_th, E_tf, EthOverE0, s_n_KrC, eps
431 write(
esputr_unit,*)
"ERROR in esputr1993_yn: arrays are not initialized"
437 if(targ_id < 1 .or. targ_id >
ntargets .or.&
439 write(
esputr_unit, *)
"ERROR in esputr1993_yn: targ_id or proj_id out of bounds", targ_id, proj_id
451 ethovere0 = e_th / e0
452 s_n_krc = .5 * log(1 + 1.2288*eps) / (eps + .1728*sqrt(eps) + .008*eps**0.1504)
453 esputr1993_yn = q * s_n_krc * (1 - ethovere0**(2./3.)) * (1 - ethovere0)**2
471 real(ESPUTR_DP),
intent(in) :: theta
473 integer,
intent(out) :: err
475 real(ESPUTR_DP) :: cosTheta
476 real(ESPUTR_DP),
parameter :: f = 2., cos_th_opt= cos(75.*
esputr_pi/180.)
482 write(
esputr_unit, *)
"ERROR detected in esputr1993_yth: incorrect incident angle theta (radian) ", theta
483 write(
esputr_unit, *)
" Incident angle cannot be < 0 or > pi/2"
489 costheta = cos(theta)
491 if(costheta > 0)
then
492 esputr1993_yth = costheta**(-f) * exp(f * (1-1./costheta) * cos_th_opt)
506 integer,
intent(in) :: proj_id
508 integer,
intent(in) :: targ_id
510 integer,
intent(out) :: err
514 write(
esputr_unit, *)
"ERROR in esputr1993_Eth: arrays are not initialized"
519 if(targ_id < 1 .or. targ_id >
ntargets .or.&
521 write(
esputr_unit, *)
"ERROR in esputr1993_Eth: targ_id or proj_id out of bounds", targ_id, proj_id
533 character(ESPUTR1993_FIRST_COL_WIDTH),
dimension(:,:),
allocatable,
intent(inout) :: combinations
534 integer,
intent(out) :: err
541 write(
esputr_unit, *)
"ERROR in esputr1993_availableCombinations: arrays are not initialized"
542 write(
esputr_unit, *)
" Call esputr1993_init first!"
548 write(
esputr_unit, *)
"ERROR in esputr1993_availableCombinations: error while allocating memory", err
563 integer function linesuntil(filePath, string, err)
565 character(*),
intent(in) :: filePath
567 character(*),
intent(in) :: string
569 integer,
intent(out) :: err
570 character(len(string)) :: line
571 integer,
parameter :: UNIT = 50
576 open(unit, iostat=err, file=trim(filepath), status=
'old', action=
'read')
578 write(
esputr_unit, *),
"ERROR in linesUntil: while opening file", trim(filepath)
585 read(unit, *, iostat=err, end=9100) line
587 write(
esputr_unit, *),
"ERROR in linesUntil: while reading file", trim(filepath)
592 linesuntil = linesuntil + 1
593 if(len_trim(line)>0)
then
594 if(index(line,string)>0)
then
602 end function linesuntil
606 pure integer function getindexof(subj, list)
608 character(*),
intent(in) :: subj
610 character(*),
dimension(:),
intent(in) :: list
614 do i = 1,
size(list, 1)
615 if(list(i) == subj)
then
620 end function getindexof
real(esputr_dp) function, public esputr1993_yn(E0, proj_id, targ_id, err)
Calculate sputtering yield for normal incidence with 1993-model for a given incident energy and targe...
integer function, public numberoflines(fileName, ignoreComments, err)
Return number of lines in the file, without blank lines and comment lines (started with #) ...
integer function, public esputr1993_getprojectileid(proj, err)
Return ID of the projectile for the 1993-model.
subroutine, public esputr1993_deallocate(err)
Deallocate dynamic arrays used by the module ESPUTR1993.
integer, save, private nprojectiles
Number of loaded projectiles.
subroutine, public esputr1993_check(res, err)
Check integrity and validity of data in the module.
subroutine, public esputr1993_init(constantsFile, err)
Initialization of the 1993-model.
real(esputr_dp), dimension(:,:,:), allocatable, save, private fitvalues
Array with parameters of fitting formula for normal incidence for 1993-model.
real(esputr_dp), parameter, public esputr_pi
Pi number.
real(esputr_dp), parameter, public esputr_pi2
Pi divided by 2.
integer, save, private ntargets
Number of loaded targets.
integer function, public esputr1993_gettargetid(targ, err)
Return ID of the target for the 1993-model.
character(esputr1993_first_col_width), dimension(:), allocatable, save, private targets_names
Array of strings with the names of targets.
real(esputr_dp) function, public esputr1993_yth(theta, err)
Angular dependence of sputtering yield in 1993-model for given incident angle.
character(esputr1993_first_col_width), dimension(:), allocatable, save, private projectiles_names
Array of strings with the names of projectiles.
subroutine, public esputr1993_availablecombinations(combinations, err)
Return the list of available projectile-target combinations.
integer, parameter, private nconstants
Number of parameters read from the input file for one target/projectile combination.
integer, parameter, private lines_per_target
Number of lines for each target in in the input file (excluding blank lines)
integer, parameter, private col_width
Width of the columns in the input file.
logical function, public esputr1993_if_initialized()
Return .true. if module esputr1993 is initialized.
integer, save, private nheaderlines
Number of comment lines in the beginning of the input file All lines including the first line which s...
integer, save, public esputr_unit
Index of the unit for standard output, default value 6.
real(esputr_dp) function, public esputr1993_eth(proj_id, targ_id, err)
Return threshold energy for the given projectile-target combination.
integer, parameter, public esputr1993_first_col_width
Width of the first column in the input file.