function Figure8_6

% Matlab code for Figure 8.6 in book:
% Radek Erban and Jon Chapman, Stochastic Modelling of Reaction-Diffusion
% Processes, Cambridge University Press, 2019

close all;

% Figure 8.6(b)

load data_Figure8_6_b.dat
shorttrajx=data_Figure8_6_b(:,1);
shorttrajy=data_Figure8_6_b(:,2);
shorttrajx2=data_Figure8_6_b(:,3);
shorttrajy2=data_Figure8_6_b(:,4);

figure(1);
set(gca,'Fontsize',18);
plot(shorttrajx,shorttrajy,'b','Linewidth',2);
hold on;
plot(shorttrajx2,shorttrajy2,'--r','Linewidth',2);
plot([0],[0],'xk','Markersize',12,'Linewidth',4);
plot(shorttrajx(end),shorttrajy(end),'ob','Markersize',6,'Linewidth',7);
plot(shorttrajx2(end),shorttrajy2(end),'or','Markersize',6,'Linewidth',7);
set(gca,'Xtick',[-1 -0.5 0 0.5 1]);
set(gca,'XtickLabel',{'-\sigma','-\sigma/2','0','\sigma/2','\sigma'});
set(gca,'Ytick',[-1 -0.5 0 0.5 1]);
set(gca,'YtickLabel',{'-\sigma','-\sigma/2','0','\sigma/2','\sigma'});
xlabel('$x$','interpreter','latex');
ylabel('$y$','interpreter','latex','rotation',0);
axis([-1.22 0.5 -1.2 0.6]);
set(gca,'Fontsize',18);

% Figure 8.6(c)

load data_Figure8_6_c.dat;
chi=data_Figure8_6_c;

figure(2);
set(gca,'Fontsize',18);
plot([0 2],[0 0],'k');
hold on;
plot(chi(:,1),chi(:,2),'b','Linewidth',2);
text(1.05,0.85,'$\displaystyle \frac{\chi(\tau)}{\chi(0)}$','fontsize',18,'interpreter','latex');
set(gca,'Xtick',[0 0.2 0.4 0.6 0.8 1 1.2]);
xlabel('$\tau$ [ps]','interpreter','latex');
ylabel('normalized $\chi(\tau)$','interpreter','latex');
axis([0 1.25 -0.15 1]);
set(gca,'Fontsize',18);

% Figure 8.6(d)

load data_Figure8_6_d.dat
rdfLJ= data_Figure8_6_d;

figure(3);
set(gca,'Fontsize',18);
plot(rdfLJ(:,1),rdfLJ(:,2),'ro','Linewidth',3,'Markersize',2);
hold on;
plot([2^(1/6) 2^(1/6)],[0.465 3],'k--');
axis([0 3.5 0 3]);
set(gca,'Xtick',[0 1 2 3]);
set(gca,'XtickLabel',{'0','\sigma','2\sigma','3\sigma'});
text(1.07,0.29,'$2^{1/6}\sigma$','fontsize',18,'interpreter','latex');
xlabel('$r$','interpreter','latex');
ylabel('$g(r)$','interpreter','latex');
set(gca,'Fontsize',18);

% Figure 8.6(f)

load data_Figure8_6_f.dat;
rdf=data_Figure8_6_f;

figure(4);
set(gca,'Fontsize',18);
plot(rdf(:,1),rdf(:,2),'b','Linewidth',2);
hold on;
plot(rdf(:,1),rdf(:,3),'r','Linewidth',2);
plot(rdf(:,1),rdf(:,4),'g','Linewidth',2);
plot(rdf(:,1),rdf(:,3),'r','Linewidth',2);
plot(rdf(:,1),rdf(:,2),'b','Linewidth',2);
h=legend('Na$^+$','K$^+$','Cl$^-$');
set(h,'interpreter','latex','Fontsize',18);
xlabel('$r$ [\AA{}]','interpreter','latex');
ylabel('$g_{io}(r)$','interpreter','latex');
set(gca,'XTick',[0 2 4 6 8 10]);
axis([0 10 0 8]);
set(gca,'Fontsize',18);



