% data must be loaded via SRread_script

close all

shapes = {'generic_potash_alum_3',...
          'generic_potash_alum_15',...
          'generic_paracetamol_1',...
          'generic_paracetamol_23',...
          'generic_MgSO4_11H2O_1',...
          'generic_MgSO4_11H2O_27'};
names = {'potash_3', ...
         'potash_15', ...
         'paracetamol_1',...
         'paracetamol_23',...
         'MgSO4_1',...
         'MgSO4_27'};
labels = {'I', 'II', 'III'};
rand('seed', 0);

for i = 1:length(shapes)
    close all
    figure
    cmap = bone(4+size(data.(shapes{i}).cdef.G, 2));
    cmap = cmap(2+(1:size(data.(shapes{i}).cdef.G, 2)), :);
    viewCrystal(data.(shapes{i}).cdef, ...
                      data.(shapes{i}).cdef.G*...
                      (1+0*rand([size(data.(shapes{i}).cdef.G, 2) 1])),...
                      'colormap', cmap,...
                      'annotation', 'none');
    box off,axis off                  
    set(gcf, 'PaperUnits', 'centimeters', ...
             'PaperSize', [5, 4], ...
             'PaperPosition', [0 0 5 4]);
    ah = get(gcf, 'children');
    % crystal
    set(ah(2), 'position', [-0.15 -0.05    0.9  1.1]);
    % legend
    set(ah(1), 'position', [0.65  0.1    0.05  0.8], ...
               'FontSize', 11);
    print('-depsc', [names{i} '.eps'])
end 