%**************************************************************************
%This function writes the parameter information to the data file.
%
%Input:
%dat_file, data file for results
%param, structure containing program parameters
%   output_file_dir %Directory for output files
%   num_block_xdiv  %Number of divisions in x for charge calculation
%   num_block_ydiv  %Number of divisions in y for charge calculation
%   num_block_zdiv  %Number of divisions in z for charge calculation
%   und_gap         %Undulator gap height (m)
%   period          %Undulator period (m)
%   num_ctr_period  %Number of periods in the undulator, excluding the ends
%   br              %Permanent magnet remnant field (T)
%   block_x_width   %Magnet block width in x direction (m)
%   block_y_width   %Magnet block width in y direction (m)
%   block_z_width   %Magnet block width in z direction (m)
%   block_end_mag_1_z_width 	%Width of end magnet block (m)
%   block_end_space_2_z_width	%Width of space between 1 and 2 end blocks (m)
%   block_end_mag_2_z_width 	%Width of block second from the end (m)
%   block_end_space_3_z_width	%Width of space between 2 and 3 end blocks (m)
%   block_end_mag_3_z_width     %Width of block third from the end (m)
%
%Zachary Wolf, 1/13/06

function [] = ppm_und_sim_dat_param(dat_file, param)

%Write the parameter information to the data file
fid = fopen(dat_file, 'a');
fprintf(fid, '\r\n');
fprintf(fid, 'Simulation Parameters:\r\n');
fprintf(fid, 'Output file directory = %s\r\n', param.output_file_dir);
fprintf(fid, 'Number of block divisions in x = %i\r\n', param.num_block_xdiv);
fprintf(fid, 'Number of block divisions in y = %i\r\n', param.num_block_ydiv);
fprintf(fid, 'Number of block divisions in z = %i\r\n', param.num_block_zdiv);
fprintf(fid, 'Undulator gap = %f m\r\n', param.und_gap);
fprintf(fid, 'Undulator period = %f m\r\n', param.period);
fprintf(fid, 'Number of peroids in undulator center = %i\r\n', param.num_ctr_period);
fprintf(fid, 'Remnant field in blocks = %f T\r\n', param.br);
fprintf(fid, 'Width of blocks in x = %f m\r\n', param.block_x_width);
fprintf(fid, 'Width of blocks in y = %f m\r\n', param.block_y_width);
fprintf(fid, 'Width of blocks in z = %f m\r\n', param.block_z_width);
fprintf(fid, 'Space between blocks in z = %f m\r\n', param.block_z_space);
fprintf(fid, 'End magnet 1 z width = %f m\r\n', param.block_end_mag_1_z_width);
fprintf(fid, 'End space 1-2 z width = %f m\r\n', param.block_end_space_2_z_width);
fprintf(fid, 'End magnet 2 z width = %f m\r\n', param.block_end_mag_2_z_width);
fprintf(fid, 'End space 2-3 z width = %f m\r\n', param.block_end_space_3_z_width);
fprintf(fid, 'End magnet 3 z width = %f m\r\n', param.block_end_mag_3_z_width);
fclose(fid);

%Done
