75 real(ESPUTR_DP),
dimension(:,:),
allocatable,
save,
private ::
fitvalues_n
93 real(ESPUTR_DP),
dimension(:,:),
allocatable,
save,
private ::
fitvalues_th
129 character(*),
intent(in) :: fileNName
131 character(*),
intent(in) :: fileThName
133 integer,
intent(out) :: err
146 write(
esputr_unit, *)
"ERROR in esputr2001_init: created module is invalid"
153 character(*),
intent(in) :: fileNName
154 integer,
intent(out) :: err
157 write(
esputr_unit, *)
"ERROR in esputr2001_initN: esputr2001_initN has already been called; &
158 &call esputr2001_deallocate first."
171 character(*),
intent(in) :: fileTHName
172 integer,
intent(out) :: err
175 write(
esputr_unit, *)
"ERROR in esputr2001_initTH: esputr2001_initTH has already been called; &
176 &call esputr2001_deallocate first."
192 integer function numberofprojtargcombinations()
193 character(ESPUTR_MAX_LINE_LENGTH) :: currentCombination
194 character(ESPUTR_MAX_LINE_LENGTH) :: lastCombination
197 numberofprojtargcombinations = 0
200 if(currentcombination /= lastcombination)
then
201 numberofprojtargcombinations = numberofprojtargcombinations + 1
202 lastcombination = currentcombination
205 end function numberofprojtargcombinations
212 subroutine init2001_(fileName, fitvalues, nConstants, projTargNames, nCombinations, err)
214 character(*),
intent(in) :: fileName
222 real(ESPUTR_DP),
dimension(:,:),
allocatable,
intent(inout) :: fitvalues
226 integer,
intent(in) :: nConstants
234 character(ESPUTR2001_MAX_NAME_LENGTH),
dimension(:,:),
allocatable,
intent(inout) :: projTargNames
236 integer,
intent(out) :: nCombinations
237 integer,
intent(out) :: err
239 integer,
parameter :: UNIT = 3
241 integer :: i, j, err_
242 character(ESPUTR_MAX_LINE_LENGTH) :: line
251 write(
esputr_unit, *)
"ERROR in esputr2001_init: error while determining number of lines in "//trim(filename)
255 if (ncombinations<1)
then
256 write(
esputr_unit, *)
"ERROR in esputr2001_init: "//trim(filename)//
" contains no data"
262 write(
esputr_unit, *)
"ERROR in esputr2001_init: error while determining number of lines in "//trim(filename)
267 allocate(fitvalues(nconstants,ncombinations), stat=err_);
if(err_/=0)
goto 3200
268 allocate(projtargnames(ncombinations,2), stat=err_);
if(err_/=0)
goto 3200
270 open(unit, iostat=err, file=filename, status=
'old', action=
'read')
271 if (err /= 0 )
goto 3300
274 read(unit,
'(A)', iostat=err) line
275 if (err /= 0 )
goto 3350
277 read(line, *, iostat=err) projtargnames(j,:), fitvalues(1:nconstants,j)
278 if (err /= 0 )
goto 3350
285 write(
esputr_unit, *)
"esputr2001_init: initialization from file "//trim(filename)//
" completed"
288 3200
write(
esputr_unit, *)
"ERROR in esputr2001_init: could not allocate memory for data from file "//trim(filename)
289 write(
esputr_unit, *)
" Number of entries = ",ncombinations,&
290 " number of parameter for each entry = ",nconstants
293 3300
write(
esputr_unit, *)
"ERROR in esputr2001_init: cannot open "//trim(filename)
296 3350
write(
esputr_unit, *)
"ERROR in esputr2001_init while reading line", i,
"of "//trim(filename)
302 end subroutine init2001_
318 integer,
intent(out) :: res
320 integer,
intent(out) :: err
322 integer :: i,n,m,nn,mm
323 character(ESPUTR_MAX_LINE_LENGTH) :: currentCombination, lastCombination
324 real(ESPUTR_DP) :: lastEnergy,lambda,q,Eth,Etf,E0,Esp
333 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: some or all arrays are not allocated"
344 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: inconsistent array size"
345 write(
esputr_unit, *)
" NCOMBINATIONS_N, size(FITVALUES_N), size(PROJECTILES_TARGETS_NAMES_N) ",&
347 write(
esputr_unit, *)
" NCOMBINATIONS_N, size(FITVALUES_TH), size(PROJECTILES_TARGETS_NAMES_TH) ",&
359 if(lambda <= 0.)
then
360 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong lambda = ",lambda
365 else if(q <= 0. )
then
366 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong q = ", q
371 else if(eth <= 0.)
then
372 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong E_th = ", eth
377 else if(etf < 0.)
then
378 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong eps (E_tf) = ", etf
394 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong E0 = ", e0
399 else if(esp < 0.)
then
400 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: wrong E_sp = ", esp
405 else if( currentcombination == lastcombination .and. e0 <= lastenergy )
then
406 write(
esputr_unit, *)
"ERROR detected in esputr2001_check: ", &
407 "incident energy for angular dependence is not monotonically increasing "
414 lastcombination = currentcombination
427 integer,
intent(out) :: err
428 integer,
dimension(4) :: errs
435 if(.not. all(errs==0))
then
436 write(
esputr_unit, *)
"WARNING from esputr2001_deallocate: problem while deallocating memory"
451 character(*),
intent(in) :: proj
453 character(*),
intent(in) :: targ
457 integer,
intent(out) :: err
462 write(
esputr_unit, *)
"ERROR in esputr2001_getProjectileTargetIdN: arrays are not initialized"
463 write(
esputr_unit, *)
" Call esputr2001_init first!"
472 write(
esputr_unit, *)
"ERROR in esputr2001_getProjectileTargetIdN: projectile-target combination "&
473 //trim(proj)//
"-"//trim(targ)//
" is not found (normal incidence)"
483 character(*),
intent(in) :: proj
485 character(*),
intent(in) :: targ
487 integer,
intent(out) :: thLower
489 integer,
intent(out) :: thUpper
493 integer,
intent(out) :: err
498 write(
esputr_unit, *)
"ERROR in esputr2001_getProjectileTargetIdsTh: arrays are not initialized"
499 write(
esputr_unit, *)
" Call esputr2001_init first!"
508 if(thlower == 0 .or. thupper == 0)
then
509 write(
esputr_unit, *)
"ERROR in esputr2001_getProjectileTargetIdTh: projectile-target combination "&
510 //trim(proj)//
"-"//trim(targ)//
" is not found (angular dependence)"
524 real(ESPUTR_DP) function esputr2001_yn(E0, projectileTarget_id, err)
526 real(ESPUTR_DP),
intent(in) :: E0
528 integer,
intent(in) :: projectileTarget_id
530 integer,
intent(out) :: err
532 real(ESPUTR_DP) :: lambda, q, mu, E_th, E_tf, &
533 powerMuTerm, denumerator, numerator, eps
538 write(
esputr_unit, *)
"ERROR in esputr2001_yn: arrays are not initialized"
539 write(
esputr_unit, *)
" Call esputr2001_init first!"
544 if(projectiletarget_id < 1 .or. projectiletarget_id >
ncombinations_n )
then
545 write(
esputr_unit, *)
"ERROR in esputr2001_yn: projectileTarget_id is out of bounds", projectiletarget_id
559 powermuterm = (e0/e_th - 1)**mu
560 numerator = powermuterm * log(1 + 1.2288*eps)
561 denumerator = lambda + powermuterm * (eps + .1728*sqrt(eps) + .008*eps**.1504)
574 real(ESPUTR_DP) function esputr2001_yth(E0, theta, projTargStartId, projTargEndId, err)
576 real(ESPUTR_DP),
intent(in) :: E0
580 real(ESPUTR_DP),
intent(in) :: theta
582 integer,
intent(in) :: projTargStartId
584 integer,
intent(in) :: projTargEndId
593 integer,
intent(out) :: err
594 real(ESPUTR_DP) :: E_sp, f, c, b, cosTerm, theta0, S, dE, E00
600 write(
esputr_unit, *)
"ERROR in esputr2001_yth: arrays are not initialized"
607 if(projtargstartid < 1)
then
608 write(
esputr_unit, *)
"ERROR in esputr2001_yth: projTargStartId is out of bounds ",projtargstartid
615 write(
esputr_unit, *)
"ERROR in esputr2001_yth: projTargEndId is out of bounds ",projtargendid
621 if(projtargstartid > projtargendid )
then
623 &projTargStartId and projTargEndId are inconsistent ",&
624 projtargstartid,projtargendid
631 write(
esputr_unit, *)
"ERROR in esputr2001_yth_: incident energy cannot be < 0"
638 write(
esputr_unit, *)
"ERROR in esputr2001_yth: incorrect incident angle theta (radian) ", theta
639 write(
esputr_unit, *)
" Incident angle cannot be < 0 or > pi/2"
646 i1=findindex(projtargstartid, projtargendid, e0,
fitvalues_th(1,:), err)
654 if(err == 21)
goto 4102
656 if(err /= 0)
goto 4100
670 theta0 =
esputr_pi - acos(sqrt(e_sp/(e00+e_sp)))
682 4100
write(
esputr_unit, *)
"ERROR in esputr2001_yth: failed to find fitting parameters for this energy"
688 4102
write(
esputr_unit, *)
"ERROR in esputr2001_yth: no data available for this energy"
703 integer,
intent(in) :: projectileTarget_id
705 integer,
intent(out) :: err
708 write(
esputr_unit, *)
"ERROR in esputr2001_Eth: arrays are not initialized"
709 write(
esputr_unit, *)
" Call esputr2001_init first!"
719 character(ESPUTR2001_MAX_NAME_LENGTH),
dimension(:,:),
allocatable,
intent(inout) :: combinations
721 integer,
intent(out) :: err
725 write(
esputr_unit, *)
"ERROR in esputr2001_availableCombinationsN: arrays are not initialized"
726 write(
esputr_unit, *)
" Call esputr2001_init first!"
731 write(
esputr_unit, *)
"ERROR in esputr2001_availableCombinationsN: error while allocating memory", err
741 character(ESPUTR2001_MAX_NAME_LENGTH*2),
dimension(:,:),
allocatable,
intent(inout) :: combinations
743 integer,
intent(out) :: err
744 character(ESPUTR_MAX_LINE_LENGTH) :: currentCombination, lastCombination
745 integer :: i, numberOfCombination
749 write(
esputr_unit, *)
"ERROR in esputr2001_availableCombinationsTH: arrays are not initialized"
750 write(
esputr_unit, *)
" Call esputr2001_init first!"
757 write(
esputr_unit, *)
"ERROR in esputr2001_availableCombinationsTH: error while allocating memory", err
762 numberofcombination = 0
766 if(currentcombination /= lastcombination)
then
767 numberofcombination = numberofcombination + 1
769 lastcombination = currentcombination
777 integer,
intent(in) :: projTargStartId
779 integer,
intent(in) :: projTargEndId
781 real(kind=ESPUTR_DP),
intent(out) :: Emin
783 real(kind=ESPUTR_DP),
intent(out) :: Emax
785 integer,
intent(out) :: err
789 write(
esputr_unit, *)
"ERROR in esputr2001_getAvailableEnergyRange: arrays are not initialized"
790 write(
esputr_unit, *)
" Call esputr2001_init first!"
794 0 >= projtargstartid .or. &
795 projtargstartid > projtargendid)
then
796 write(
esputr_unit, *)
"ERROR in esputr2001_getAvailableEnergyRange: lower/upper bound is invalid",&
797 projtargstartid, projtargstartid
807 integer function getindexof2(subj1, subj2, list, lastIndex)
809 character(*),
intent(in) :: subj1, subj2
811 character(*),
dimension(:,:),
intent(in) :: list
814 integer,
optional,
intent(inout) :: lastIndex
816 intrinsic size,
present
818 if(
present(lastindex)) lastindex = 0
820 foreachitem:
do i = 1, n
821 match:
if(list(i,1) == subj1 .and. list(i,2) == subj2)
then
823 mustfindlast:
if(
present(lastindex))
then
825 findlast:
do j = i+1, n
826 if(list(j,1) == subj1 .and. list(j,2) == subj2)
then
836 end function getindexof2
842 integer function findindex(loBound, upBound, x, arr, err)
844 integer,
intent(in) :: loBound
846 integer,
intent(in) :: upBound
848 real(ESPUTR_DP),
intent(in) :: x
850 real(ESPUTR_DP),
dimension(:),
intent(in) :: arr
861 if(arr(lobound) > x)
then
866 if(arr(upbound) < x)
then
876 else if(i1 == i2)
then
877 if(i1 == upbound)
then
881 else if(arr(i) < x)
then
888 end function findindex
integer, parameter, public esputr2001_max_name_length
Maximum length of the names of (chemical) elements.
integer function, public numberoflines(fileName, ignoreComments, err)
Return number of lines in the file, without blank lines and comment lines (started with #) ...
subroutine, public esputr2001_getavailableenergyrange(projTargStartId, projTargEndId, Emin, Emax, err)
Get the minimum and maximum energies for which the angular dependency factor is defined.
subroutine, public esputr2001_initn(fileNName, err)
integer, parameter, private nconstants_n
Number of parameters read from the input file for 2001-model for normal incidence (for one target/pro...
real(esputr_dp), parameter, public esputr_pi
Pi number.
subroutine, public esputr2001_deallocate(err)
Deallocate dynamic arrays used by this module.
subroutine, public esputr2001_check(res, err)
Check integrity and validity of data in the module.
logical function, public esputr2001_if_initialized()
Return .true. if module esputr2001 is initialized.
real(esputr_dp), parameter, public esputr_pi2
Pi divided by 2.
real(esputr_dp) function, public esputr2001_yth(E0, theta, projTargStartId, projTargEndId, err)
Angular dependence of sputtering yield in 2001-model for given incident angle and energy...
integer function, public esputr2001_getprojectiletargetidn(proj, targ, err)
Return ID for a projectile-target combination for 2001-model for normal incidence.
subroutine, public esputr2001_availablecombinationsth(combinations, err)
Return the list of available projectile-target combinations for angular dependence.
integer, save, private nprojectilestargetsth
Number of projectile-target combinations loaded for angular dependence.
integer, parameter, private nconstants_th
Number of parameters read from the input file for 2001-model for angular dependence (for one target/p...
real(esputr_dp) function, public esputr2001_eth(projectileTarget_id, err)
Return the threshold energy E_th for the given projectile-target combination.
logical, save, public esputr2001_extrapolate_angular
Switch for extrapolation of the angular dependency to energies for which no data are defined...
character(*), parameter, public esputr_comment_start
chracter which is used to start comments in the data files
real(esputr_dp), dimension(:,:), allocatable, save, private fitvalues_th
Array with parameters read for angular dependence for 2001-model.
real(esputr_dp), dimension(:,:), allocatable, save, private fitvalues_n
Array with parameters of fitting formula for normal incidence for 2001-model.
real(esputr_dp) function, public esputr2001_yn(E0, projectileTarget_id, err)
Calculate sputtering yield for normal incidence with 2001-model for given incident energy and target-...
integer, save, private ncombinations_th
Number of entries loaded for 2001-model for angular dependence.
subroutine, public esputr2001_initth(fileTHName, err)
subroutine, public esputr2001_getprojectiletargetidsth(proj, targ, thLower, thUpper, err)
Return two IDs for a projectile-target combination for 2001-model for angular dependence.
subroutine, public esputr2001_init(fileNName, fileThName, err)
Initialization of the 2001-model.
character(esputr2001_max_name_length), dimension(:,:), allocatable, save, private projectiles_targets_names_th
Array of strings which contains the names of the target-projectile combinations defined for 2001-mode...
subroutine, public esputr2001_availablecombinationsn(combinations, err)
Return the list of available projectile-target combinations for normal incidence. ...
character(esputr2001_max_name_length), dimension(:,:), allocatable, save, private projectiles_targets_names_n
Array of strings which contains the names of the target-projectile combinations defined for 2001-mode...
integer, save, public esputr_unit
Index of the unit for standard output, default value 6.
integer, save, private ncombinations_n
Number of entries loaded for 2001-model for normal incidence.