%This script writes a definition file for SCAPS. It includes all
%parameters, that describe the solar cell itself. Any further parameters
%that need modification can be inserted behind the string of the row and
%replaced by %d, %d, etc. in the string

global defpara drtdef


fip=fopen(drtdef, 'w');         %open file for writing. Previous content is deleted.


fprintf(fip, 'convergence\n\n');
fprintf(fip, 'recalculate mesh :  1 (0: fixed mesh, 1: adaptive mesh)\n');
fprintf(fip, 'maximum mesh changes per iteration step : 10\n');
fprintf(fip, 'maximum ratio between neighbouring points :  1.60e+00\n');
fprintf(fip, 'minimum ratio between neighbouring points :  1.05e+00\n');
fprintf(fip, 'generation limit :  1.00e+00 microA/cm2\n');
fprintf(fip, 'recombination limit :  1.00e-03 microA/cm2\n');
fprintf(fip, 'Mott-Schottky analysis epsilon of sheet side :  0	(left side = -1; right side = +1)\n');
fprintf(fip, 'Mott-Schottky analysis number of points :  3	(3 or 5 as of december 2008)\n');
fprintf(fip, 'Mott-Schottky analysis polynomial order middle :  2	(1 or 2 as of december 2008)\n');
fprintf(fip, 'Mott-Schottky analysis polynomial order edges:  1	(1 or 2 as of december 2008)\n');
fprintf(fip, 'Mott-Schottky analysis epsilon of layer number :  -1\n');
fprintf(fip, 'Mott-Schottky analysis defect number :  0\n');
fprintf(fip, 'Mott-Schottky analysis level number :  0\n');
fprintf(fip, 'Mott-Schottky analysis eh type :  1\n');
fprintf(fip, 'Mott-Schottky analysis constant epsilon :   30.00000000\n');
fprintf(fip, 'Mott-Schottky analysis epsilon(x) mode for NW :  0\n');
fprintf(fip, 'Mott-Schottky analysis smooth epsilon for NW :  0\n\n\n');

%% definitions for back contact (ITO)
fprintf(fip, 'back contact\n\n');

fprintf(fip, 'flatband : 0 (1: flatband contact imposed; 0: fixed Phi_m value)\n');
fprintf(fip, 'recalculate : 0 (1 = do or 0 = do not recalculate phi_m to set flatband in each batch step)\n');
fprintf(fip, 'Fi_m :   %d [eV]\n', defpara.WFback);
fprintf(fip, 'Sn :  %d [m/s]\n', defpara.Sn_back);
fprintf(fip, 'Sp :  %d [m/s]\n', defpara.Sp_back);
fprintf(fip, 'Tunneling to contact: 0 (0: no tunneling, 1: with tunneling)\n');
fprintf(fip, 'Relative electron mass :  1.00e+00\n');
fprintf(fip, 'Relative hole mass :  1.00e+00\n\n\n');

%% PTAA
% fprintf(fip, 'layer\n\n');
% 
% fprintf(fip, 'name : PTAA\n');
% fprintf(fip, 'd : %d [m]\n', defpara.HTL_d);
% fprintf(fip, 'composition grading :	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	 0	 1	[-]\n');
% fprintf(fip, 'v_th_n :	 1.000e+05	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 1.000e+05	 1.000e+05	 1	 0	[m/s]\n');
% fprintf(fip, 'v_th_p :	 1.000e+05	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 1.000e+05	 1.000e+05	 1	 0	[m/s]\n');
% fprintf(fip, 'eps :	     %d	    10.000000	    10.000000	    10.000000	    10.000000	     %d	     %d	 1	 0	[-]\n', defpara.HTL_eps, defpara.HTL_eps, defpara.HTL_eps );
% fprintf(fip, 'chi :	  %d	  4.500000	  1.000000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n', defpara.HTL_chi,defpara.HTL_chi, defpara.HTL_chi);
% fprintf(fip, 'Eg :	  %d	  1.200000	  0.500000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n',defpara.HTL_Eg,defpara.HTL_Eg,defpara.HTL_Eg);
% fprintf(fip, 'Nc :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.HTL_Nc, defpara.HTL_Nc,defpara.HTL_Nc);
% fprintf(fip, 'Nv :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.HTL_Nv, defpara.HTL_Nv,defpara.HTL_Nv);
% fprintf(fip, 'mu_n :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.HTL_mu_n, defpara.HTL_mu_n, defpara.HTL_mu_n);
% fprintf(fip, 'mu_p :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.HTL_mu_p, defpara.HTL_mu_p, defpara.HTL_mu_p);
% fprintf(fip, 'Tunneling in layer: 0 (0: no tunneling, 1: with tunneling)\n');
% fprintf(fip, 'Relative electron mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1	 0	[-]\n');
% fprintf(fip, 'Relative hole mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 0	 0	[-]\n');
% fprintf(fip, 'K_rad :	 %d	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[m^3/s]\n', defpara.HTL_kdir, defpara.HTL_kdir, defpara.HTL_kdir);
% fprintf(fip, 'c_n_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
% fprintf(fip, 'c_p_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
% fprintf(fip, 'Na(uniform) :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 0	 2	[/m^3]\n');
% fprintf(fip, 'Nd(uniform) :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 0	 2	[/m^3]\n');
% 
% %% define absorption model
% 
% fprintf(fip, 'absorption grading :	  387.49	 1033.31	  250.00	  250.00	    0.00	    1.20	    1.20	 7	 0	[nm]\n');
% fprintf(fip, 'absorptionmodel pure A material (y=0) : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'A : 9.000e+06 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'absorptionmodel pure A material (y=0) : from model\n');
% fprintf(fip, 'absorption model A, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
% fprintf(fip, 'absorption model A, value of parameter 1 :   1.609969e+05\n');
% fprintf(fip, 'absorption model A, value of parameter 2 :   0.000000e+00\n');
% fprintf(fip, 'absorption pure B material (y=1), model : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'pure B material (y=1), A : 1.000e+07 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'pure B material (y=1), B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'absorption pure B material (y=1), model : from model\n');
% fprintf(fip, 'absorption model B, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
% fprintf(fip, 'absorption model B, value of parameter 1 :   1.095445e+05\n');
% fprintf(fip, 'absorption model B, value of parameter 2 :   0.000000e+00\n\n');
%% define interface properties
% fprintf(fip, 'interface properties\n\n');
% 
% fprintf(fip, 'interfacename : PTAA / Perovskite\n');
% fprintf(fip, 'Intraband tunneling : 0 (0: no tunneling, 1: with tunneling)\n');
% fprintf(fip, 'Relative electron mass :  1.00e+00\n');
% fprintf(fip, 'Relative hole mass :  1.00e+00\n\n');

%% define parameters for interface recombination

% fprintf(fip, 'interface recombination\n\n');
% 
% fprintf(fip, 'type : neutral\n');
% fprintf(fip, 'sigma_nleft : 2.000e-22	[m^2]\n');
% fprintf(fip, 'sigma_nright : 2.000e-22	[m^2]\n');
% fprintf(fip, 'sigma_pleft : 2.000e-22	[m^2]\n');
% fprintf(fip, 'sigma_pright : 2.000e-22	[m^2]\n');
% fprintf(fip, 'Tunneling to trap: 0 (0: no tunneling, 1: with tunneling)\n');
% fprintf(fip, 'Relative electron mass :  1.00e+00\n');
% fprintf(fip, 'Relative hole mass :  1.00e+00\n');
% fprintf(fip, 'energy distribution : single\n');
% fprintf(fip, 'Reference for defect energy :  3 ; 3 = above highest EV; 4 = below lowest EC; 5 = above Ei left; 6 = above Ei right; 7 = above EV left (= SCAPS%%<2.7 reference); 8 = above EV right; 9 = above middle of interface gap\n');
% fprintf(fip, 'Et :  0.60 [eV]\n');
% fprintf(fip, 'Ekar :  0.10 [eV]\n');
% fprintf(fip, '0 [/m^2]\n\n\n');

%% Perovskite
fprintf(fip, 'layer\n\n');

fprintf(fip, 'name : Bismuth Vanadate\n');
fprintf(fip, 'd : %d [m]\n', defpara.PVK_d);
fprintf(fip, 'composition grading :	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	 0	 1	[-]\n');
fprintf(fip, 'v_th_n :	 %d	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 %d	 %d	 1	 0	[m/s]\n', defpara.PVK_vth_n,defpara.PVK_vth_n,defpara.PVK_vth_n);
fprintf(fip, 'v_th_p :	 %d	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 %d	 %d	 1	 0	[m/s]\n', defpara.PVK_vth_p,defpara.PVK_vth_p,defpara.PVK_vth_p);
fprintf(fip, 'eps :	     %d	    10.000000	    10.000000	    10.000000	    10.000000	     %d	     %d	 1	 0	[-]\n', defpara.PVK_eps, defpara.PVK_eps, defpara.PVK_eps );
fprintf(fip, 'chi :	  %d	  4.500000	  1.000000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n', defpara.PVK_chi, defpara.PVK_chi, defpara.PVK_chi);
fprintf(fip, 'Eg :	  %d	  1.200000	  0.500000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n',defpara.PVK_Eg,defpara.PVK_Eg,defpara.PVK_Eg);
fprintf(fip, 'Nc :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.PVK_Nc, defpara.PVK_Nc,defpara.PVK_Nc);
fprintf(fip, 'Nv :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.PVK_Nv, defpara.PVK_Nv,defpara.PVK_Nv);
fprintf(fip, 'mu_n :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.PVK_mu_n, defpara.PVK_mu_n, defpara.PVK_mu_n);
fprintf(fip, 'mu_p :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.PVK_mu_p, defpara.PVK_mu_p, defpara.PVK_mu_p);
fprintf(fip, 'Tunneling in layer: 0 (0: no tunneling, 1: with tunneling)\n');
fprintf(fip, 'Relative electron mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1	 0	[-]\n');
fprintf(fip, 'Relative hole mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1	 0	[-]\n');
fprintf(fip, 'K_rad :	 %d	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[m^3/s]\n', defpara.PVK_kdir, defpara.PVK_kdir, defpara.PVK_kdir);
fprintf(fip, 'c_n_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
fprintf(fip, 'c_p_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
fprintf(fip, 'Na(uniform) :	 %d	 %d	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 0	 2	[/m^3]\n',defpara.PVK_Na,defpara.PVK_Na,defpara.PVK_Na,defpara.PVK_Na);
fprintf(fip, 'Nd(uniform) :	 %d	 %d	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 0	 2	[/m^3]\n',defpara.PVK_Nd,defpara.PVK_Nd,defpara.PVK_Nd,defpara.PVK_Nd);

%% define absorption model

fprintf(fip, 'absorption grading :	  774.99	 1033.31	  250.00	  250.00	    0.00	    1.20	    1.20	 7	 0	[nm]\n');
fprintf(fip, 'absorptionmodel pure A material (y=0) : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'A : 9.000e+06 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'absorptionmodel pure A material (y=0) : from model\n');
fprintf(fip, 'absorption model A, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
fprintf(fip, 'absorption model A, value of parameter 1 :   1.138420e+05\n');
fprintf(fip, 'absorption model A, value of parameter 2 :   0.000000e+00\n');
fprintf(fip, 'absorption pure B material (y=1), model : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'pure B material (y=1), A : 1.000e+07 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'pure B material (y=1), B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
fprintf(fip, 'absorption pure B material (y=1), model : from model\n');
fprintf(fip, 'absorption model B, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
fprintf(fip, 'absorption model B, value of parameter 1 :   1.095445e+05\n');
fprintf(fip, 'absorption model B, value of parameter 2 :   0.000000e+00\n\n');
%% define interface properties
% fprintf(fip, 'interface properties\n\n');
% 
% fprintf(fip, 'interfacename :\n');
% fprintf(fip, 'Intraband tunneling : 0 (0: no tunneling, 1: with tunneling)\n');
% fprintf(fip, 'Relative electron mass :  1.00e+00\n');
% fprintf(fip, 'Relative hole mass :  1.00e+00\n\n\n');

%% PCBM
% fprintf(fip, 'layer\n\n');
% 
% fprintf(fip, 'name : PCBM\n');
% fprintf(fip, 'd : %d [m]\n', defpara.PCBM_d);
% fprintf(fip, 'composition grading :	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	  0.00000	 0	 1	[-]\n');
% fprintf(fip, 'v_th_n :	 1.000e+05	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 1.000e+05	 1.000e+05	 1	 0	[m/s]\n');
% fprintf(fip, 'v_th_p :	 1.000e+05	 1.000e+05	 1.000e+01	 1.000e+01	 1.000e+01	 1.000e+05	 1.000e+05	 1	 0	[m/s]\n');
% fprintf(fip, 'eps :	     %d	    10.000000	    10.000000	    10.000000	    10.000000	     %d	     %d	 1	 0	[-]\n', defpara.PCBM_eps, defpara.PCBM_eps, defpara.PCBM_eps );
% fprintf(fip, 'chi :	  %d	  4.500000	  1.000000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n', defpara.PCBM_chi, defpara.PCBM_chi, defpara.PCBM_chi);
% fprintf(fip, 'Eg :	  %d	  1.200000	  0.500000	  1.000000	  1.000000	  %d	  %d	 1	 0	[eV]\n',defpara.PCBM_Eg,defpara.PCBM_Eg,defpara.PCBM_Eg);
% fprintf(fip, 'Nc :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.PCBM_Nc, defpara.PCBM_Nc,defpara.PCBM_Nc);
% fprintf(fip, 'Nv :	 %d	 1.000000e+25	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[/m^3]\n', defpara.PCBM_Nv, defpara.PCBM_Nv,defpara.PCBM_Nv);
% fprintf(fip, 'mu_n :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.PCBM_mu_n, defpara.PCBM_mu_n, defpara.PCBM_mu_n);
% fprintf(fip, 'mu_p :	 %d	 5.000000e-03	 1.000000e-03	 1.000000e+00	 1.000000e+00	 %d	 %d	 1	 0	[m^2/Vs]\n', defpara.PCBM_mu_p, defpara.PCBM_mu_p, defpara.PCBM_mu_p);
% fprintf(fip, 'Tunneling in layer: 0 (0: no tunneling, 1: with tunneling)\n');
% fprintf(fip, 'Relative electron mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1	 0	[-]\n');
% fprintf(fip, 'Relative hole mass :	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1.000000e+00	 1	 0	[-]\n');
% fprintf(fip, 'K_rad :	 %d	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 %d	 %d	 1	 0	[m^3/s]\n', defpara.PCBM_kdir, defpara.PCBM_kdir, defpara.PCBM_kdir);
% fprintf(fip, 'c_n_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
% fprintf(fip, 'c_p_auger :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 1	 0	[m^6/s]\n');
% fprintf(fip, 'Na(uniform) :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 0	 2	[/m^3]\n');
% fprintf(fip, 'Nd(uniform) :	 0.000000e+00	 0.000000e+00	 1.000000e+01	 1.000000e+01	 1.000000e+01	 0.000000e+00	 0.000000e+00	 0	 2	[/m^3]\n');
% %% define absorption model
% 
% fprintf(fip, 'absorption grading :	  619.99	 1033.31	  250.00	  250.00	    0.00	    1.20	    1.20	 7	 0	[nm]\n');
% fprintf(fip, 'absorptionmodel pure A material (y=0) : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'A : 0.000e+00 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'absorptionmodel pure A material (y=0) : from model\n');
% fprintf(fip, 'absorption model A, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
% fprintf(fip, 'absorption model A, value of parameter 1 :   0.000000e+00\n');
% fprintf(fip, 'absorption model A, value of parameter 2 :   0.000000e+00\n');
% fprintf(fip, 'absorption pure B material (y=1), model : coefficients A and B (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'pure B material (y=1), A : 1.000e+07 [/(m*sqrt(eV))] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'pure B material (y=1), B : 0.000e+00 [sqrt(eV)/m] (line inserted for compatibility with SCAPS until 3.3.06)\n');
% fprintf(fip, 'absorption pure B material (y=1), model : from model\n');
% fprintf(fip, 'absorption model B, model : sqrt(hv-Eg) law (SCAPS traditional)\n');
% fprintf(fip, 'absorption model B, value of parameter 1 :   1.095445e+05\n');
% fprintf(fip, 'absorption model B, value of parameter 2 :   0.000000e+00\n\n\n');
%% definitions for front contact (Ag)
fprintf(fip, 'front contact\n\n');

fprintf(fip, 'flatband : 0 (1: flatband contact imposed; 0: fixed Phi_m value)\n');
fprintf(fip, 'recalculate : 0 (1 = do or 0 = do not recalculate phi_m to set flatband in each batch step)\n');
fprintf(fip, 'Fi_m :  %d [eV]\n', defpara.WFfront);
fprintf(fip, 'Sn : %d [m/s]\n', defpara.Sn_front);
fprintf(fip, 'Sp : %d [m/s]\n', defpara.Sp_front);
fprintf(fip, 'Tunneling to contact: 0 (0: no tunneling, 1: with tunneling)\n');
fprintf(fip, 'Relative electron mass :  1.00e+00\n');
fprintf(fip, 'Relative hole mass :  1.00e+00\n\n\n');


fprintf(fip, 'working point\n\n');

fprintf(fip, 'illuminated from : left\n');
fprintf(fip, 'internal Rfront :   0.00000000\n');
fprintf(fip, 'internal Tfront :  1.0000e+00\n');
% fprintf(fip, 'Series resistance :  1 (1: Rs enabled; 0: Rs disabled)\n');
% fprintf(fip, 'Rs [Ohm.m2] :   1.000000e-04\n');
fprintf(fip, 'voltage V applied to : -1 (+1: right contact; -1: left contact)\n');
fprintf(fip, 'cell reference system :  1 (1: as a consumer (consumed power = +VJ; 0: as a generator (generated power = +VJ) )');

fclose(fip);

clear fip