function malujener(dfile,nn,melt,gas,x0,x1,y0,y1);
% Matlab function for drawing zoom of the grid
  
  ncfile = netcdf(dfile,'nowrite');
%  rho = ncfile{'rho'};
%  ux = ncfile{'ux'};
%  uy = ncfile{'uy'};
%  pres = ncfile{'press'};
  ener = ncfile{'ener'};
%  mass = ncfile{'mass'};
%  vol = ncfile{'volume'};
  x = ncfile{'x'};
  y = ncfile{'y'};
  xc = ncfile{'xc'};
  yc = ncfile{'yc'};
  
%  prho  = rho(nn,:,:)';
%  ppres = pres(nn,:,:)';
  pener = ener(nn,:,:)';
%  pmass = mass(nn,:,:)';
%  pvol  = vol(nn,:,:)';
%  pux  = ux(nn,:,:)';
%  puy  = uy(nn,:,:)';
  nic = size(pener,1);
  njc = size(pener,2);
  nin = nic + 1;
  njn = njc + 1;
% move the problem to [zero,zero] position  
  px   = (x(nn,:,:)' - 1.05*ones(nin,njn))*10000;
  py   = (y(nn,:,:)' - 1.05*ones(nin,njn))*10000; 
  pxc  = (xc(nn,:,:)' - 1.05*ones(nic,njc))*10000;
  pyc  = (yc(nn,:,:)' - 1.05*ones(nic,njc))*10000;

%  hf = figure;
  aa = axes;
  set(aa,'FontSize',16);
%  set(hf,'Position',[100,100,1070,1000]);
%  pp = get(hf,'PaperPosition');
%  pp(2) = pp(2) - 1.4;
%  pp(4) = pp(4) - 3.5;
%  set(hf,'Position',[10,10,1500,1500*(y1-y0)/(x1-x0)],'PaperPosition',pp);
  hold on;
%  plot(px,py,'-k','LineWidth',2);
%  plot(px',py','-k','LineWidth',2);
%  plot(px,py,'-k');
%  plot(px',py','-k');
%  plot(pxc,pyc,'*g','LineWidth',2);
  axis equal;
%  axis off;
  axis(10000*[x0 x1 y0 y1]); 

% go over all cells and draw it as polygon
  emin = min(min(pener));
  emax = max(max(pener));
% check if we have int. energy differences
  if(emax < 0)
    pener = pener - emin*ones(nic,njc);
    emin = min(min(pener));
    emax = max(max(pener));
  end
  
% project energy to the colormaps
  e1 = 0*ones(nic,njc) + (pener-emin*ones(nic,njc))/(melt-emin);
  e2 = 1*ones(nic,njc) + (pener-melt*ones(nic,njc))/(gas-melt);
  e3 = 2*ones(nic,njc) + (pener-gas*ones(nic,njc))/(emax-gas);
  
%  emin
%  melt
%  gas
%  emax
  for i=1:nic
    for j=1:njc
      if (e1(i,j)>=1)
	e1(i,j) = 0;
      end
      if (e2(i,j)>=2)
	e2(i,j) = 0;
      end
      if (e3(i,j)>=3)
	e3(i,j) = 0;
      end
      if (e1(i,j)<=0)
	e1(i,j) = 0;
      end
      if (e2(i,j)<=1)
	e2(i,j) = 0;
      end
      if (e3(i,j)<=2)
	e3(i,j) = 0;
      end
    end
  end
  e = (e1 + e2 + e3)/3;
%  min(min(e))
%  max(max(e))

  if (2==2)
  pcolor(pxc,pyc,e);
  shading interp;
% this doesnot work very well, draws in dual cells
% instead, do it as polygons; slower, but exctely what we want

  else
  for i=1:nic
    for j=1:njc
      n1x = px(i,j);
      n1y = py(i,j);
      n2x = px(i+1,j);
      n2y = py(i+1,j);
      n3x = px(i+1,j+1);
      n3y = py(i+1,j+1);
      n4x = px(i,j+1);
      n4y = py(i,j+1);
  
      fill([n1x n2x n3x n4x],[n1y n2y n3y n4y],e(i,j));
%      [i j e1(i,j) e2(i,j) e3(i,j) e(i,j)]
    end
  end
  end
  
  col_sol = bone;
  col_flu = jet;
  col_gas = pink;
%  cm = jet(300);
%  col_sol = cm(1:160,:);
%  col_flu = cm(70:230,:);
%  col_gas = cm(140:300,:);
  col = [col_sol' col_flu' col_gas']';

  colormap(col);
  
  [cont ttt] = contour(pxc,pyc,pener,[melt gas],'k');
  set(ttt,'LineWidth',3);
%  contour(pxc,pyc,pener,linspace(melt,gas,10),'k');
  
  cb = colorbar;
  cb_values = [0.01 1/6 1/3 3/6 2/3 5/6 0.99];
  cb_labels = {'0';'solid'; '1.e10';'liquid'; '1.e11'; 'gas'; '8.e11'};
  set(cb,'YTick',cb_values);
  set(cb,'YTickLabel',cb_labels,'FontSize',16);
  cbp = get(cb,'Position');
  cbp(2) = cbp(2) + 0.01;
  cbp(4) = cbp(4) - 0.04;
  set(cb,'Position',cbp);
  
%  xlabel('X [\mum]','FontSize',16);
%  ylabel('Y [\mum]','FontSize',16);
  [min(min(px)),max(max(px)),min(min(py)),max(max(py))]
  
  