#
 ====================================================================
 The 'metabasite set' of a-x relations in NCKFMASHTO.

 checked and uploaded 30-01-2022 by ecrg
 (see 0_version_notes.txt)

 Use with:
   - tc-ds62.txt
   - tc350 and above

 File originally assembled by E.C.R. Green 27 May 2016
 as tc-6axNCKFMASHTOm45.txt

 Reformatted by E.C.R. Green 21 October 2019, 1 Dec 2019.
 - corrects error in san end-member in I-bar1 plagioclase (pli)
 - delG(tran) for mat end-member in muscovite was routinely
   changed to 5.0 kJ from 6.5 kJ from around 2015; this change
   is formalised here.
 - uses Mn-free versions of metapelite set xeos
 - removes P-dependence of Ws in garnet for consistency
   with metapelite models
 - renamed pl as plc for consistency
- Updates 01-22:
- added pl4tr, k4tr, abc
- corrected header sp

 Coding for L (tonalitic 'metabasite' melt),
	     hb (+ act, gl via samecoding script),
            aug, dio (+ o, jd via samecoding),
            opx, g, ol, pl4tr, abc, k4tr, ksp, plc, pli, sp (+ mt),
            ilm (+ hem), ilmm (+ hemm), ep, bi, mu, chl

 N.B. please read the README file in this distribution
      before using these a-x relations.

 =================================================================
#
#
 =================================================================
 Tonalitic 'metabasite' melt: NCKFMASH

 Green, ECR, White, RW, Diener, JFA, Powell, R, Holland, TJB &
 Palin, RM (2016). Activity-composition relations for the calculation
 of partial melting equilibria in metabasic rocks.
 Journal of Metamorphic Geology, 34, 845-869.

  E-m    Formula                     Mixing sites
	               M*         V         molecular mixing
	               Mg4 Fe4    v2 H2   Si4O8 NaAlSi3O8 KAlSi3O8 CaSiO3 Al2SiO5 Si2O8 CaAl2Si2O8
  q4L	  Si4O8	                  1   0       1       0      0       0       0       0       0
  abL    NaAlSi3O8               1   0       0       1      0       0       0       0       0
  kspL   KAlSi3O8                1   0       0       0      1       0       0       0       0
  wo1L   CaSiO3                  1   0       0       0      0       1       0       0       0
  sl1L   Al2SiO5                 1   0       0       0      0       0       1       0       0
  fa2L   Fe4Si2O8      0   1     1   0       0       0      0       0       0       1       0
  fo2L   Mg4Si2O8      1   0     1   0       0       0      0       0       0       1       0
  h2o1L  H2O                     0   1
  anoL   CaAl2Si2O8              1   0       0       0      0       0       0       0       1    - modifies speciation
              *use 5-fold entropy of mixing from M site
              N.B. formation of anoL causes change in total moles liquid -> normalisation needed

  q -> Si4O8 / denom
  fsp -> (NaAlSi3O8 + KAlSi3O8) / denom
  na -> NaAlSi3O8 / (NaAlSi3O8 + KAlSi3O8)
  wo -> CaSiO3 / denom
  sil -> Al2SiO5 / denom
  ol -> Si2O8 / denom
  x -> xFe/(xFe + xMg)
  yanL -> CaAl2SiO8 / (denom + CaAl2SiO8)            - speciation variable

  where denom = Si4O8 + NaAlSi3O8 + KAlSi3O8 + CaSiO3 + Al2SiO5 + Si2O8 + H2O
                (defined on dataset end-members)
 --------------------------------------------------
#

 starting guesses
  q(L) = 0.20000  range 0 <> 1
  fsp(L) = 0.10000  range 0 <> 1
  na(L) = 0.20000  range 0 <> 1
  wo(L) = 0.050000  range 0 <> 1
  sil(L) = 0.010000  range 0 <> 1
  ol(L) = 0.010000  range 0 <> 1
  x(L) = 0.010000  range 0 <> 1
  yan(L) = 0.010000   range 0 <> 1

 labels (assign first label for which condition is true)
  liquid : liq : true
  
 site fractions
   fac = (q + fsp + wo + sil + ol)*(1 + yan) + (-yan)
   pq = q*(1 + yan)
   xab = fsp*na*(1 + yan)
   xksp = fsp*(1 - na)*(1 + yan)
   pwo = wo*(1 + yan) + (-yan)
   psil = sil*(1 + yan) + (-yan)
   ph2o = (-q - fsp - wo - sil - ol)*(1 + yan) + 1 + yan
   pan = yan
   pol = ol*(1 + yan)
   xFe = x
   xMg = 1 - x

 proportions
   q4L = q*(1 + yan)
   abL = fsp*na*(1 + yan)
   kspL = fsp*(1 - na)*(1 + yan)
   wo1L = wo*(1 + yan) + (-yan)
   sl1L = sil*(1 + yan) + (-yan)
   fa2L = ol*x*(1 + yan)
   fo2L = ol*(1 - x)*(1 + yan)
   h2oL = (-q - fsp - wo - sil - ol)*(1 + yan) + 1 + yan
   anoL = yan

 ideal mixing activities
  q4L = fac*pq
  abL = fac*xab
  kspL = fac*xksp
  wo1L = fac*pwo
  sl1L = fac*psil
  fa2L = fac*pol*xFe**5
  fo2L = fac*pol*xMg**5
  h2oL = ph2o**2
  anoL = fac*pan

 non-ideality by symmetric formalism
  W(q4L,abL) = 12 - 0.4*P
  W(q4L,kspL) = -2 - 0.5*P
  W(q4L,wo1L) = -5
  W(q4L,sl1L) = 0
  W(q4L,fa2L) = 0
  W(q4L,fo2L) = 42 + 1*P
  W(q4L,h2oL) = 18.1 - 0.68*P
  W(q4L,anoL) = -29.5 - 0.1*P
  W(abL,kspL) = -6 + 3*P
  W(abL,wo1L) = -12
  W(abL,sl1L) = 10
  W(abL,fa2L) = -30 + 0.8*P
  W(abL,fo2L) = -47.3 + 0.3*P
  W(abL,h2oL) = -4.4 - 0.17*P
  W(abL,anoL) = 8.6 + 0.4*P
  W(kspL,wo1L) = -13
  W(kspL,sl1L) = 0
  W(kspL,fa2L) = -11.3
  W(kspL,fo2L) = 6.8
  W(kspL,h2oL) = 10.4 - 0.39*P
  W(kspL,anoL) = -16 - 0.25*P
  W(wo1L,sl1L) = -1.6
  W(wo1L,fa2L) = 6.5
  W(wo1L,fo2L) = 4
  W(wo1L,h2oL) = 21
  W(wo1L,anoL) = 3.5
  W(sl1L,fa2L) = 12
  W(sl1L,fo2L) = 12
  W(sl1L,h2oL) = 11 - 0.5*P
  W(sl1L,anoL) = 6.4
  W(fa2L,fo2L) = 18
  W(fa2L,h2oL) = 29
  W(fa2L,anoL) = -43.5 - 0.95*P
  W(fo2L,h2oL) = 29 - 0.5*P
  W(fo2L,anoL) = -26 - 0.6*P
  W(h2oL,anoL) = 9.75 - 0.5*P

 "make" end-members
  q4L = 4 *qL
  wo1L = woL + 1.3  (mod)
  sl1L = silL - 7.8  (mod)
  fa2L = 2* faL - 8.2 - 1.4*P  (mod)
  fo2L = 2 *foL - 4  (mod)
  anoL = woL + silL - 46.5 - 0.25*P

#
 =================================================================
 clinoamphibole: NCKFMASHTO

 Green, ECR, White, RW, Diener, JFA, Powell, R, Holland, TJB &
 Palin, RM (2016). Activity-composition relations for the calculation
 of partial melting equilibria in metabasic rocks.
 Journal of Metamorphic Geology, 34, 845-869.

 E-m  Formula                                         Mixing sites
                              A          M13     M2                M4            T1*      V
                              v  Na K    Mg Fe   Mg Fe Al Fe3 Ti   Ca Mg Fe Na   Si Al   OH O
 tr   Ca2Mg5Si8O22(OH)2       1  0  0    3  0    2  0  0   0  0    2  0  0  0    4  0    2  0  tremolite
 tsm  Ca2Mg3Al4Si6O22(OH)2    1  0  0    3  0    0  0  2   0  0    2  0  0  0    2  2    2  0  tschermakite
 prgm NaCa2Mg4Al3Si6O22(OH)2  0  1  0    3  0    1  0  1   0  0    2  0  0  0    2  2    2  0  pargasite
 glm  Na2Mg3Al2Si8O22(OH)2    1  0  0    3  0    0  0  2   0  0    0  0  0  2    4  0    2  0  glaucophane
 cumm Mg7Si8O22(OH)2          1  0  0    3  0    2  0  0   0  0    0  2  0  0    4  0    2  0  cummingtonite
 grnm Fe7Si8O22(OH)2          1  0  0    0  3    0  2  0   0  0    0  0  2  0    4  0    2  0  grunerite
 a    Mg3Fe4Si8O22(OH)2       1  0  0    3  0    0  2  0   0  0    0  0  2  0    4  0    2  0  - ordered
 b    Mg2Fe5Si8O22(OH)2       1  0  0    0  3    2  0  0   0  0    0  0  2  0    4  0    2  0  - ordered
 mrb  Na2Mg3Fe2Si8O22(OH)2    1  0  0    3  0    0  0  0   2  0    0  0  0  2    4  0    2  0  magnesio-riebekite
 kprg KCa2Mg4Al3Si6O22(OH)2   0  0  1    3  0    1  0  1   0  0    2  0  0  0    2  2    2  0  K-pargasite
 tts  Ca2Mg3Al2Ti2Si6O24      1  0  0    3  0    0  0  0   0  2    2  0  0  0    2  2    0  2  Ti-tschermakite
 *use 1/4 entropy of mixing from T-site

 There is little information with which to estimate delH^formation for
 any of these end-members in the Holland & Powell dataset. The dataset
 value for the end-member tr is assumed to be correct, while the values
 for the other end-members are calibrated relative to this during a-x
 calibration.

 x -> (3 xFeM13 + 2 xFeM2 + 2 xFeM4)/(3 xFeM13 + 2 xFeM2 + 2 xFeM4 + 3 xMgM13 + 2 xMgM2 + 2 xMgM4)  range 0 <> 1
 y -> xAlM2  range 0 <> 1
 z -> xNaM4  range 0 <> 1
 a -> xKA + xNaA  range 0 <> 1
 k -> xKA/(xKA + xNaA)  range 0 <> 1
 c -> xCaM4  range 0 <> 1
 f -> xFe3M2  range 0 <> 1
 t -> xTiM2  range 0 <> 1
 Q1 -> x - xFeM13/(xFeM13 + xMgM13)  range 0 <> 1
 Q2 -> x - xFeM2/(xFeM2 + xMgM2)  range 0 <> 1
 --------------------------------------------------
#

 starting guesses
  x(hb) = 0.57500  range 0 <> 1
  y(hb) = 0.65000  range 0 <> 1
  z(hb) = 0.35000  range 0 <> 1
  a(hb) = 0.40000  range 0 <> 1
  k(hb) = 0.10000  range 0 <> 1
  c(hb) = 0.65000  range 0 <> 1
  f(hb) = 0.10000  range 0 <> 1
  t(hb) = 0.10000  range 0 <> 1
  Q1(hb) = 0.027600  range -1 <> 1  order variable
  Q2(hb) = 0.27500  range -1 <> 1  order variable

 labels (assign first label for which condition is true)
  amphibole : hb : true
  
 site fractions
   xvA = 1 - a
   xNaA = a + (-a)*k
   xKA = a*k
   xMgM13 = 1 + Q1 - x
   xFeM13 = -Q1 + x
   xMgM2 = 1 - f + Q2 - t - x - y + (-f)*Q2 + (-Q2)*t + f*x + t*x + (-Q2)*y + x*y
   xFeM2 = -Q2 + x + f*Q2 + Q2*t + (-f)*x + (-t)*x + Q2*y + (-x)*y
   xAlM2 = y
   xFe3M2 = f
   xTiM2 = t
   xCaM4 = c
   xMgM4 = 1 - c - Q2 - x - z - 3/2*Q1 + f*Q2 + Q2*t + c*x + Q2*y + x*z
   xFeM4 = Q2 + x + 3/2*Q1 + (-f)*Q2 + (-Q2)*t + (-c)*x + (-Q2)*y + (-x)*z
   xNaM4 = z
   xSiT1 = 1 - 1/2*f - 1/2*t - 1/2*y + 1/2*z - 1/4*a
   xAlT1 = 1/2*f + 1/2*t + 1/2*y - 1/2*z + 1/4*a
   xOHV = 1 - t
   xOV = t

 proportions
   tr = -1/2*a + c - f - t - y + z
   tsm = -1/2*a + f + y - z
   prgm = a + (-a)*k
   glm = -f + z
   cumm = 1 - c - Q2 - x - z - 3/2*Q1 + f*Q2 + Q2*t + c*x + Q2*y + x*z
   grnm = x - 2Q2 - 5/2*Q1 + 2f*Q2 + 2Q2*t + c*x + (-f)*x + (-t)*x + 2Q2*y + (-x)*y + x*z
   a = Q2 + 5/2*Q1 + (-f)*Q2 + (-Q2)*t + (-c)*x + (-Q2)*y + (-x)*z
   b = 2Q2 + 3/2*Q1 + (-2f)*Q2 + (-2Q2)*t + (-c)*x + f*x + t*x + (-2Q2)*y + x*y + (-x)*z
   mrb = f
   kprg = a*k
   tts = t

 ideal mixing activities
  tr = xvA*xMgM13**3*xMgM2**2*xCaM4**2*xSiT1*xOHV**2
  tsm = 2*xvA*xMgM13**3*xAlM2**2*xCaM4**2*xSiT1**(1/2)*xAlT1**(1/2)*xOHV**2
  prgm = 8*xNaA*xMgM13**3*xMgM2*xAlM2*xCaM4**2*xSiT1**(1/2)*xAlT1**(1/2)*xOHV**2
  glm = xvA*xMgM13**3*xAlM2**2*xNaM4**2*xSiT1*xOHV**2
  cumm = xvA*xMgM13**3*xMgM2**2*xMgM4**2*xSiT1*xOHV**2
  grnm = xvA*xFeM13**3*xFeM2**2*xFeM4**2*xSiT1*xOHV**2
  a = xvA*xMgM13**3*xFeM2**2*xFeM4**2*xSiT1*xOHV**2
  b = xvA*xFeM13**3*xMgM2**2*xFeM4**2*xSiT1*xOHV**2
  mrb = xvA*xMgM13**3*xFe3M2**2*xNaM4**2*xSiT1*xOHV**2
  kprg = 8*xKA*xMgM13**3*xMgM2*xAlM2*xCaM4**2*xSiT1**(1/2)*xAlT1**(1/2)*xOHV**2
  tts = 2*xvA*xMgM13**3*xTiM2**2*xCaM4**2*xSiT1**(1/2)*xAlT1**(1/2)*xOV**2

 non-ideality by van laar
  W(tr,tsm) = 20
  W(tr,prgm) = 25
  W(tr,glm) = 65
  W(tr,cumm) = 45
  W(tr,grnm) = 75
  W(tr,a) = 57
  W(tr,b) = 63
  W(tr,mrb) = 52
  W(tr,kprg) = 30
  W(tr,tts) = 85
  W(tsm,prgm) = -40
  W(tsm,glm) = 25
  W(tsm,cumm) = 70
  W(tsm,grnm) = 80
  W(tsm,a) = 70
  W(tsm,b) = 72.5
  W(tsm,mrb) = 20
  W(tsm,kprg) = -40
  W(tsm,tts) = 35
  W(prgm,glm) = 50
  W(prgm,cumm) = 90
  W(prgm,grnm) = 106.7
  W(prgm,a) = 94.8
  W(prgm,b) = 94.8
  W(prgm,mrb) = 40
  W(prgm,kprg) = 8
  W(prgm,tts) = 15
  W(glm,cumm) = 100
  W(glm,grnm) = 113.5
  W(glm,a) = 100
  W(glm,b) = 111.2
  W(glm,mrb) = 0
  W(glm,kprg) = 54
  W(glm,tts) = 75
  W(cumm,grnm) = 33
  W(cumm,a) = 18
  W(cumm,b) = 23
  W(cumm,mrb) = 80
  W(cumm,kprg) = 87
  W(cumm,tts) = 100
  W(grnm,a) = 12
  W(grnm,b) = 8
  W(grnm,mrb) = 91
  W(grnm,kprg) = 96
  W(grnm,tts) = 65
  W(a,b) = 20
  W(a,mrb) = 80
  W(a,kprg) = 94
  W(a,tts) = 95
  W(b,mrb) = 90
  W(b,kprg) = 94
  W(b,tts) = 95
  W(mrb,kprg) = 50
  W(mrb,tts) = 50
  W(kprg,tts) = 35

  v(tr) = 1
  v(tsm) = 1.5
  v(prgm) = 1.7
  v(glm) = 0.8
  v(cumm) = 1
  v(grnm) = 1
  v(a) = 1
  v(b) = 1
  v(mrb) = 0.8
  v(kprg) = 1.7
  v(tts) = 1.5

 "make" end-members
  tsm = ts + 10  (mod)
  prgm = parg - 10  (mod)
  glm = gl - 3  (mod)
  grnm = grun - 3  (mod)
  a = 3/7 cumm + 4/7 grun - 11.2  (od)
  b = 2/7 cumm + 5/7 grun - 13.8  (od)
  mrb = gl - gr + andr
  kprg = mu - pa + parg - 7.06 + 0.02*T  (make)
  tts = - 2 dsp + 2 ru + ts + 95  (make)

#
 ====================================================================
 clinopyroxene: NCFMASO

 Augitic (calcic) cpx.

 WARNING: Order-disorder on tet site only.
 DO NOT use for ompfmchacite, sodic cpx
 DO NOT use for coexisting sodic-calcic cpx

 Green, ECR, White, RW, Diener, JFA, Powell, R, Holland, TJB &
 Palin, RM (2016). Activity-composition relations for the calculation
 of partial melting equilibria in metabasic rocks.
 Journal of Metamorphic Geology, 34, 845-869.

 E-m   Formula                        Mixing sites
                  M1                M2                T1*         T2*
                  Mg  Fe  Al  Fe3   Mg  Fe  Ca  Na    Si   Al    Si   Al
 di    CaMgSi2O6  1   0   0   0     0   0   1   0     1    0     1    0
 cenh  Mg2Si2O6   1   0   0   0     1   0   0   0     1    0     1    0
 cfs   Fe2Si2O6   0   1   0   0     0   1   0   0     1    0     1    0
 jdm   NaAlSi2O6  0   0   1   0     0   0   0   1     1    0     1    0
 acmm  NaFeSi2O6  0   0   0   1     0   0   0   1     1    0     1    0
 ocats CaAl2SiO6  0   0   1   0     0   0   1   0     1    0     0    1    } allow internal o-d in
 dcats CaAl2SiO6  0   0   1   0     0   0   1   0     1/2  1/2   1/2  1/2  }    cats end-member
 fmc   MgFeSi2O6  1   0   0   0     0   1   0   0     1    0     1    0    - ordered intermediate
 *use 1/4 entropy of mixing from T-site

 x -> (xFeM1 + xFeM2)/(xFeM1 + xFeM2 + xMgM1 + xMgM2)
 y -> xAlT1 + xAlT2
 f -> xFe3M1
 z -> xCaM2
 j -> xNaM2
 Qfm -> 2 xFeM2/(xFeM2 + xMgM2) - 2 x        - order variable: Fe-Mg mixing
 Qal -> -xAlT1 + xAlT2                       - order variable: Al-Si in cats
 -------------------------------------------------
#

 starting guesses
  x(aug) = 0.20000  range 0 <> 1
  y(aug) = 0.12000  range 0 <> 1
  c(aug) = 0.030000  range 0 <> 1
  z(aug) = 0.85000  range 0 <> 1
  j(aug) = 0.080000  range 0 <> 1
  Qfm(aug) = 0.20000  range 0 <> 1
  Qal(aug) = 0.050000  range 0 <> 1

 labels (assign first label for which condition is true)
  clinopyroxene : aug : true
  
 site fractions
   xMgM1 = 1 + 1/2*Qfm - j - x - y + (-1/2*j)*Qfm + j*x + x*y + (-1/2*Qfm)*z
   xFeM1 = -1/2*Qfm + x + 1/2*j*Qfm + (-j)*x + (-x)*y + 1/2*Qfm*z
   xAlM1 = -c + j + y
   xFe3M1 = c
   xMgM2 = 1 - 1/2*Qfm - j - x - z + 1/2*j*Qfm + j*x + 1/2*Qfm*z + x*z
   xFeM2 = 1/2*Qfm + x + (-1/2*j)*Qfm + (-j)*x + (-1/2*Qfm)*z + (-x)*z
   xCaM2 = z
   xNaM2 = j
   xSiT1 = 1 + 1/2*Qal - 1/2*y
   xAlT1 = -1/2*Qal + 1/2*y
   xSiT2 = 1 - 1/2*Qal - 1/2*y
   xAlT2 = 1/2*Qal + 1/2*y

 proportions
   di = -y + z
   cenh = 1 - 1/2*Qfm - j - x - z + 1/2*j*Qfm + j*x + 1/2*Qfm*z + x*z
   cfs = -1/2*Qfm + x + 1/2*j*Qfm + (-j)*x + (-x)*y + 1/2*Qfm*z
   jdm = -c + j
   acmm = c
   ocats = Qal
   dcats = -Qal + y
   fmc = Qfm + (-j)*Qfm + x*y + (-Qfm)*z + (-x)*z
   
 ideal mixing activities
  di = xMgM1*xCaM2*xSiT1**(1/4)*xSiT2**(1/4)
  cenh = xMgM1*xMgM2*xSiT1**(1/4)*xSiT2**(1/4)
  cfs = xFeM1*xFeM2*xSiT1**(1/4)*xSiT2**(1/4)
  jdm = xAlM1*xNaM2*xSiT1**(1/4)*xSiT2**(1/4)
  acmm = xFe3M1*xNaM2*xSiT1**(1/4)*xSiT2**(1/4)
  ocats = xAlM1*xCaM2*xSiT1**(1/4)*xAlT2**(1/4)
  dcats = 1.4142*xAlM1*xCaM2*xSiT1**(1/8)*xAlT1**(1/8)*xSiT2**(1/8)*xAlT2**(1/8)
  fmc = xMgM1*xFeM2*xSiT1**(1/4)*xSiT2**(1/4)

 non-ideality by van laar
  W(di,cenh) = 29.8 - 0.03*P
  W(di,cfs) = 25.8 - 0.03*P
  W(di,jdm) = 26
  W(di,acmm) = 21
  W(di,ocats) = 12.3 - 0.01*P
  W(di,dcats) = 12.3 - 0.01*P
  W(di,fmc) = 20.6 - 0.03*P
  W(cenh,cfs) = 2.3
  W(cenh,jdm) = 50
  W(cenh,acmm) = 62
  W(cenh,ocats) = 45.7 - 0.29*P
  W(cenh,dcats) = 45.7 - 0.29*P
  W(cenh,fmc) = 4
  W(cfs,jdm) = 60
  W(cfs,acmm) = 58
  W(cfs,ocats) = 48
  W(cfs,dcats) = 48
  W(cfs,fmc) = 3.5
  W(jdm,acmm) = 5
  W(jdm,ocats) = 40
  W(jdm,dcats) = 40
  W(jdm,fmc) = 40
  W(acmm,ocats) = 35
  W(acmm,dcats) = 35
  W(acmm,fmc) = 60
  W(ocats,dcats) = 3.8 + 0.01*P
  W(ocats,fmc) = 50
  W(dcats,fmc) = 50

  v(di) = 1.2
  v(cenh) = 1
  v(cfs) = 1
  v(jdm) = 1.2
  v(acmm) = 1.2
  v(ocats) = 1.9
  v(dcats) = 1.9
  v(fmc) = 1

 "make" end-members
  cenh = en + 3.5 - 0.002*T + 0.048*P  (tran)
  cfs = fs + 2.1 - 0.002*T + 0.045*P  (tran)
  jdm = jd + 2  (mod)
  acmm = acm - 5  (mod)
  ocats = o-cats
  dcats = o-cats + 3.8 - 0.002882*T + 0.01*P  (od)
  fmc = 1/2 fs + 1/2 en - 1.6 - 0.002*T + 0.0465*P  (od)

#
 =====================================================================
 clinopyroxene: NCFMASO

 Sodic-calcic cpx with order-disorder on M1, M2.
 Use this model for coexisting sodic-calcic, omphacitic cpx!

 WARNING: No tet-site Al, unsuitable for high temperatures.

 Green, ECR, White, RW, Diener, JFA, Powell, R, Holland, TJB &
 Palin, RM (2016). Activity-composition relations for the calculation
 of partial melting equilibria in metabasic rocks.
 Journal of Metamorphic Geology, 34, 845-869.

 E-m   Formula                                   Mixing sites
                             M1m               M1a               M2c       M2n
                             Mg  Fe  Fe3 Al    Mg  Fe  Fe3 Al    Na  Ca    Na  Ca
 jd    NaAlSi2O6             0   0   0   1/2   0   0   0   1/2   1/2 0     1/2 0
 di    CaMgSi2O6             1/2 0   0   0     1/2 0   0   0     0   1/2   0   1/2
 hed   CaFeSi2O6             0   1/2 0   0     0   1/2 0   0     0   1/2   0   1/2
 acmm   NaFeSi2O6            0   0   1/2 0     0   0   1/2 0     1/2 0     1/2 0
 om    Na.5Ca.5Mg.5Al.5SiO6  1/2 0   0   0     0   0   0   1/2   0   1/2   1/2 0      - ordered intermediate
 cfm   CaMg.5Fe.5SiO6        0   1/2 0   0     1/2 0   0   0     0   1/2   0   1/2    - ordered intermediate
 jac   NaAl.5Fe.5SiO6        0   0   0   1/2   0   0   1/2 0     1/2 0     1/2 0      - ordered intermediate

 f -> (xFe3M1a + xFe3M1m)/(xAlM1a + xAlM1m + xFe3M1a + xFe3M1m)
 x -> (xFeM1a + xFeM1m)/(xFeM1a + xFeM1m + xMgM1a + xMgM1m)
 j -> (xNaM2c + xNaM2n)/2
 Q -> (xNaM2n - xNaM2c)/2                        - order variable
 Qaf -> (xFe3M1a - xFe3M1m)/2                    - order variable
 Qfm -> xFeM1a/(xFeM1a + xMgM1a) - x             - order variable
 -------------------------------------------------
#

 starting guesses
  x(dio) = 0.34810  range 0 <> 1
  j(dio) = 0.020000  range 0 <> 1
  t(dio) = 0.10000  range 0 <> 1
  c(dio) = 0.00021260  range -0.5 <> 0.5  order variable
  Qaf(dio) = 0.0092860  range -0.5 <> 0.5  order variable
  Qfm(dio) = -0.11350  range -0.5 <> 0.5  order variable

 labels (assign first label for which condition is true)
  clinipyroxene  :cpx : true
  
 site fractions
   xMgM1m = 1 - j + c + Qfm - x + (-j)*Qfm + (-c)*Qfm + j*x + (-c)*x
   xFeM1m = -Qfm + x + j*Qfm + c*Qfm + (-j)*x + c*x
   xFe3M1m = -Qaf + t*j
   xAlM1m = j - c + Qaf + (-t)*j
   xMgM1a = 1 - j - c - Qfm - x + j*Qfm + c*Qfm + j*x + c*x
   xFeM1a = Qfm + x + (-j)*Qfm + (-c)*Qfm + (-j)*x + (-c)*x
   xFe3M1a = Qaf + t*j
   xAlM1a = j + c - Qaf + (-t)*j
   xNaM2c = j - c
   xCaM2c = 1 - j + c
   xNaM2n = j + c
   xCaM2n = 1 - j - c

 proportions
   jd = j - c - Qaf + (-t)*j
   di = 1 - j - c + Qfm - x + (-j)*Qfm + (-c)*Qfm + j*x + (-c)*x
   hed = Qfm + x + (-j)*Qfm + (-c)*Qfm + (-j)*x + (-c)*x
   acmm = -Qaf + t*j
   om = 2c
   cfm = -2Qfm + 2j*Qfm + 2c*Qfm + 2c*x
   jac = 2Qaf

 ideal mixing activities
  jd = xAlM1m**(1/2)*xAlM1a**(1/2)*xNaM2c**(1/2)*xNaM2n**(1/2)
  di = xMgM1m**(1/2)*xMgM1a**(1/2)*xCaM2c**(1/2)*xCaM2n**(1/2)
  hed = xFeM1m**(1/2)*xFeM1a**(1/2)*xCaM2c**(1/2)*xCaM2n**(1/2)
  acmm = xFe3M1m**(1/2)*xFe3M1a**(1/2)*xNaM2c**(1/2)*xNaM2n**(1/2)
  om = xMgM1m**(1/2)*xAlM1a**(1/2)*xCaM2c**(1/2)*xNaM2n**(1/2)
  cfm = xFeM1m**(1/2)*xMgM1a**(1/2)*xCaM2c**(1/2)*xCaM2n**(1/2)
  jac = xAlM1m**(1/2)*xFe3M1a**(1/2)*xNaM2c**(1/2)*xNaM2n**(1/2)

 non-ideality by symmetric formalism
  W(jd,di) = 26
  W(jd,hed) = 24
  W(jd,acmm) = 5
  W(jd,om) = 15.5
  W(jd,cfm) = 25.2
  W(jd,jac) = 3
  W(di,hed) = 4
  W(di,acmm) = 21
  W(di,om) = 15.75
  W(di,cfm) = 2
  W(di,jac) = 24.65
  W(hed,acmm) = 20.8
  W(hed,om) = 17.2
  W(hed,cfm) = 2
  W(hed,jac) = 24.6
  W(acmm,om) = 16.4
  W(acmm,cfm) = 22.2
  W(acmm,jac) = 3
  W(om,cfm) = 18.45
  W(om,jac) = 19.5
  W(cfm,jac) = 24.55

 "make" end-members
  acmm = acm - 7  (mod)
  om = 1/2 jd + 1/2 di - 2.9  (od)
  cfm = 1/2 di + 1/2 hed - 1.5  (od)
  jac = 1/2 jd + 1/2 acm - 4.5  (od)

#
 =================================================================
 orthopyroxene: CFMASO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 coded by axe attack on 14 August 2013

 E-m   Formula                         Mixing sites
                   M1                M2            T*
                   Mg  Fe  Fe3 Al    Mg  Fe  Ca    Si  Al
 en     Mg2Si2O6   1   0   0   0     1   0   0     2   0
 fs     Fe2Si2O6   0   1   0   0     0   1   0     2   0
 fm     MgFeSi2O6  1   0   0   0     0   1   0     2   0     - ordered intermediate
 mgts   MgAl2SiO6  0   0   0   1     1   0   0     1   1
 fopx   MgFe2SiO6  0   0   1   0     1   0   0     1   1
 odi    CaMgSi2O6  1   0   0   0     0   0   1     2   0
 *use 1/4 entropy of mixing from T-site

 x -> (xFeM1 + xFeM2)/(xFeM1 + xFeM2 + xMgM1 + xMgM2)
 y -> xAlM1
 f -> xFe3M1
 c -> xCaM2
 Q -> 2 xFeM2/(xFeM2 + xMgM2) - 2 x        - order variable
 -------------------------------------------------
#

 starting guesses
  x(opx) = 0.30000  range 0 <> 1
  y(opx) = 0.10000  range 0 <> 1
  f(opx) = 0.030000  range 0 <> 1
  c(opx) = 0.050000  range 0 <> 1
  Q(opx) = 0.40000  range 0 <> 1

 labels (assign first label for which condition is true)
  orthopyroxene : opx : true
  
 site fractions
   xMgM1 = 1 + 1/2*Q - f - x - y + (-1/2*c)*Q + f*x + x*y
   xFeM1 = -1/2*Q + x + 1/2*c*Q + (-f)*x + (-x)*y
   xFe3M1 = f
   xAlM1 = y
   xMgM2 = 1 - 1/2*Q - c - x + 1/2*c*Q + c*x
   xFeM2 = 1/2*Q + x + (-1/2*c)*Q + (-c)*x
   xCaM2 = c
   xAlT = 1/2*f + 1/2*y
   xSiT = 1 - 1/2*f - 1/2*y

 proportions
   en = 1 - 1/2*Q - c - f - x - y + 1/2*c*Q + c*x
   fs = -1/2*Q + x + 1/2*c*Q + (-f)*x + (-x)*y
   fm = Q + (-c)*Q + (-c)*x + f*x + x*y
   mgts = y
   fopx = f
   odi = c

 ideal mixing activities
  en = xMgM1*xMgM2*xSiT**(1/2)
  fs = xFeM1*xFeM2*xSiT**(1/2)
  fm = xMgM1*xFeM2*xSiT**(1/2)
  mgts = 1.4142*xAlM1*xMgM2*xSiT**(1/4)*xAlT**(1/4)
  fopx = 1.4142*xFe3M1*xMgM2*xSiT**(1/4)*xAlT**(1/4)
  odi = xMgM1*xCaM2*xSiT**(1/2)

 non-ideality by van laar
  W(en,fs) = 7
  W(en,fm) = 4
  W(en,mgts) = 13 - 0.15*P
  W(en,fopx) = 11 - 0.15*P
  W(en,odi) = 32.2 + 0.12*P
  W(fs,fm) = 4
  W(fs,mgts) = 13 - 0.15*P
  W(fs,fopx) = 11.6 - 0.15*P
  W(fs,odi) = 25.54 + 0.084*P
  W(fm,mgts) = 17 - 0.15*P
  W(fm,fopx) = 15 - 0.15*P
  W(fm,odi) = 22.54 + 0.084*P
  W(mgts,fopx) = 1
  W(mgts,odi) = 75.4 - 0.94*P
  W(fopx,odi) = 73.4 - 0.94*P

  v(en) = 1
  v(fs) = 1
  v(fm) = 1
  v(mgts) = 1
  v(fopx) = 1
  v(odi) = 1.2

 "make" end-members
  fm = 1/2 en + 1/2 fs - 6.6  (od)
  fopx = mgts - 1/2 gr + 1/2 andr + 2  (make)
  odi = di - 0.1 + 0.000211*T + 0.005*P  (tran)

#
 =================================================================
 garnet: CFMASO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 coded by axe attack on 24 March 2011
 manually inserted P dependence on 5-5-14

 E-m    Formula                   Mixing sites
                       X                         Y
                       Mg    Fe    Ca      Al    Fe3
 py     Mg3Al2Si3O12   3     0     0       2     0
 alm    Fe3Al2Si3O12   0     3     0       2     0
 gr     Ca3Al2Si3O12   0     0     3       2     0
 kho    Mg3Fe2Si3O12   3     0     0       0     2

 x -> xFeX/(xFeX + xMgX)
 z -> xCaX
 f -> xFe3Y
 -------------------------------------------------
#

 starting guesses
  x(g) = 0.90000  range 0 <> 1
  z(g) = 0.10000  range 0 <> 1
  f(g) = 0.010000  range 0 <> 1

 labels (assign first label for which condition is true)
  garnet : gt : true
  
 site fractions
   xMgX = 1 - x - z + x*z
   xFeX = x + (-x)*z
   xCaX = z
   xAlY = 1 - f
   xFe3Y = f

 proportions
   py = 1 - f - x - z + x*z
   alm = x + (-x)*z
   gr = z
   kho = f

 ideal mixing activities
  py = xMgX**3*xAlY**2
  alm = xFeX**3*xAlY**2
  gr = xCaX**3*xAlY**2
  kho = xMgX**3*xFe3Y**2

 non-ideality by van laar
  W(py,alm) = 2.5
  W(py,gr) = 31
  W(py,kho) = 5.4
  W(alm,gr) = 5
  W(alm,kho) = 22.6
  W(gr,kho) = -15.3

  v(py) = 1
  v(alm) = 1
  v(gr) = 2.7
  v(kho) = 1

 "make" end-members
  kho = py - gr + andr + 27  (make)

#
 =================================================================
 olivine: FMS

 Holland, TJB & Powell, R (2011). An improved and
 extended internally consistent thermodynamic dataset
 for phases of petrological interest, involving a
 new equation of state for solids.
 Journal of Metamorphic Geology, 29, 333-383.

  E-m    Formula     Mixing sites
                     M
                     Mg    Fe
 fa      Fe2SiO4     0     2
 fo      Mg2SiO4     2     0

 x -> xFeM
 --------------------------------------------------
#

 starting guesses
  x(ol) = 0.15000  range 0 <> 1

 labels (assign first label for which condition is true)
  olivine : ol : true
  
 site fractions
   xMgM = 1 - x
   xFeM = x

 proportions
   fo = 1 - x
   fa = x

 ideal mixing activities
  fo = xMgM**2
  fa = xFeM**2

 non-ideality by symmetric formalism
  W(fo,fa) = 9

#
 =================================================================
 ternary feldspar, 4TR model, with plagioclase-friendly
         parameterisation.

 Holland, TJB, Green, ECR & Powell, R (2021). A thermodynamic model
 for feldspars in KAlSi3O8-NaAlSi3O8-CaAl2Si2O8 for mineral
 equilibrium calculations. Journal of Metamorphic Geology, 1-14.
 Published online as DOI 10.1111/jmg.12639

 E-m   Formula        Mixing sites
                      A                   TB*
                      Na    Ca    K       Al    Si
 ab    NaAlSi3O8      1     0     0       1     3
 san   KAlSi3O8       0     0     1       1     3
 an    CaAl2Si2O8     0     1     0       2     2
 *use 1/4 entropy of mixing from TB-sites

 ca -> xCaA
 k -> xKA
 -------------------------------------------------
#

 starting guesses
  ca(pl4tr) = 0.80000  range 0 <> 1
  k(pl4tr) = 0.030000  range 0 <> 1

 labels (assign first label for which condition is true)
  feldspar : fdp : true
  
 site fractions
   xNaA = 1 - ca - k
   xCaA = ca
   xKA = k
   xAlTB = 1/4 + 1/4*ca
   xSiTB = 3/4 - 1/4*ca

 proportions
   ab = 1 - k - ca
   an = ca
   san = k

 ideal mixing activities
  ab = 1.7548*xNaA*xAlTB**(1/4)*xSiTB**(3/4)
  an = 2*xCaA*xAlTB**(1/2)*xSiTB**(1/2)
  san = 1.7548*xKA*xAlTB**(1/4)*xSiTB**(3/4)

 non-ideality by van laar
  W(ab,an) = 14.6 - 0.00935*T - 0.04*P
  W(ab,san) = 24.1 - 0.00957*T + 0.338*P
  W(an,san) = 48.5 - 0.13*P

  v(ab) = 0.674
  v(an) = 0.55
  v(san) = 1

#
 =================================================================
 Low-albite solid solution, for modelling the peristerite gap in
 metabasites

 Holland, TJB, Green, ECR & Powell, R (2021). A thermodynamic model
 for feldspars in KAlSi3O8-NaAlSi3O8-CaAl2Si2O8 for mineral
 equilibrium calculations. Journal of Metamorphic Geology, 1-14.
 Published online as DOI 10.1111/jmg.12639

 E-m   Formula        Mixing sites

         		A
         		NaSi    CaAl
 ab    NaAlSi3O8   	1       0
 an    CaAl2Si2O8  	0       1

 ca -> xCaA

 -------------------------------------------------
#

 starting guesses
  ca(abc) = 0.0010000  range 0 <> 1

 labels (assign first label for which condition is true)
  low-albite : lalb : true
  
 site fractions
   xNaA = 1 - ca
   xCaA = ca

 proportions
   abm = 1 - ca
   anm = ca

 ideal mixing activities
  abm = xNaA
  anm = xCaA

 non-ideality by van laar
  W(abm,anm) = 3.4

  v(abm) = 0.64
  v(anm) = 1

 "make" end-members
  abm = e-ab - 1.746 + 0.002*T  (mod)
  anm = e-an + 10  (mod)

#
 =================================================================
 ternary feldspar, 4TR model, with K-feldspar-friendly
         parameterisation.

 Holland, TJB, Green, ECR & Powell, R (2021). A thermodynamic model
 for feldspars in KAlSi3O8-NaAlSi3O8-CaAl2Si2O8 for mineral
 equilibrium calculations. Journal of Metamorphic Geology, 1-14.
 Published online as DOI 10.1111/jmg.12639

 E-m   Formula        Mixing sites
                      A                   TB*
                      Na    Ca    K       Al    Si
 ab    NaAlSi3O8      1     0     0       1     3
 san   KAlSi3O8       0     0     1       1     3
 an    CaAl2Si2O8     0     1     0       2     2
 *use 1/4 entropy of mixing from TB-sites

 na -> xNaA
 ca -> xCaA
 -------------------------------------------------
#

 starting guesses
  na(k4tr) = 0.030000  range 0 <> 1
  ca(k4tr) = 0.80000  range 0 <> 1

 labels (assign first label for which condition is true)
  feldspar : fdp : true
  
 site fractions
   xNaA = na
   xCaA = ca
   xKA = 1 - na - ca
   xAlTB = 1/4 + 1/4*ca
   xSiTB = 3/4 - 1/4*ca

 proportions
   ab = na
   an = ca
   san = 1 - na - ca

 ideal mixing activities
  ab = 1.7548*xNaA*xAlTB**(1/4)*xSiTB**(3/4)
  an = 2*xCaA*xAlTB**(1/2)*xSiTB**(1/2)
  san = 1.7548*xKA*xAlTB**(1/4)*xSiTB**(3/4)

 non-ideality by van laar
  W(ab,an) = 14.6 - 0.00935*T - 0.04*P
  W(ab,san) = 24.1 - 0.00957*T + 0.338*P
  W(an,san) = 48.5 - 0.13*P

  v(ab) = 0.674
  v(an) = 0.55
  v(san) = 1

#
 ====================================================================
 Spinel: FMATO

 White, RW, Powell, R & Clarke, GL (2002) The interpretation of reaction textures
 in Fe-rich metapelitic granulites of the Musgrave Block, central Australia:
 constraints from mineral equilibria calculations in the system K2O-FeO-MgO-Al2O3-
 SiO2-H2O-TiO2-Fe2O3. Journal of Metamorphic Geology, 20, 41-55.

 E-m  Formula   "Mixing sites" (not true sites)
                M1             M2
                Mg    Fe       Al    Fe3   Ti
 herc FeAl2O4   0     1        2     0     0
 sp   MgAl2O4   1     0        2     0     0
 mt   Fe3O4     0     1        0     2     0
 usp  Fe2TiO4   0     1        0     0     1

 x -> xFe2M/(xMgM1 + xFe2M1)
 y -> xAlM/(xAlM2 + xFe3M2 + 2 xTiM2)
 z -> 2 xTiM/(xAlM2 + xFe3M2 + 2 xTiM2)
 --------------------------------------------------
#

 starting guesses
  x(sp) = 0.90000  range 0 <> 1
  y(sp) = 0.95000  range 0 <> 1
  z(sp) = 0.010000  range 0 <> 1

 labels (assign first label for which condition is true)
  spinel : spn : true
  
 site fractions
   x(Al) = y
   x(Fe3) = 1 - y - z
   x(Ti) = z
   x(Mg) = 1 - x
   x(Fe2) = x

 proportions
   herc = y + (-1 + x)*(1 + z)
   sp = (1 - x)*(1 + z)
   mt = 1 - y - z
   usp = z

 ideal mixing activities
  herc = x(Al)*x(Fe2)
  sp = x(Al)*x(Mg)
  mt = x(Fe3)*x(Fe2)
  usp = x(Ti)*x(Fe2)

 non-ideality by symmetric formalism
  W(herc,sp) = 0
  W(herc,mt) = 18.5
  W(herc,usp) = 27
  W(sp,mt) = 40
  W(sp,usp) = 30
  W(mt,usp) = 0

#
 =================================================================
 Ilmenite: FTO

 White, RW, Powell, R, Holland, TJB & Worley, BA (2000) The effect of TiO2 and
 Fe2O3 on metapelitic assemblages at greenschist and amphibolite facies conditions:
 mineral equilibria calculations in the system K2O-FeO-MgO-Al2O3-SiO2-H2O-TiO2-Fe2O3.
 Journal of Metamorphic Geology, 18, 497-511.

 E-m   Formula    Mixing sites
 		   A            B
Fe2 Ti Fe3   Fe2 Ti Fe3
 oilm  FeTiO3      1   0   0    0   1   0     - ordered ilm
 dilm  FeTiO3     1/2 1/2  0   1/2 1/2  0     - disordered ilm
 dhem  Fe2O3       0   0   1    0   0   1     - disordered hem

 x(ilm) = 1 - xFe3A
 Q(ilm) = x(Fe2,A) - x(Fe2,B)    - order variable
 NOTE: Q(ilm) must have a range of -x to +x
 --------------------------------------------------
#

 starting guesses
  x(ilm) = 0.80000  range 0 <> 1
  Q(ilm) = 0.55000  range -0.99 <> 0.99  order variable

 labels (assign first label for which condition is true)
  magnetite : mt : true
  
 site fractions
   xFe2A = 1/2*x + 1/2*Q
   xTiA = 1/2*x - 1/2*Q
   xFe3A = 1 - x
   xFe2B = 1/2*x - 1/2*Q
   xTiB = 1/2*x + 1/2*Q
   xFe3B = 1 - x

 proportions
   oilm = Q
   dilm = x - Q
   dhem = 1 - x

 ideal mixing activities
  oilm = xFe2A*xTiB
  dilm = 4*xFe2A**(1/2)*xTiA**(1/2)*xFe2B**(1/2)*xTiB**(1/2)
  dhem = xFe3A*xFe3B

 non-ideality by symmetric formalism
  W(oilm,dilm) = 15.6
  W(oilm,dhem) = 26.6
  W(dilm,dhem) = 11

 "make" end-members
  oilm = d-ilm - 13.6075 + 0.009426*T  (od)
  dilm = d-ilm + 1.9928 - 0.0021*T  (od)
  dhem = d-hem

#
 =================================================================
 ilmenite: FMTO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 This model may give implausibly high Mg contents, in which
 case the older, Mg-free model ilm would be preferable.

 coded by axe attack on 14 August 2013

 E-m   Formula    Mixing sites
                  A                         B
                  Fe    Ti    Mg    Fe3     Fe    Ti    Fe3
 oilm  FeTiO3     1     0     0     0       0     1     0     - ordered ilm
 dilm  FeTiO3     1/2   1/2   0     0       1/2   1/2   0     - disordered ilm
 dhem  Fe2O3      0     0     0     1       0     0     1     - disordered hem
 geik  MgTiO3     0     0     1     0       0     1     0

 i -> 1 - xFe3A
 g -> xMgA
 Q -> xFeA - xFeB    - order variable
 -------------------------------------------------
#

 starting guesses
  c(ilmm) = 0.90000  range 0 <> 1
  t(ilmm) = 0.020000  range 0 <> 1
  Q(ilmm) = 0.85000  range 0 <> 1

 labels (assign first label for which condition is true)
  ilmenite : ilm : true
  
 site fractions
   xFeA = -1/2*t + 1/2*c + 1/2*Q
   xTiA = -1/2*t + 1/2*c - 1/2*Q
   xMgA = t
   xFe3A = 1 - c
   xFeB = -1/2*t + 1/2*c - 1/2*Q
   xTiB = 1/2*t + 1/2*c + 1/2*Q
   xFe3B = 1 - c

 proportions
   oilm = Q
   dilm = -t + c - Q
   dhem = 1 - c
   geik = t

 ideal mixing activities
  oilm = xFeA*xTiB
  dilm = 4*xFeA**(1/2)*xTiA**(1/2)*xFeB**(1/2)*xTiB**(1/2)
  dhem = xFe3A*xFe3B
  geik = xMgA*xTiB

 non-ideality by symmetric formalism
  W(oilm,dilm) = 15.6
  W(oilm,dhem) = 26.6
  W(oilm,geik) = 4
  W(dilm,dhem) = 11
  W(dilm,geik) = 4
  W(dhem,geik) = 36

 "make" end-members
  oilm = d-ilm - 13.6075 + 0.009426*T  (od)
  dilm = d-ilm + 1.9928 - 0.0021*T  (od)
  dhem = d-hem

#
 =================================================================
 epidote: CFASHO

 Holland, TJB & Powell, R (2011). An improved and
 extended internally consistent thermodynamic dataset
 for phases of petrological interest, involving a
 new equation of state for solids.
 Journal of Metamorphic Geology, 29, 333-383.

 E-m   Formula                Mixing sites
                             M1       M3
                             Al Fe3   Al Fe3
 cz    Ca2Al3Si3O12(OH)      1   0    1   0
 ep    Ca2FeAl2Si3O12(OH)    1   0    0   1  - ordered end-member
 fep   Ca2Fe2AlSi3O12(OH)    0   1    0   1

 f -> (xFe3M1+xFe3M3)/2
 Q ->  f - xFe3M1   - order variable
 --------------------------------------------------
#

 starting guesses
  f(ep) = 0.10000  range 0 <> 1
  Q(ep) = 0.20000  range 0 <> 0.5  order variable

 labels (assign first label for which condition is true)
  epidote : ep : true
  
 site fractions
   xFeM1 = f - Q
   xAlM1 = 1 - f + Q
   xFeM3 = f + Q
   xAlM3 = 1 - f - Q

 proportions
   cz = 1 - f - Q
   ep = 2Q
   fep = f - Q

 ideal mixing activities
  cz = xAlM1*xAlM3
  ep = xAlM1*xFeM3
  fep = xFeM1*xFeM3

 non-ideality by symmetric formalism
  W(cz,ep) = 1
  W(cz,fep) = 3
  W(ep,fep) = 1

#
 =================================================================
 biotite: KFMASHTO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 coded by axe attack on 14 August 2013

 E-m    Formula                             Mixing sites
                            M3                    M12       T         V
                            Mg  Fe  Fe3 Ti  Al    Mg  Fe    Si  Al    OH  O
 phl   KMg3AlSi3O10(OH)2    1   0   0   0   0     2   0     1   1     2   0
 annm  KFe3AlSi3O10(OH)2    0   1   0   0   0     0   2     1   1     2   0
 obi   KMg2Fe1AlSi3O10(OH)2 0   1   0   0   0     2   0     1   1     2   0  - ordered intermediate
 east  KMg2Al3Si2O10(OH)2   0   0   0   0   1     2   0     0   2     2   0
 tbi   KMg2AlSi3TiO12       0   0   0   1   0     2   0     1   1     0   2
 fbi   KMg2Al2FeSi2O10(OH)2 0   0   1   0   0     2   0     0   2     2   0

 x -> (2 xFeM12 + xFeM3)/(2 xFeM12 + xFeM3 + 2 xMgM12 + xMgM3)
 y -> xAlM3
 f -> xFe3M3
 t -> xTiM3
 Q -> 3 (x - xFeM12)  - order variable
 -------------------------------------------------
#

 starting guesses
  x(bi) = 0.35000  range 0 <> 1
  y(bi) = 0.25000  range 0 <> 1
  f(bi) = 0.040000  range 0 <> 1
  t(bi) = 0.17000  range 0 <> 1
  Q(bi) = 0.25000  range 0 <> 1

 labels (assign first label for which condition is true)
  biotite : bi : true
  
 site fractions
   xMgM3 = 1 - f - t - x - y - 2/3*Q + f*x + t*x + x*y
   xFeM3 = x + 2/3*Q + (-f)*x + (-t)*x + (-x)*y
   xFe3M3 = f
   xTiM3 = t
   xAlM3 = y
   xMgM12 = 1 + 1/3*Q - x
   xFeM12 = -1/3*Q + x
   xSiT = 1/2 - 1/2*f - 1/2*y
   xAlT = 1/2 + 1/2*f + 1/2*y
   xOHV = 1 - t
   xOV = t

 proportions
   phl = 1 - f - t - x - y - 2/3*Q + f*x + t*x + x*y
   annm = -1/3*Q + x
   obi = Q + (-f)*x + (-t)*x + (-x)*y
   east = y
   tbi = t
   fbi = f

 ideal mixing activities
  phl = 4*xMgM3*xMgM12**2*xSiT*xAlT*xOHV**2
  annm = 4*xFeM3*xFeM12**2*xSiT*xAlT*xOHV**2
  obi = 4*xFeM3*xMgM12**2*xSiT*xAlT*xOHV**2
  east = xAlM3*xMgM12**2*xAlT**2*xOHV**2
  tbi = 4*xTiM3*xMgM12**2*xSiT*xAlT*xOV**2
  fbi = xFe3M3*xMgM12**2*xAlT**2*xOHV**2

 non-ideality by symmetric formalism
  W(phl,annm) = 12
  W(phl,obi) = 4
  W(phl,east) = 10
  W(phl,tbi) = 30
  W(phl,fbi) = 8
  W(annm,obi) = 8
  W(annm,east) = 15
  W(annm,tbi) = 32
  W(annm,fbi) = 13.6
  W(obi,east) = 7
  W(obi,tbi) = 24
  W(obi,fbi) = 5.6
  W(east,tbi) = 40
  W(east,fbi) = 1
  W(tbi,fbi) = 40

 "make" end-members
  annm = ann - 3  (mod)
  obi = 1/3 ann + 2/3 phl - 3  (od)
  tbi = phl - br + ru + 55  (make)
  fbi = east - 1/2 gr + 1/2 andr - 3  (make)

#
 =================================================================
 muscovite: NCKFMASHO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 !!!! delG(tran) for mat end-member changed from 6.5 to 5.0 since publication !!!!

 coded by axe attack on 14 August 2013


  E-m    Formula                                    Mixing sites
                             A                   M2A                 M2B           T1
                             K     Na    Ca      Mg    Fe    Al      Al    Fe3     Si    Al
  mu    KAl3Si3O12(OH)2      1     0     0       0     0     1       1     0       1     1
  cel   KMgAlSi4O10(OH)2     1     0     0       1     0     0       1     0       2     0
  fcel  KFeAlSi4O10(OH)2     1     0     0       0     1     0       1     0       2     0
  pa    NaAl3Si3O10(OH)2     0     1     0       0     0     1       1     0       1     1
  mam   CaAl4Si2O10(OH)2     0     0     1       0     0     1       1     0       0     2
  fmu   KAl2FeSi3O12(OH)2    1     0     0       0     0     1       0     1       1     1

 x -> xFeM2A/(xFeM2A + xMgM2A)
 y -> xAlM2A
 f -> xFe3M2B
 n -> xNaA
 c -> xCaA
 --------------------------------------------------
#

 starting guesses
  x(mu) = 0.25000  range 0 <> 1
  y(mu) = 0.60000  range 0 <> 1
  f(mu) = 0.17000  range 0 <> 1
  n(mu) = 0.060000  range 0 <> 1
  c(mu) = 0.0040000  range 0 <> 1

 labels (assign first label for which condition is true)
  muscovite : ms : true
  
 site fractions
   xKA = 1 - c - n
   xNaA = n
   xCaA = c
   xMgM2A = 1 - x - y + x*y
   xFeM2A = x + (-x)*y
   xAlM2A = y
   xAlM2B = 1 - f
   xFe3M2B = f
   xSiT1 = 1 - 1/2*c - 1/2*y
   xAlT1 = 1/2*c + 1/2*y

 proportions
   mu = -c - f - n + y
   cel = 1 - x - y + x*y
   fcel = x + (-x)*y
   pa = n
   mam = c
   fmu = f

 ideal mixing activities
  mu = 4*xKA*xAlM2A*xAlM2B*xSiT1*xAlT1
  cel = xKA*xMgM2A*xAlM2B*xSiT1**2
  fcel = xKA*xFeM2A*xAlM2B*xSiT1**2
  pa = 4*xNaA*xAlM2A*xAlM2B*xSiT1*xAlT1
  mam = xCaA*xAlM2A*xAlM2B*xAlT1**2
  fmu = 4*xKA*xAlM2A*xFe3M2B*xSiT1*xAlT1

 non-ideality by van laar
  W(mu,cel) = 0 + 0.2*P
  W(mu,fcel) = 0 + 0.2*P
  W(mu,pa) = 10.12 + 0.0034*T + 0.353*P
  W(mu,mam) = 35
  W(mu,fmu) = 0
  W(cel,fcel) = 0
  W(cel,pa) = 45 + 0.25*P
  W(cel,mam) = 50
  W(cel,fmu) = 0
  W(fcel,pa) = 45 + 0.25*P
  W(fcel,mam) = 50
  W(fcel,fmu) = 0
  W(pa,mam) = 15
  W(pa,fmu) = 30
  W(mam,fmu) = 35

  v(mu) = 0.63
  v(cel) = 0.63
  v(fcel) = 0.63
  v(pa) = 0.37
  v(mam) = 0.63
  v(fmu) = 0.63

 "make" end-members
  mam = ma + 5  (mod)
  fmu = 1/2 andr - 1/2 gr + mu + 25  (make)

#
 =================================================================
 chlorite: FMASHO

 White, RW, Powell, R, Holland, TJB, Johnson, TE &
 Green, ECR (2014). New mineral activity-composition relations
 for thermodynamic calculations in metapelitic systems.
 Journal of Metamorphic Geology, 32, 261-286.

 coded by axe attack on 14 August 2013

  E-m    Formula                                    Mixing sites
                             M1            M23       M4                  T2
                             Mg  Fe  Al    Mg  Fe    Mg  Fe  Fe3 Al    Si  Al
 clin    Mg5Al2Si3O10(OH)8   1   0   0     4   0     0   0   0   1     1   1
 afchl   Mg6Si4O10(OH)8      1   0   0     4   0     1   0   0   0     2   0
 ames    Mg4Al4Si2O10(OH)8   0   0   1     4   0     0   0   0   1     0   2
 daph    Fe5Al2Si3O10(OH)8   0   1   0     0   4     0   0   0   1     1   1
 ochl1   Fe5MgSi4O10(OH)8    1   0   0     0   4     0   1   0   0     2   0    - ordered intermediate
 ochl4   FeMg5Si4O10(OH)8    0   1   0     4   0     1   0   0   0     2   0    - ordered intermediate
 f3clin  Mg5AlFeSi3O10(OH)8  1   0   0     4   0     0   0   1   0     1   1

 x -> (xFeM1 + 4 xFeM23 + xFeM4)/(xFeM1 + 4 xFeM23 + xFeM4 + xMgM1 + 4 xMgM23 + xMgM4)
 y -> (xAlM1 + xAlM4)/2
 f -> xFe3M4
 QAl -> (xAlM4 - xAlM1)/2                 - order variable
 Q1 -> x - xFeM1/(xFeM1 + xMgM1)          - order variable
 Q4 -> x - xFeM4/(xFeM4 + xMgM4)          - order variable
 -------------------------------------------------
#

 starting guesses
  x(chl) = 0.30000  range 0 <> 1
  y(chl) = 0.55000  range 0 <> 1
  f(chl) = 0.050000  range 0 <> 1
  QAl(chl) = 0.42000  range -1 <> 1  order variable
  Q1(chl) = -0.18000  range -1 <> 1  order variable
  Q4(chl) = -0.26000  range -1 <> 1  order variable

 labels (assign first label for which condition is true)
  chlorite : chl : true
  
 site fractions
   xMgM1 = 1 + Q1 + QAl - x - y + Q1*QAl + (-QAl)*x + (-Q1)*y + x*y
   xFeM1 = -Q1 + x + (-Q1)*QAl + QAl*x + Q1*y + (-x)*y
   xAlM1 = -QAl + y
   xMgM23 = 1 - 1/4*Q1 - 1/4*Q4 - x + 1/4*f*Q4 + (-1/4*Q1)*QAl + 1/4*Q4*QAl + 1/4*Q1*y + 1/4*Q4*y
   xFeM23 = 1/4*Q1 + 1/4*Q4 + x + (-1/4*f)*Q4 + 1/4*Q1*QAl + (-1/4*Q4)*QAl + (-1/4*Q1)*y + (-1/4*Q4)*y
   xMgM4 = 1 - f + Q4 - QAl - x - y + (-f)*Q4 + (-Q4)*QAl + f*x + QAl*x + (-Q4)*y + x*y
   xFeM4 = -Q4 + x + f*Q4 + Q4*QAl + (-f)*x + (-QAl)*x + Q4*y + (-x)*y
   xFe3M4 = f
   xAlM4 = QAl + y
   xSiT2 = 1 - 1/2*f - y
   xAlT2 = 1/2*f + y

 proportions
   clin = -1/4*Q1 + 2QAl - 5/4*Q4 + 5/4*f*Q4 + (-1/4*Q1)*QAl + 5/4*Q4*QAl + (-f)*x + (-QAl)*x + 1/4*Q1*y + 5/4*Q4*y + (-x)*y
   afchl = 1 - f - QAl - y - 2x + 5/4*Q1 + 9/4*Q4 + (-9/4*f)*Q4 + 5/4*Q1*QAl + (-9/4*Q4)*QAl + 2f*x + QAl*x + (-5/4*Q1)*y + (-9/4*Q4)*y + 3x*y
   ames = -QAl + y
   daph = 1/4*Q1 + 5/4*Q4 + (-5/4*f)*Q4 + 1/4*Q1*QAl + (-5/4*Q4)*QAl + f*x + QAl*x + (-1/4*Q1)*y + (-5/4*Q4)*y + x*y
   ochl1 = -Q4 + x + f*Q4 + Q4*QAl + (-f)*x + (-QAl)*x + Q4*y + (-x)*y
   ochl4 = x - 5/4*Q1 - 5/4*Q4 + 5/4*f*Q4 + (-5/4*Q1)*QAl + 5/4*Q4*QAl + (-f)*x + 5/4*Q1*y + 5/4*Q4*y + (-2x)*y
   f3clin = f

 ideal mixing activities
  clin = 4*xMgM1*xMgM23**4*xAlM4*xSiT2*xAlT2
  afchl = xMgM1*xMgM23**4*xMgM4*xSiT2**2
  ames = xAlM1*xMgM23**4*xAlM4*xAlT2**2
  daph = 4*xFeM1*xFeM23**4*xAlM4*xSiT2*xAlT2
  ochl1 = xMgM1*xFeM23**4*xFeM4*xSiT2**2
  ochl4 = xFeM1*xMgM23**4*xMgM4*xSiT2**2
  f3clin = 4*xMgM1*xMgM23**4*xFe3M4*xSiT2*xAlT2

 non-ideality by symmetric formalism
  W(clin,afchl) = 17
  W(clin,ames) = 17
  W(clin,daph) = 20
  W(clin,ochl1) = 30
  W(clin,ochl4) = 21
  W(clin,f3clin) = 2
  W(afchl,ames) = 16
  W(afchl,daph) = 37
  W(afchl,ochl1) = 20
  W(afchl,ochl4) = 4
  W(afchl,f3clin) = 15
  W(ames,daph) = 30
  W(ames,ochl1) = 29
  W(ames,ochl4) = 13
  W(ames,f3clin) = 19
  W(daph,ochl1) = 18
  W(daph,ochl4) = 33
  W(daph,f3clin) = 22
  W(ochl1,ochl4) = 24
  W(ochl1,f3clin) = 28.6
  W(ochl4,f3clin) = 19

 "make" end-members
  ochl1 = afchl - clin + daph + 3  (od)
  ochl4 = afchl - 1/5 clin + 1/5 daph + 2.4  (od)
  f3clin = clin - 1/2 gr + 1/2 andr + 2  (make)

