This is an old revision of the document!

# Refining/Setting Weight Percents directly

### Version 5

The macro Known_Weight_Percent can be used to either set a weight percent or to refine a weight percent. For example:

``` str...
' scale parameter must not be defined for this phase
Known_Weight_Percent(10) ' set weight percent to 10```

To refine the weight percent then the following could be used:

``` str...
prm wt1 10 min 0 max 100
Known_Weight_Percent(wt1)```

Only one phase can have its weight percentage set by this macro. All remaining phases must have a scale factor.

### Version 4.1

Symbols used here are defined in the Technical Reference entry for [cell_mass !E] [cell_volume !E] [weight_percent !E]

Ignoring the Brindley correction we can write

` Sp = Q_sum  wp / (Mp Vp (1 – wp))`

where Qsum is Qp as written in the manual except that Sp Mp Vp is excluded.

Thus if you had four phases and you knew the weight percents w1, w2, w3, w4 then you could write:

``` s1 = (s2 m2 + s3 m3 + s4 m4) w1 / (m1 (1 - w1))
s2 = (s1 m1 + s3 m3 + s4 m4) w2 / (m2 (1 - w2))
s3 = (s1 m1 + s2 m2 + s4 m4) w3 / (m3 (1 - w3))
s4 = (s1 m1 + s2 m2 + s3 m3) w4 / (m4 (1 - w4))```

where

``` m1 = M1 V1
m2 = M2 V2
m3 = M3 V3
m4 = M4 V4```

simplifying:

``` s1 = s2 m2 x1 + s3 m3 x1 + s4 m4 x1
s2 = s1 m1 x2 + s3 m3 x2 + s4 m4 x2
s3 = s1 m1 x3 + s2 m2 x3 + s4 m4 x3
s4 = s1 m1 x4 + s2 m2 x4 + s3 m3 x4```

where

``` x1 = w1 / (m1 (1 - w1))
x2 = w2 / (m2 (1 - w2))
x3 = w3 / (m3 (1 - w3))
x4 = w4 / (m4 (1 - w4))                                  ```

We need to solve the four equations for three of the scale parameters. We will choose to solve for s1, s2 and s3.

s4 will be refined.

Substitute s2 into equation s1:

` s1 = (s1 m1 x2 + s3 m3 x2 + s4 m4 x2) m2 x1 + s3 m3 x1 + s4 m4 x1`

or,

` s1 = (s3 (m3 x2 m2 x1 + m3 x1) + s4 (m4 x2 m2 x1 + m4 x1)) / (1 - m1 x2 m2 x1)`

Let

``` t13 = (m3 x2 m2 x1 + m3 x1) / (1 - m1 x2 m2 x1)
t14 = (m4 x2 m2 x1 + m4 x1) / (1 - m1 x2 m2 x1)```

or,

` s1 = s3 t13 + s4 t14                                                        `

Substitute s2 into equation s3:

` s3 = s1 (m1 x3 + m1 x2 m2 x3) + s3 m3 x2 m2 x3 + s4 (m4 x2 m2 x3 + m4 x3)`

or,

` s3 = (s1 (m1 x3 + m1 x2 m2 x3) + s4 (m4 x2 m2 x3 + m4 x3)) / (1 - m3 x2 m2 x3)`

Let

``` t31 = (m1 x3 + m1 x2 m2 x3) / (1 - m3 x2 m2 x3)
t34 = (m4 x2 m2 x3 + m4 x3) / (1 - m3 x2 m2 x3)```

or,

` s3 = s1 t31 + s4 t34                                                        `

Substituting s1 into s3 we get:

` s3 = s3 t13 t31 + s4 t14 t31 + s4 t34`

or,

` s3 = s4 (t14 t31 + t34) / (1 - t13 t31)`

Then we set s4 to a starting refinement value and then calculate s1, s2 and s3 using the above equations, ie.

``` s3 = s4 (t14 t31 + t34) / (1 - t13 t31)
s1 = s3 t13 + s4 t14
s2 = s1 m1 x2 + s3 m3 x2 + s4 m4 x2```

Refining on s4 works well and the weight percents are kept to their known values. Similar equations can be written for three phases etc…

Below is and INP file ZRO2-WT.INP (with data file ZRO2.DAT) that shows the above working nicely on Zro2. It uses the helper macro wt_dets to hide some of the details. At the top of the file we see:

```prm s4  0.01 min 1.0e-12  ' REFINABLE
prm w1  5 min 1.0e-6	' Refine of fix depending on prior knowledge
prm w2  2 min 1.0e-6	' Refine of fix depending on prior knowledge
prm w3  2 min 1.0e-6	' Refine of fix depending on prior knowledge```

If all of the weight percents were known then the three weight percents should be fixed to their known values. Here's the ZRO2-WT.INP

```macro wt_dets(n)
{
prm m##n = Get(cell_mass) Get(cell_volume);
prm x##n = w##n / (m##n (100 - w##n));
scale = s##n;
}

r_wp  0

prm !t13 = (m3 x2 m2 x1 + x1 m3) / (1 - m1 x2 m2 x1);
prm !t14 = (m4 x2 m2 x1 + x1 m4) / (1 - m1 x2 m2 x1);
prm !t31 = (m1 x2 m2 x3 + x3 m1) / (1 - m3 x2 m2 x3);
prm !t34 = (m4 x2 m2 x3 + x3 m4) / (1 - m3 x2 m2 x3);

prm s1 = s3 t13 + s4 t14;
prm s2 = s1 m1 x2 + s3 m3 x2 + s4 m4 x2;
prm s3 = s4 (t14 t31 + t34) / (1 - t13 t31);

prm s4  0.01 min 1.0e-12         ' REFINABLE

prm w1  5 min 1.0e-6  ' Refine of fix depending on prior knowledge
prm w2  2 min 1.0e-6  ' Refine of fix depending on prior knowledge
prm w3  2 min 1.0e-6  ' Refine of fix depending on prior knowledge
prm w4 = 100 - w1 - w2 - w3; : 0

DAT(zro2)
CuKa2(0.001)
LP_Factor(17)
Divergence(1)
Slit_Width(0.4)
Full_Axial_Model(12, 20, 12, 2.3, @ 10)
ZE(@, 0)
bkg @  0 0 0 0

STR(I_41/A_M_D:2, Zircon)
Tetragonal(6.6020, 5.97960)
site Zr    x 0   y =3/4;  z =1/8;    occ Zr 1   beq 1
site Si    x 0   y =1/4;  z =3/8;    occ Si 1   beq 1
site O     x 0   y 0.066  z 0.1951   occ O  1   beq 2
CS_L(500)
MVW( 733.228, 260.629261, 0.675`)

wt_dets(1)

STR(P_42/N_M_C_S, "Zr O2")
Tetragonal(@ 3.60, @ 5.17)
site Zr    x 0 y 0      z 0        occ Zr+4 0.95 beq 0.5
occ Y+3  0.05 beq 0.5
site O     x 0 y 0.5    z 0.20514  occ O-2   1   beq 1
Strain_L(@, .1)
Strain_G(@, .1)
MVW( 0, 0, 0)

wt_dets(2)

STR(F_M_-3_M, "Cubic Zirconia")
Cubic(@ 5.13)
site Zr    x 0        y 0      z 0        occ Zr 0.85  beq  1
occ Y  0.15  beq  1
site O     x 0.25     y 0.25   z 0.25     occ O  0.962 beq  2
Strain_G(@, .1)
MVW( 0, 0, 0)

wt_dets(3)

STR(R_-3_c, "Corundum Al2 O3")
Trigonal(@ 4.75, @  12.99)
site Al  x 0       y 0 z 0.35218 occ AL+3 1 beq  0.3366
site O   x 0.30665 y 0 z 0.25000 occ O-2  1 beq  0.3879
CS_L(500)
MVW( 0, 0, 0)

wt_dets(4)```

Alan Coelho 2011/08/25 19:09

Weights can be restrained using:

```'---------------------------
'Example of restraining weight percent to a known value
penalties_weighting_K1 .2
restraint = (Cubic_Zirconia_wt_percent - 36); : 0
'---------------------------```