function Z = PB_code(phi,radius,M,charge) %Online Supplemental Material to accompany: Goehring, Li and Kiatkirakajorn, %Drying paint: from micro-scale dynamics to mechanical instabilities, %Philosophical Transactions A, DOI:10.1098/rsta.2016.0161 %Section 1.1: Define material properties. Change as required %Example values for ludox HS %radius = 8; %Particle radius, in nm %M = 0.005; %Concentration of background electrolyte, i.e. salt (in Donnan equilibrium) %charge = 0.5; %Surface charge density, electrons per nm^2 (bare or titrated charge) %Section 1.2: Define fundamental constants B = 7.0*10^-10; %Bjerrum length, m kT = (1.38*10^-23)*293; %Boltzmann energy, J A = 6.02*10^23; %Avagadro's number e0 = 1.6*10^-19; %fundamental charge, C %During calculation all length scales are normalised by Bjerrum length %The labels refer to the values inside first set of brackets. Other terms normalise. r0 = (radius*10^-9)/B; %radius of particle, m n0 = (M)*B^3*A*1000; %concentration of background electrolyte (outside dialysis bag) q = (charge)*10^18*B^2; %bare charge density, e/nm^2; R = r0/(phi)^(1/3); %radius of neutral-charged cell %Section 2 %Solve the nonlinear PB model x = linspace(r0,R,100); solinit = bvpinit(x,@mat4init); sol = bvp4c(@twoode,@twobc,solinit); y = deval(sol,x); %the PDE solver itself is below %define differntial equations function dxdy = twoode(r,y) dxdy = [ y(2) -2/r*y(2)-4*pi*n0*(exp(-y(1))-exp(y(1)))]; end %and boundary conditions function res = twobc(ya,yb) res = [ya(2) + 4*pi*q yb(2) - 0]; end %and initial conditions for the fitting algorithm function yinit = mat4init(x) yinit = [ 4 0]; end %Section 3: define various outputs %calculate effective Debye length %using Trizac et al. Langmuir 19, 4027 (2003), Eq. 6 pr = y(1,end); k_PB = sqrt(8*pi*n0*cosh(pr)); D_eff = B/k_PB; %effective or screened debye length %calculate effective charge %using Trizac et al. Langmuir 19, 4027 (2003), Eq. 16 Q = 4*pi*q*r0^2; Q_eff = tanh(pr)/(k_PB)*( (k_PB^2*r0*R-1)*sinh(k_PB*(R-r0)) + (k_PB*(R-r0))*cosh(k_PB*(R-r0)) ); %Q_eff is the effective, or screened, or renormalized surface charge; %Q is the bare charge %calculate osmotic pressure %See Bonnet-Gonnet, Belloni, and Cabane, Langmuir 10, 4012 (1994) Eq. 4 P = kT*n0/B^3*(exp(-y(1,end))+exp(y(1,end))-2); %from pressure, calculate compressibility Z = P/(kT)*4/3*pi*(radius*10^-9)^3/phi; %plots show the ion distribution (as in Fig. 2(b)) %figure(3) %plot(x/r0,exp(-y(1,:)),'-r',x/r0,exp(y(1,:)),'-k'); %axis([1,R/r0,0,5]); end