24 #include <octave/oct.h>
27 #include "esputr_octave.hpp"
50 Calculate the angular dependency factor of the sputtering yield Y(E,tehta)/Y(E,0) (interface to ESPUTR) \n\
52 [Y1 Y2 ...] = esputr_YN(TH, E0, proj, targ, version, fileTH) \n\
54 Y1, Y2 ... : matrices with calculated angular factors - \n\
55 - one matrix for each projectile-target combination, \n\
56 rows: over angle THs, columns: over eneregy E0s \n\
57 TH : column vector of the incident agles, radian \n\
58 Incident angle is the angle between surface normal \n\
59 and velocity of the incident particle \n\
60 E0 : row vector of the projectile energies, eV \n\
61 proj : column vector of the projectile names \n\
62 targ : column vector of the target names \n\
63 version : designation of the model ('1993' or '2001') \n\
64 fileN : name of the file (full path) with fitting parameters \n\
66 If the lengths of proj and targ differ, the last element of the shorter vector is repeated \n\
71 f = esputr_YTH([0:5:90]*pi/180, 100, 'E', 'l', '1993')\n\
73 D on Be, 2007 model (2001 with coefficients from [Eckstein 2007]) \n\
74 f = esputr_YTH([0:5:90]*pi/180, [500,700,1000], 'D', 'Be', '2001','../data/ECKSTEIN2007TH')\n\
76 D on W, D on Mo, He on W, 2007 model\n\
77 [D_W,D_Mo,He_W] = esputr_YTH([0:1:90]*pi/180, [500,1000], strvcat('D','D','He'),strvcat('W','Mo','W'), '2001', ... \n\
78 '/home/v.kotov/JuNiPlib/esputr/data/ECKSTEIN2007TH')") {
79 octave_value_list retval;
80 int nargin = args.length();
83 error(
"at least 5 input arguments required");
86 NDArray THs = args(0).array_value();
87 NDArray E0s = args(1).array_value();
89 double* THs_v = THs.fortran_vec();
90 octave_idx_type n_THs = THs.numel();
92 double* E0s_v = E0s.fortran_vec();
93 octave_idx_type n_E0s = E0s.numel();
95 charMatrix projs = args(2).char_matrix_value();
96 octave_idx_type n_projs = projs.rows();
97 charMatrix targs = args(3).char_matrix_value();
98 octave_idx_type n_targs = targs.rows();
100 octave_idx_type
n_combinations = std::max(n_E0s, std::max(n_projs, n_targs));
102 std::string version_str = args(4).char_matrix_value().row_as_string(0);
103 const char* version = version_str.c_str();
104 octave_idx_type version_length = version_str.length();
108 std::string fileTH =
"";
110 if(version_str !=
"2001" && version_str !=
"1993") {
111 error(
"unknown model");
116 if(version_str ==
"2001" && nargin == 6) {
117 fileTH = args(5).char_matrix_value().row_as_string(0);
118 }
else if(version_str ==
"2001" && nargin < 6) {
119 error(
"6 arguments required");
125 error(
"sth went wrong");
129 if(version_str ==
"2001") {
132 error(
"error in esputr_matlab_init");
139 std::string proj = projs.row_as_string(std::min(c, n_projs-1));
140 std::string targ = targs.row_as_string(std::min(c, n_targs-1));
141 Matrix YNs (n_THs, n_E0s);
150 F77_CHAR_ARG_LEN(proj.length())
151 F77_CHAR_ARG_LEN(targ.length())
152 F77_CHAR_ARG_LEN(version_length)
155 error(
"error in esputr_matlab_yth");
subroutine esputr_deallocate(err)
call esputr2001_deallocate and esputr1993_deallocate
subroutine esputr2001_initth_wrapper(fileTH, err)
module-less wrapper for esputr2001_initTH
integer, parameter n_combinations
Number of tested projectile-target combinations.
subroutine esputr_yth(THs, n_THs, E0s, n_E0s, proj, targ, version, YTHs, err)
Calculate the angular dependence factor Y(E,theta)/Y(E,0) for selected incident angles and energies f...
DEFUN_DLD(esputr_YTH, args, nargout," \n\
Calculate the angular dependency factor of the sputtering yield Y(E,tehta)/Y(E,0) (interface to ESPUTR) \n\
\n\
[Y1 Y2 ...] = esputr_YN(TH, E0, proj, targ, version, fileTH) \n\
\n\
Y1, Y2 ... : matrices with calculated angular factors - \n\
- one matrix for each projectile-target combination, \n\
rows: over angle THs, columns: over eneregy E0s \n\
TH : column vector of the incident agles, radian \n\
Incident angle is the angle between surface normal \n\
and velocity of the incident particle \n\
E0 : row vector of the projectile energies, eV \n\
proj : column vector of the projectile names \n\
targ : column vector of the target names \n\
version : designation of the model ('1993' or '2001') \n\
fileN : name of the file (full path) with fitting parameters \n\
\n\
If the lengths of proj and targ differ, the last element of the shorter vector is repeated \n\
\n\
Examples:\n\
\n\
1993-model\n\
f = esputr_YTH([0:5:90]*pi/180, 100, 'E', 'l', '1993')\n\
\n\
D on Be, 2007 model (2001 with coefficients from [Eckstein 2007]) \n\
f = esputr_YTH([0:5:90]*pi/180, [500,700,1000], 'D', 'Be', '2001','../data/ECKSTEIN2007TH')\n\
\n\
D on W, D on Mo, He on W, 2007 model\n\
[D_W,D_Mo,He_W] = esputr_YTH([0:1:90]*pi/180, [500,1000], strvcat('D','D','He'),strvcat('W','Mo','W'), '2001', ... \n\
'/home/v.kotov/JuNiPlib/esputr/data/ECKSTEIN2007TH')")