# Converted from pentane.mimportnumpyasnpfrommiscimportgnuplotsavefromcollectionsimportOrderedDictK=108.0P=2.5defxlogx(x):withnp.errstate(divide='ignore',invalid='ignore'):result=np.where(x>0,x*np.log(x),0.0)returnresultdefG(x):return(-x*np.log(K)+(1-x)*np.log(P)+xlogx(x)+2*xlogx(0.5-x)-xlogx(1-x))npts=100xcoarse=np.linspace(0,0.5,npts)Gcoarse=G(xcoarse)xfine=np.linspace(0.45,0.5,npts)Gfine=G(xfine)Gmin=np.min(Gfine)-0.025Gmax=np.max(Gfine)+0.025xbox=np.array([xfine[0],xfine[-1],xfine[-1],xfine[0],xfine[0]])ybox=np.array([Gmin,Gmin,Gmax,Gmax,Gmin])data=OrderedDict()data['coarse']=np.column_stack([xcoarse,Gcoarse])data['fine']=np.column_stack([xfine,Gfine])data['box']=np.column_stack([xbox,ybox])gnuplotsave('pentane.dat',data)