kT=1.15776*172347/(10^6);N[kT]
HMgO=-36.22/8; enthalpy of MgO
Fe2LS=-7.446; H(Mg7FeO8)-H(MgO)
HMgSiO3=-20.6194; enthapy of MgSiO3
Ferrous2=-6.3854; H(Mg15FeSi16O48)-H(Mg16Si16O48)
FeFeHL=-5.49249; H(Mg15FeSi15FeO48)-H(Mg16Si16O48)
AlAl=-0.24978; H(Mg15AlSi15AlO48)-H(Mg16Si16O48)
FeAl=-3.56957; H(Mg15FeSi15AlO48)-H(Mg16Si16O48)
metalFe=-5.6999993; enthalpy of metallic iron
O2=-42.5; low energy of O2 due to lower mantle model (low oxygen fugacity)
TSmagFe=0.11*1.15776*1.15776; temperature*magnetic entropy of iron
Mg=1.435; molar amount of Mg in PPv-Fp system
Fe=0.165; molar amount of Fe in PPv-Fp system
Oxygen=3.65; molar amount of O in PPv-Fp system
Si=0.95; molar amount of Si in PPv-Fp system
Al=0.1; molar amount of Al in PPv-Fp system

S0[var_]:=var*Log[var]
fun[n0_,n1_,n2_,n3_,n4_,n5_,n6_,x_,x1_,x2_,x3_,x4_]:=n1*(HMgO+x*Fe2LS)+n2*(HMgSiO3+x1*Ferrous2)+n3*(HMgSiO3+x2*AlAl)+n4*(HMgSiO3+x3*FeAl)+n5*(HMgSiO3+x4*FeFeHL)+n6*metalFe+kT*(n1*(S0[1-x]+S0[x])+(n2+n3+n4+n5)*(S0[(n2+n3+n4+n5-x2*n3-x1*n2-x3*n4-x4*n5)/(n2+n3+n4+n5)]+S0[n2*x1/(n2+n3+n4+n5)]+S0[n3*x2/(n2+n3+n4+n5)]+S0[(n4*x3+n5*x4)/(n2+n3+n4+n5)]+S0[(n2+n3+n4+n5-n3*x2-x3*n4-x4*n5)/(n2+n3+n4+n5)]+S0[(n4*x3+n3*x2)/(n2+n3+n4+n5)]+S0[n5*x4/(n2+n3+n4+n5)]))-kT*(n2*x1*Log[10]+n4*x3*Log[6]+2*n5*x4*Log[6]+n6*TSmagFe/kT)-(HMgO+HMgSiO3+0.125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