%**************************************************************************
%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
%   pm_br               %Remnant field in the blocks (T)
%   pm_dim(3)           %Magnet block dimensions for each block in coordinate system tied to block [w_x, w_y, w_z] (m) 
%   pm_x_nom_pos(1 : num_blocks)  %Nominal x positions of the blocks (m)
%   pm_y_nom_pos(1 : num_blocks)  %Nominal y positions of the blocks (m)
%   pm_z_nom_pos(1 : num_blocks)  %Nominal z positions of the blocks (m)
%   pm_m_dir(1 : num_blocks)      %Magnetization direction of the blocks, Convention: +x = 1, -x = 2, +y = 3, -y = 4, +z = 5, -z = 6
%   pm_div_size         %Permanent magnet segmentation size along each axis for equivalent charges (m)
%   shim_x_shift(1 : num_blocks)  %Virtual shim x shift (m)
%   shim_y_shift(1 : num_blocks)  %Virtual shim y shift (m)
%   shim_z_shift(1 : num_blocks)  %Virtual shim z shift (m)
%   field_pos(n, 3)     %Positions where field is calculated, [x(n), y(n), z(n)] coordinates (m)
%   field_int_pos(n, 2) %Positions where field integrals are calculated, [x(n), y(n)] coordinates (m)
%
%Zachary Wolf, 2/4/11

function [] = virtual_shim_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, 'Remnant field in blocks = %f T\r\n', param.pm_br);
fprintf(fid, 'Width of blocks in x = %f m\r\n', param.pm_dim(1));
fprintf(fid, 'Width of blocks in y = %f m\r\n', param.pm_dim(2));
fprintf(fid, 'Width of blocks in z = %f m\r\n', param.pm_dim(3));
fprintf(fid, 'Nominal X positions of the blocks (m):\r\n');
fprintf(fid, '  %9.6f', param.pm_x_nom_pos);
fprintf(fid, '\r\n');
fprintf(fid, 'Nominal Y positions of the blocks (m):\r\n');
fprintf(fid, '  %9.6f', param.pm_y_nom_pos);
fprintf(fid, '\r\n');
fprintf(fid, 'Nominal Z positions of the blocks (m):\r\n');
fprintf(fid, '  %9.6f', param.pm_z_nom_pos);
fprintf(fid, '\r\n');
fprintf(fid, 'Magnetization direction of the blocks (+x = 1, -x = 2, +y = 3, -y = 4, +z = 5, -z = 6):\r\n');
fprintf(fid, '  %1i', param.pm_m_dir);
fprintf(fid, '\r\n');
fprintf(fid, 'Magnet division size for equivalent charges = %f m\r\n', param.pm_div_size);
fprintf(fid, 'Virtual shim X shifts (m):\r\n');
fprintf(fid, '  %9.6f', param.shim_x_shift);
fprintf(fid, '\r\n');
fprintf(fid, 'Virtual shim Y shifts (m):\r\n');
fprintf(fid, '  %9.6f', param.shim_y_shift);
fprintf(fid, '\r\n');
fprintf(fid, 'Virtual shim Z shifts (m):\r\n');
fprintf(fid, '  %9.6f', param.shim_z_shift);
fprintf(fid, '\r\n');
fclose(fid);

%Done
end
