Author Topic: Specifying Unanalyzed Elements For a Proper Matrix Correction  (Read 18722 times)

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #30 on: June 27, 2015, 10:46:26 pm »
Hi Julien,
Thanks for looking at this. This thread is getting way long, but my calculation code is in this post:

http://probesoftware.com/smf/index.php?topic=92.msg2950#msg2950

I'm pleased to fix anything that isn't right but I don't see anything wrong with the existing calculation for carbon by stoichiometry to calculated oxygen.  As I said previously, the CO3 by difference option is probably what you guys are looking for if you need to maintain an exact C:O ratio regardless of the analysis quality.
john
« Last Edit: June 28, 2015, 09:40:00 am by Probeman »
The only stupid question is the one not asked!

Gseward

  • Global Moderator
  • Professor
  • *****
  • Posts: 128
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #31 on: June 28, 2015, 08:41:21 am »
CO3 by difference does not maintain stoichiometry with cations. This is also desired.

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #32 on: June 28, 2015, 09:52:36 am »
CO3 by difference does not maintain stoichiometry with cations. This is also desired.

Hi Gareth,
Yes, it is not a perfect world!

I am about to post something that I hope helps everyone.
john
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #33 on: June 28, 2015, 11:29:58 am »
Question to John: HOW do you recalculate the CO2 in weight-%? I guess, you run the C (or CO2) wt-% content through the matrix correction, right? But you also need to perform a conversion in atomic proportion to recalculate the C (or CO2) content, right? Maybe posting (or sending to me by email) your VB code might help me understanding where the error could be... Otherwise, you can also look at my spreadsheet to assess how this should be done?

Hi Julien,
In addition to the code posted above I can add the following comments:

1. The oxygen calculated by stoichiometry to the measured cations is added to the matrix correction as a concentration. Likewise, the carbon calculated by stoichiometry to oxygen is also added to the matrix correction as the code above shows as a concentration also.

2. This calculation is iterated because as the concentrations of the cations change, due to the (relatively minor) matrix effect of adding oxygen and carbon, the oxygen and carbon by calculation also are changed as they should.

3. Note that all concentrations are normalized to 100% during the matrix iteration to assist in the matrix correction calculation.  If this was not done, some measurements would never converge!

4. Once the matrix iteration converges, the concentration are de-normalized to the actual concentration total and the program then hands off the concentrations to the output routines which convert the concentrations to oxides, formula atoms, etc., if specified by the user.

But please realize the original title of this topic. It is about including unanalyzed elements in the matrix correction so the matrix correction is properly calculated!  The code we are discussing is *not* an effort to determine the actual oxygen and carbon concentrations, it is merely to aid in the calculation of the matrix physics!

For example, here is the calculation with the oxygen and carbon specified by calculation as we have been discussing (oxygen by cation stoichiometry and carbon calculated by stocihiometry to calculated oxygen):

St  143 Set   1 Kutnahorite (Harvard #85670), Results in Elemental Weight Percents
 
ELEM:       Ca      Mn      Fe      Mg       P       C       O
TYPE:     ANAL    ANAL    ANAL    ANAL    ANAL    STOI    CALC
BGDS:      LIN     LIN     LIN     LIN     LIN
TIME:    10.00   10.00   10.00   10.00   10.00     ---     ---
BEAM:    30.00   30.00   30.00   30.00   30.00     ---     ---

ELEM:       Ca      Mn      Fe      Mg       P       C       O   SUM 
     9  19.706  22.024    .382   1.385    .021  11.335  45.527 100.381
    10  19.823  21.698    .401   1.377    .016  11.356  45.527 100.198
    11  19.588  21.855    .321   1.278   -.008  11.368  45.391  99.793
    12  19.740  21.961    .363   1.423    .032  11.341  45.569 100.428

AVER:   19.714  21.884    .367   1.365    .015  11.350  45.503 100.200
SDEV:     .097    .143    .034    .062    .017    .015    .077    .289
SERR:     .049    .071    .017    .031    .009    .007    .039
%RSD:      .49     .65    9.30    4.53  112.08     .13     .17

PUBL:   19.612  21.925    .389   1.333    n.a.  11.408  45.594 100.261
%VAR:      .52    -.18   -5.70    2.43     ---    -.51    -.20
DIFF:     .102   -.041   -.022    .032     ---   -.058   -.091
STDS:      138     140     145     139     285     ---     ---

STKF:    .3789   .3969   .4258   .1957   .1601     ---     ---
STCT:   125.64  132.04  141.39   64.55   53.31     ---     ---

UNKF:    .1930   .1843   .0031   .0077   .0001     ---     ---
UNCT:    63.99   61.31    1.04    2.53     .04     ---     ---
UNBG:     1.04    1.44    1.43     .47     .76     ---     ---

ZCOR:   1.0216  1.1873  1.1669  1.7822  1.1889     ---     ---
KRAW:    .5093   .4644   .0074   .0392   .0008     ---     ---
PKBG:    62.65   43.58    1.74    6.38    1.06     ---     ---

St  143 Set   1 Kutnahorite (Harvard #85670), Results Based on 1 Atoms of c

ELEM:       Ca      Mn      Fe      Mg       P       C       O   SUM 
     9    .521    .425    .007    .060    .001   1.000   3.015   5.029
    10    .523    .418    .008    .060    .001   1.000   3.010   5.018
    11    .516    .420    .006    .056    .000   1.000   2.997   4.995
    12    .522    .423    .007    .062    .001   1.000   3.016   5.031

AVER:     .521    .422    .007    .059    .001   1.000   3.010   5.019
SDEV:     .003    .003    .001    .003    .001    .000    .009    .016
SERR:     .001    .002    .000    .001    .000    .000    .004
%RSD:      .56     .75    9.36    4.64  112.00     .00     .29

Yes, I agree the carbon to oxygen ratio is off by around 0.3 % as Andrew points out and this *is* as he says because the total is not exactly 100%. But we are only including carbon and oxygen to help with the matrix correction accuracy! For example:

Here is the same kutnahorite analysis average exported to CalcZAF (you will see in a moment why I do this, but CalcZAF uses exactly the same code as PFE) as we have been doing, that is oxygen by stocihiometry and carbon by stoichiometry to calculated oxygen and again the C:O ratio is off by 0.3% as we saw in PFE:

ELEMENT   K-RAW K-VALUE ELEMWT% OXIDWT% ATOMIC% FORMULA KILOVOL                                       
   Ca ka  .50929  .19297  19.714  27.584  10.372    .521   15.00                                       
   Mn ka  .46436  .18432  21.885  28.258   8.400    .422   15.00                                       
   Fe ka  .00738  .00314    .367    .472    .139    .007   15.00                                       
   Mg ka  .03916  .00766   1.365   2.264   1.185    .059   15.00                                       
   P  ka  .00080  .00013    .015    .035    .010    .001   15.00                                       
   C                      11.350  41.587  19.925   1.000
   O                        .000    .000    .000    .000
   O                      45.505   -----  59.970   3.010
   TOTAL:                100.201 100.201 100.000   5.019

Now, because I will be removing the carbon and oxygen from the matrix correction in the calculations below, I will normalize to Ca instead of carbon as seen here:

ELEMENT  ABSCOR  FLUCOR  ZEDCOR  ZAFCOR STP-POW BKS-COR   F(x)u      Ec   Eo/Ec    MACs
   Ca ka  1.0023   .9832  1.0366  1.0216  1.0812   .9588   .9607  4.0390  3.7138 153.893
   Mn ka  1.0071   .9999  1.1791  1.1873  1.2431   .9486   .9757  6.5390  2.2939 108.543
   Fe ka  1.0039  1.0000  1.1624  1.1669  1.2251   .9488   .9808  7.1120  2.1091 89.0408
   Mg ka  1.7946   .9992   .9939  1.7822   .9848  1.0092   .4828  1.3050 11.4943 2855.99
   P  ka  1.1561   .9933  1.0353  1.1889  1.0493   .9867   .7943  2.1460  6.9897 834.429

 ELEMENT   K-RAW K-VALUE ELEMWT% OXIDWT% ATOMIC% FORMULA KILOVOL                                       
   Ca ka  .50929  .19297  19.714  27.584  10.372   1.000   15.00                                       
   Mn ka  .46436  .18432  21.885  28.258   8.400    .810   15.00                                       
   Fe ka  .00738  .00314    .367    .472    .139    .013   15.00                                       
   Mg ka  .03916  .00766   1.365   2.264   1.185    .114   15.00                                       
   P  ka  .00080  .00013    .015    .035    .010    .001   15.00                                       
   C                      11.350  41.587  19.925   1.921
   O                        .000    .000    .000    .000
   O                      45.505   -----  59.970   5.782
   TOTAL:                100.201 100.201 100.000   9.642

Now what if we *did not* include the oxygen and carbon by calculation in the matrix correction physics?  Here is what we would get:

ELEMENT  ABSCOR  FLUCOR  ZEDCOR  ZAFCOR STP-POW BKS-COR   F(x)u      Ec   Eo/Ec    MACs
   Ca ka  1.0195   .9767   .9474   .9434   .9345  1.0138   .9445  4.0390  3.7138 87.6428
   Mn ka  1.0326   .9998  1.0646  1.0992  1.0791   .9866   .9516  6.5390  2.2939 87.4901
   Fe ka  1.0242  1.0000  1.0468  1.0721  1.0645   .9834   .9613  7.1120  2.1091 72.0165
   Mg ka  2.0852   .9985   .9141  1.9032   .8450  1.0817   .4155  1.3050 11.4943 1453.98
   P  ka  1.2480   .9882   .9539  1.1763   .9028  1.0565   .7358  2.1460  6.9897 454.843

 ELEMENT   K-RAW K-VALUE ELEMWT% OXIDWT% ATOMIC% FORMULA KILOVOL                                       
   Ca ka  .50929  .19297  18.204   -----  51.063   1.000   15.00                                       
   Mn ka  .46436  .18432  20.260   -----  41.459    .812   15.00                                       
   Fe ka  .00738  .00314    .337   -----    .678    .013   15.00                                       
   Mg ka  .03916  .00766   1.458   -----   6.744    .132   15.00                                       
   P  ka  .00080  .00013    .015   -----    .055    .001   15.00                                       
   C                        .000   -----    .000    .000
   O                        .000   -----    .000    .000
   TOTAL:                 40.275   ----- 100.000   1.958

First note that the matrix corrections are different (see Ca in red). That is to say *wrong* because we did not have carbon and oxygen in the matrix for calculating the proper physics.  That is after all the entire point of this topic.  Yes, it's small difference for Mn, but it's worth doing.

In the case of Mg, the difference is *not* so small, because this is a low energy element and more affected by the matrix physics. So, the additional of carbon and oxygen to the calculation makes a significant improvement to accuracy of the measured elements, which is the whole point.

So we are adding the oxygen and carbon by stoichiometry to the analysis to improve the matrix correction and it is doing that as expected. Now the C:O ratio gets slightly distorted because of the subsequent formula atom renomalization (carbon and oxygen have different atomic weights) when the total is not exactly 100%. 

But since we are only adding oxygen and carbon to correct the physics, that is the nature of this beast! My best advice is, if you want the C:O ratio exactly 3, then you should utilize the CO3 formula by difference option.  In either case the difference to the matrix correction physics is negligible.

I have to run off for the day, but I will return later and add some additional thoughts.
« Last Edit: June 28, 2015, 11:36:09 am by Probeman »
The only stupid question is the one not asked!

AndrewLocock

  • Professor
  • ****
  • Posts: 61
    • University of Alberta Electron Microprobe Laboratory
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #34 on: June 28, 2015, 03:42:41 pm »
Hi John,

Let me emphasize that I agree with John Fournelle that PfE generates the best carbonate analyses. And also, that I agree with you: C and O should be included in the matrix corrections to improve the accuracy of the measured elements.

However, the results that I am obtaining are not in actual stoichiometric proportion; they are just close to it. This is a problem for me (as I like to make a quick judgement of the quality of an analysis by its total), and for my users (relying on the reported CO2 concentrations, or C and O concentrations).

I ran some analyses of a calcite from an unknown locality using the Smithsonian calcite standard (which is published to have 56.10 wt% CaO = 40.09 wt% Ca), at 15 kV, 10 nA, 5 micron beam diameter, with count times of 30 s on peak, 15 s on each background, JEOL 8900R. The mdb file is attached for your interest.

Probe for EPMA has several calculation options. It is instructive to compare them for a given analytical point (my #24):

Calculate as Elemental: gives Ca 37.44, C 0, O 0, total 37.44 wt%.

Calculate with Stoichiometric Oxygen: gives Ca 38.39, C0, O 15.33, total 53.72 wt%.
(Note that Ca and O are in a perfect stoichiometric ratio of 1:1, specifically 0.9579 mol Ca and 0.9579 mol O).

Calculate with Stoichiometric Oxygen; Stoichiometry to Calculated Oxygen 0.3333333 C to 1 O: gives Ca 39.57, C 12.04, O 47.87, total 99.48 wt%. (Note that the elements are not in the stoichiometric proportion of 1:1:3, rather the molar proportions here are 0.9873 Ca, 1.0024 C, and 2.9921 O).

It appears that including O-by-stoichiometry improves the result for Ca, and is reported in stoichiometric proportion. Including both C and O further improves the result for Ca, but is not reported in stoichiometric proportion. It is not clear to me why stoichiometry is maintained in the first case, but not the second.

Perhaps, after the matrix corrections are completed, PfE should recalculate the mass fractions of C and O to be in stoichiometric agreement with the analyzed elements?            

I should point out two problems that I observed in analyzing calcite with PfE and using the Stoichiometry to Calculated Oxygen option. Firstly, the C concentration reported by PfE is negatively correlated with the Ca concentration. A series of replicate calcite analyses yields a linear correlation (R^2=1), where low Ca gives high C, and high Ca gives low C. In the worst case, if I radically defocus the sample, and obtain a poor result of Ca 15.42 wt%, the program reports C 15.11 wt% - considerably in excess of what is chemically possible.

Secondly, if I enable the “Use All Matrix Corrections” for analyses calculated with the Stoichiometry to Calculated Oxygen option, all of the results for a given point are reported as virtually identical (differing only in the second decimal point; RSD for Ca circa 0.002%). In contrast, using the Calculate with Stoichiometric Oxygen gives a wide range of results among the different matrix corrections with an RSD for Ca of 2.0%). I cannot see how including C in the matrix corrections should improve their relative agreement by a factor of 1000.

Thanks, Andrew.

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #35 on: June 28, 2015, 04:50:40 pm »
Firstly, the C concentration reported by PfE is negatively correlated with the Ca concentration. A series of replicate calcite analyses yields a linear correlation (R^2=1), where low Ca gives high C, and high Ca gives low C. In the worst case, if I radically defocus the sample, and obtain a poor result of Ca 15.42 wt%, the program reports C 15.11 wt% - considerably in excess of what is chemically possible.

Hi Andrew,
No worries, there's always room for improvement, I just don't see how to get "there" from "here".     :-[

I've attached the CalcZAF/PFE matrix correction calculation code below and if you would be willing to look at it, maybe you can see where I'm going "wrong", but I pretty sure it's not a case of right or wrong, just different ways of getting "there". 

As I've said already, because (with this particular method of calculating unanalyzed elements) I'm calculating relative concentrations from atom stoichiometries in the matrix correction code, and if subsequently the concentrations are then normalized to formula atoms, *and* if the total is isn't exactly 100%, then the relative atoms of the two elements by stoichiometry will be slightly different when they are normalized.  This is inherent in the fact that carbon and oxygen have different atomic weights!

You mentioned that if the beam is defocused and the analysis total is very bad, then the calculated C:O ratio will be very bad also.  I am not surprised. In fact I do not see how the C:O could not be be very bad if the total is very bad, at least for this particular method of calculating by C:O by stoichiometry.  Not to be flip, but that's just: garbage in/garbage out!

Now, everyone (except Gareth) seems to be ignoring my repeated mentioning of the alternative method for calculating C:O ratios and that is formula by difference. This insures that the C:O ratio stays exactly as specified the same no matter what the cation concentrations are. Why? Because the total is always exactly 100%. 

Here is the kutnahorite example I've been using, with the CO3 formula by difference specified for the unanalyzed elements:

ELEMENT   K-RAW K-VALUE ELEMWT% OXIDWT% ATOMIC% FORMULA KILOVOL                                       
   Ca ka  .50929  .19297  19.713   -----  10.399    .521   15.00                                       
   Mn ka  .46436  .18432  21.883   -----   8.422    .422   15.00                                       
   Fe ka  .00738  .00314    .367   -----    .139    .007   15.00                                       
   Mg ka  .03916  .00766   1.365   -----   1.188    .060   15.00                                       
   P  ka  .00080  .00013    .015   -----    .010    .001   15.00                                       
   C                      11.340   -----  19.961   1.000
   O                      45.317   -----  59.882   3.000
   TOTAL:                100.000   ----- 100.000   5.010


1.000 to 3.000 so what's not to like?

Now, if you really want to re-nomalize the results to account for charge balancing (which it sounds like you do), then please send me a carbonate mineral charge balancing code and I will happily implement it in PFE.  This software, in case you didn't already know,  is a community effort to improve the state of microanalysis!   Hence this forum, and hence this protracted discussion...

In the meantime please feel free to examine the matrix correction code I've attached below.
john
« Last Edit: June 28, 2015, 05:11:19 pm by Probeman »
The only stupid question is the one not asked!

Julien

  • Professor
  • ****
  • Posts: 73
  • The truth is out there...
    • Geoloweb - J. Allaz personal website
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #36 on: June 28, 2015, 09:32:25 pm »
John, the idea of getting CO2 by difference won't resolve anything and it is NOT good. I doubt you will get the desired 1:1:3 ratio all the time when calculating CO2 by difference. Calculating the CO2 by stoichiometry also permits to check if the analysis is good (i.e., totals close to 100%). We don't ignore this comment, I guess we just don't like the idea ;)

I agree with Andrew: the best way to do it would be to re-normalize and re-calculate the CO2 wt-% (or C and O wt-%) AFTER the last matrix iteration, when results converged. This is not ideal, as, in normal situation, you would need to re-run the matrix correction with the new value for C and O, but, as you mentioned, this minor change would not affect too strongly the other measured cation wt-%. Again, the whole idea is just to get a perfect ratio of one total measured divalent cation, one carbon atom, and three oxygen (1:1:3).

Of course, the other solution (which I personally apply anyway) is to simply perform a mineral formula recalculation separately using a "home-made" XL spreadsheet. You can't imaging how complicated this normalization can be, with some time special conditions (e.g., fill one site with X amount of atom, another site with Y amount, and sometime a same element can be split in two different "sites" and need additional conditions). I'm not sure if you realize how complicated this can be, and so far there is no universal way to normalize all minerals, and there are often numerous ways to perform this type of calculation. For carbonate it is relatively easy, but deal once with amphibole (including F, Cl and unanalyzed OH or O2-) or allanite (REE-epidote, also with OH), and you will loose all your hairs!

Still, if you want to incorporate a carbonate normalization process AND "proper" recalculation of CO2 wt-% by stoichiometry, please, see my previous post and the attached XL sheet.

http://probesoftware.com/smf/index.php?topic=92.msg2967#msg2967

It does contain the math behind calculating CO2 wt-%. Maybe Andrew can double check my normalization and confirm this is the way to go. Note that I do force the normalization to yield a perfect total of one total divalent cation - if you don't want this option, simply set the "norm. factor" in the spreadsheet to 1.0000.

I can adjust it to calculate C wt-% if you want, or I can even try to translate it in VB. Note that this "simple" example is only considering 2+ cations, and it would need to be adjusted with some cation factor if the analysis include non-divalent cations (to take into account the fact that, for instance, TWO 3+ cation will be balanced by THREE (CO3)2- anion).

J.

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #37 on: June 28, 2015, 10:03:35 pm »
Of course, the other solution (which I personally apply anyway) is to simply perform a mineral formula recalculation separately using a "home-made" XL spreadsheet. You can't imaging how complicated this normalization can be, with some time special conditions (e.g., fill one site with X amount of atom, another site with Y amount, and sometime a same element can be split in two different "sites" and need additional conditions). I'm not sure if you realize how complicated this can be, and so far there is no universal way to normalize all minerals, and there are often numerous ways to perform this type of calculation. For carbonate it is relatively easy, but deal once with amphibole (including F, Cl and unanalyzed OH or O2-) or allanite (REE-epidote, also with OH), and you will loose all your hairs!

Hi Julien,
Yes, exactly. We need some sort of carbonate charge balance code that I can incorporate into PFE for mineral processing.

Any such code needs to be written by a geologist/mineralogist. I am not qualified.  I will check your Excel code, thanks!

Wait. I need your VBA code... specifically your .xlsm file.
john
« Last Edit: June 28, 2015, 10:49:20 pm by Probeman »
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #38 on: June 29, 2015, 10:30:49 am »
John, the idea of getting CO2 by difference won't resolve anything and it is NOT good. I doubt you will get the desired 1:1:3 ratio all the time when calculating CO2 by difference. Calculating the CO2 by stoichiometry also permits to check if the analysis is good (i.e., totals close to 100%). We don't ignore this comment, I guess we just don't like the idea ;)

Hi Julien,
First of all it is CO3 by difference, not CO2.  The reason being that the cations must be calculated elementally if CO3 is specified by difference.

Second, I can understand that you would like to see a *real* total that reflects the quality of carbonate measurement- and that is exactly what the carbon by stoichiometry to stoichiometric oxygen calculation method is for!  But since you all are insisting on perfect C:O stoichiometry for an imperfect analysis...  you *should* use the formula by difference option!  Whether you like it or not!   ::)

And third, you *can* still look at the "total" to ascertain the carbonate measurement quality, just not the wt% total!   :o

Note that the total formula atoms below for the CO3 formula by difference calculation is 5.011.  Since we have fixed C:O to 1:3, we simply subtract the 4 CO3 atoms from the total atoms to get the sum of cations, and yes, just as was the case for the stoichiometric carbon to oxygen calculation we have a high total (5.011 - 4 = 1.011), this time for the sum of cations!!!

ELEMENT   K-RAW K-VALUE ELEMWT% OXIDWT% ATOMIC% FORMULA KILOVOL                                       
   Ca ka  .50929  .19297  19.741   -----  10.416    .522   15.00                                       
   Mn ka  .46436  .18430  21.884   -----   8.424    .422   15.00                                       
   Fe ka  .00738  .00314    .367   -----    .139    .007   15.00                                       
   Mg ka  .03916  .00766   1.365   -----   1.188    .060   15.00                                       
   P  ka  .00080  .00013    .015   -----    .010    .001   15.00                                       
   C                      11.334   -----  19.956   1.000
   O                      45.294   -----  59.867   3.000
   TOTAL:                100.000   ----- 100.000   5.011


Even a simple mind like mine can do that subtraction in my head!   

But send or post me your VBA code, that is, the Excel .xlsm file with the carbonate charge balance calculation macro, and I will implement it into PFE ASAP as a mineral calculation option for carbonates!
john
« Last Edit: June 29, 2015, 03:42:18 pm by Probeman »
The only stupid question is the one not asked!

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #39 on: June 29, 2015, 11:00:46 am »
Secondly, if I enable the “Use All Matrix Corrections” for analyses calculated with the Stoichiometry to Calculated Oxygen option, all of the results for a given point are reported as virtually identical (differing only in the second decimal point; RSD for Ca circa 0.002%). In contrast, using the Calculate with Stoichiometric Oxygen gives a wide range of results among the different matrix corrections with an RSD for Ca of 2.0%). I cannot see how including C in the matrix corrections should improve their relative agreement by a factor of 1000.

Hi Andrew,
As I have said already, when using the carbon by stoichiometry to stoichiometric oxygen calculation method, the ability to maintain a perfect C:O ratio through the atom normalization depends on totals being close to 100%. This is simply due to the atom normalization math.

I'll try again: the magnitude of the C:O ratio discrepancy when the concentrations are normalized to atoms, depends on the relative ratio of the atomic weights of carbon and oxygen *and* the degree to which the analytical total varies from 100%.  This is what all your "discrepancy" vs. (total - 100) plots show.

And if I have to type the word "stoichiometric" again, I don't know what I'm going to do...    :'(

Seriously, please read this post to Julien and see if this explanation helps:

http://probesoftware.com/smf/index.php?topic=92.msg2979#msg2979
« Last Edit: June 29, 2015, 03:43:09 pm by Probeman »
The only stupid question is the one not asked!

AndrewLocock

  • Professor
  • ****
  • Posts: 61
    • University of Alberta Electron Microprobe Laboratory
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #40 on: June 29, 2015, 04:09:30 pm »
Hi John,
I will go through your code over he next week or so. As you will appreciate, it is not short(!).

Some points to ponder:
1) If we analyze just Mg in magnesium oxide, and calculate oxygen by stoichiometry, the ratio of Mg to O is 1:1 in PfE, regardless of analytical total. Why?

2) Stoichiometry for the simple carbonate minerals means the ratio of the sum of the divalent cations (Mg+Ca+Sr+Ba+Mn+Fe+Zn etc.) to C to O is 1:1:3, without exception.

3) The widely differing matrix corrections should give different values for any given analysis, regardless of the options selected in PfE.

Question:
My understanding of ZAF corrections is that they are an interative loop.
Is it possible during the ZAF corrections to match the concentration of C to the corresponding correct proportion of O (or more properly divalent cations) for each iteration?
As you mention:
Quote
1. The oxygen calculated by stoichiometry to the measured cations is added to the matrix correction as a concentration. Likewise, the carbon calculated by stoichiometry to oxygen is also added to the matrix correction as the code above shows as a concentration also.

2. This calculation is iterated because as the concentrations of the cations change, due to the (relatively minor) matrix effect of adding oxygen and carbon, the oxygen and carbon by calculation also are changed as they should.
Why not change the C and O concentrations accordingly with each iteration of the ZAF corrections?

Thanks for encouraging me to post these queries in the forum, and of course, for your patience as well as the excellent program.

All the best,
Andrew

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 2443
  • Other duties as assigned...
    • Probe Software
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #41 on: June 29, 2015, 04:55:47 pm »
Some points to ponder:
1) If we analyze just Mg in magnesium oxide, and calculate oxygen by stoichiometry, the ratio of Mg to O is 1:1 in PfE, regardless of analytical total. Why?

Yes, this makes sense because in this situation there is only one element by stoichiometry.  Oh god, I had to type that word- again...    :'(

2) Stoichiometry for the simple carbonate minerals means the ratio of the sum of the divalent cations (Mg+Ca+Sr+Ba+Mn+Fe+Zn etc.) to C to O is 1:1:3, without exception.

Yup. And if you want to force your measurement to fit this constraint we will need a charge balancing code for carbonate minerals.  Hopefully Julien's code will provide this once I implement it in PFE

3) The widely differing matrix corrections should give different values for any given analysis, regardless of the options selected in PfE.

Not sure what your point here is.  Everything changes everything.

Question: My understanding of ZAF corrections is that they are an interative loop.

Is it possible during the ZAF corrections to match the concentration of C to the corresponding correct proportion of O (or more properly divalent cations) for each iteration?
As you mention:
Quote
1. The oxygen calculated by stoichiometry to the measured cations is added to the matrix correction as a concentration. Likewise, the carbon calculated by stoichiometry to oxygen is also added to the matrix correction as the code above shows as a concentration also.

2. This calculation is iterated because as the concentrations of the cations change, due to the (relatively minor) matrix effect of adding oxygen and carbon, the oxygen and carbon by calculation also are changed as they should.
Why not change the C and O concentrations accordingly with each iteration of the ZAF corrections?

Well I do that already, but as concentrations that preserve an actual analytical total.  Now having said that maybe the next generation of matrix corrections will not be based on concentrations, and that would (I think) solve your problem. I have to agree that when I got into this business I could not understand why everything was in mass concentrations. After all, the microprobe is *not* a balance and it certainly cannot distinguish isotopes!  It really doesn't measure mass, just numbers of atoms! But like mineral names, this may be here to stay although no one can think of a good reason for it.

Thanks for encouraging me to post these queries in the forum, and of course, for your patience as well as the excellent program.

Of course, and thank-you for participating in the forum. It is awesome to have smart people involved with this project.  And I need all the help I can get! The truth is I can't change something unless I understand it, and so if I seem pedantic it's just because I really am trying to understand it.

In addition to the code snippets here:

http://probesoftware.com/smf/index.php?topic=92.msg2950#msg2950

and the ZAF matrix correction code I attached to this post here:

http://probesoftware.com/smf/index.php?topic=92.msg2975#msg2975

I'm also posting my code for atom normalization here:

' Calculate formulas
If mode% = 4 Then
If sample(1).FormulaElement$ <> vbNullString Then     ' normal formula calculation
ip% = IPOS1(sample(1).LastChan%, sample(1).FormulaElement$, sample(1).Elsyms$())
If ip% = 0 Then GoTo ConvertWeightInvalidFormulaElement

' Check for insufficient formula basis element
If atoms!(ip%) < 0.01 Then
tmsg$ = TypeLoadString$(sample())
tmsg$ = "There is an insufficient concentration of the formula basis element " & sample(1).Elsyup$(ip%) & " (usually caused by a very low intensity of the x-ray), to calculate a formula for sample " & tmsg$ & ". "
tmsg$ = tmsg$ & "Please delete the data point (line " & Format$(sample(1).Linenumber&(row%)) & ") or change the formula basis element." & vbCrLf & vbCrLf
If datarow% = 0 Then
tmsg$ = tmsg$ & "This message will be displayed for 30 seconds, following that the point will be flagged and ignored and the remaining data will be analyzed as usual."
MiscMsgBoxTim FormMSGBOXTIM, "ConvertWeight", tmsg$, 30#
If ierror Then Exit Sub
sample(1).LineStatus(row%) = False     ' flag temporarily
sample(1).GoodDataRows% = sample(1).GoodDataRows% - 1
If sample(1).GoodDataRows% < 0 Then sample(1).GoodDataRows% = 0
Else
Call IOWriteLogRichText(tmsg$, vbNullString, Int(LogWindowFontSize%), vbMagenta, Int(FONT_REGULAR%), Int(0))
End If
GoTo 1000:
End If

temp! = sample(1).FormulaRatio! / atoms!(ip%)
For chan% = 1 To sample(1).LastChan%
weights!(chan%) = atoms!(chan%) * temp!
Next chan%

' Calculate sum of cations (normalize sum of cations to formula atoms)
Else
TotalCations! = 0#
For chan% = 1 To sample(1).LastChan%
If sample(1).AtomicCharges!(chan%) > 0# Then TotalCations! = TotalCations! + atoms!(chan%)
Next chan%

If TotalCations! < 0.01 Then
tmsg$ = TypeLoadString$(sample())
tmsg$ = "There is an insufficient concentration of the cation sum (usually caused by a very low total), to calculate a formula for sample " & tmsg$ & ". "
tmsg$ = tmsg$ & "Please delete the data point (line " & Format$(sample(1).Linenumber&(row%)) & ") or change the formula assignment." & vbCrLf & vbCrLf
If datarow% = 0 Then
tmsg$ = tmsg$ & "This message will be displayed for 30 seconds, following that the point will be flagged and ignored and the remaining data will be analyzed as usual."
MiscMsgBoxTim FormMSGBOXTIM, "ConvertWeight", tmsg$, 30#
If ierror Then Exit Sub
sample(1).LineStatus(row%) = False     ' flag temporarily
sample(1).GoodDataRows% = sample(1).GoodDataRows% - 1
If sample(1).GoodDataRows% < 0 Then sample(1).GoodDataRows% = 0
Else
Call IOWriteLogRichText(tmsg$, vbNullString, Int(LogWindowFontSize%), vbMagenta, Int(FONT_REGULAR%), Int(0))
End If
GoTo 1000:
End If

' Normalize to total number of cations
temp! = sample(1).FormulaRatio! / TotalCations!
For chan% = 1 To sample(1).LastChan%
weights!(chan%) = atoms!(chan%) * temp!
Next chan%
End If

End If
End If

But if you think that ZAFSmp code is not short, you ain't seen nothing yet. You would just die if you saw the entire code. There is a lot of it to wade through!
« Last Edit: June 30, 2015, 10:26:29 am by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

AndrewLocock

  • Professor
  • ****
  • Posts: 61
    • University of Alberta Electron Microprobe Laboratory
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #42 on: July 06, 2015, 01:33:32 pm »
Hi John,
I am looking forward to going though your code for this particular issue.

In the interim, I found some readings with reference to the mass dependency of ZAF corrections, as you mention:
Quote
Now having said that maybe the next generation of matrix corrections will not be based on concentrations, and that would (I think) solve your problem. I have to agree that when I got into this business I could not understand why everything was in mass concentrations. After all, the microprobe is *not* a balance and it certainly cannot distinguish isotopes!  It really doesn't measure mass, just numbers of atoms! But like mineral names, this may be here to stay although no one can think of a good reason for it.
--------------------------------
From Goldstein et al. (2003):
Scanning Electron Microscopy and X-ray Microanalysis, Third Edition, 2003 by Goldstein, J., Newbury, D.E., Joy, D.C., Lyman, C.E., Echlin, P., Lifshin, E., Sawyer, L., and Michael, J.R.

9.4. The Approach to X-Ray Quantitation: The Need for Matrix Corrections (p. 402).
“As was first noted by Castaing (1951), the primary generated intensities are roughly proportional to the respective mass fractions of the emitting element. If other contributions to x-ray generation are very small, the measured intensity ratios between specimen and standard are roughly equal to the ratios of the mass or weight fractions of the emitting element. ”

And from Reed (1993):
Electron Microprobe Analysis, Second Edition, 1993 by Reed, S.J.B.

1.9 Relationship between X-ray intensity and elemental concentration (pp. 10-11).
“The reason that characteristic X-ray intensities are, to a first approximation, proportional to mass concentration (whereas atomic concentration might appear more reasonable) is related to the fact that incident electrons penetrate an approximately constant mass in materials of different composition. This is because these electrons lose their kinetic energy mainly through interactions with orbital electrons of the target atoms, the number of which is approximately proportional to atomic mass.

The consequences of this can be demonstrated as follows. Consider two elements, A and B, the latter being 'heavier' than the former. To determine the concentration of A in a sample containing a mixture of A and B, one compares the intensity of ‘A’ radiation emitted by the sample with that from pure A. For the sake of simplicity we assume that the sample contains equal numbers of A and B atoms. Fig. 1.7 shows diagrammatically the volumes excited in pure A (a) and the A-B compound (b), given that the masses excited are equal, as noted above. The number of atoms excited in pure A is greater than in the compound because of the presence of heavy B atoms in the latter. Consequently the ratio of the numbers of excited A atoms in sample and standard, and hence the X-ray intensity ratio, is less than 0.5 (the atomic concentration of A in the compound).

The following argument shows that this ratio is, in fact, equal to the mass concentration (given the assumptions stated above). If the atomic concentration of A is nA, then the mass concentration is given by CA = nAAA/[nAAA + (l-nA)AB] where AA and AB are the atomic weights of A and B respectively. The number of atoms excited in the pure A standard is equal to Nm/AA, where N is Avogadro's number and m the mass penetrated by the incident electrons. In the case of the compound, the number of A atoms in the excited volume is nANm /[nAAA + (l-nA)AB]. The X-ray intensity ratio (which is proportional to the ratio of the numbers of excited atoms) is given by this expression divided by Nm/AA, which is equal to the expression given above for CA. In reality the intensity ratio is not exactly equal to the mass concentration, firstly because Z /A is not constant and secondly because the 'stopping power' of all bound electrons is not the same. This, together with other factors which affect the measured intensities, gives rise to the need for matrix corrections, as described below.”

-------------------------------------------------------------------------------------------------
I found this explanation to be useful, and have attached the 2 pages from Reed's book as a PDF (which shows the diagram).
Thanks,
Andrew

Probeman

  • Emeritus
  • *****
  • Posts: 1883
  • Never sleeps...
    • John Donovan
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #43 on: July 06, 2015, 02:12:12 pm »
In the interim, I found some readings with reference to the mass dependency of ZAF corrections, as you mention:
Quote
Now having said that maybe the next generation of matrix corrections will not be based on concentrations, and that would (I think) solve your problem. I have to agree that when I got into this business I could not understand why everything was in mass concentrations. After all, the microprobe is *not* a balance and it certainly cannot distinguish isotopes!  It really doesn't measure mass, just numbers of atoms! But like mineral names, this may be here to stay although no one can think of a good reason for it.

Hi Andrew,
Well we've come full circle now(!)... actually I am very well aware of these weight vs. atom issues and have published several papers on it (see below). I was mostly just making a funny in the above post! 

But since you bring it up, a more physical model for some matrix correction parameters (besides those which are already normalized to mass concentrations, e.g., mass absorption coefficients- hence the term!), is the so called "electron fraction" model as published in our papers. See attached below.

Basically it is a historical accident that chemists started with weight fraction before atomic fraction. This is because atomic weight was discovered before atomic number!  Mendeleev's first periodic tables were ordered by atomic weight, *not* atomic number- because atomic number had not been discovered yet.  Which was why he got a few things wrong- like the periodic order of Te and I!  That is one of the three places in the periodic table where atomic number goes up but atomic weight goes down!

In fact uranium carbide behaves much more like uranium than carbon because uranium has many more electrons (and protons) than carbon, as opposed to the 1:1 atomic ratio you'd think it might relate to as Reed mentions. And because all electron solid interactions (up to 1 meV or so) are *dominated* by electrostatic interactions (electrons and protons), this is what we should be using in our matrix calculations.

But.. the early chemists were committed to weight fraction because they were chemists not physicists!    :'(

But again, this really has nothing to do with our discussion. As I said previously: "the magnitude of the C:O ratio discrepancy when the [weight] concentrations are normalized to atoms, depends on the relative ratio of the atomic weights of carbon and oxygen *and* the degree to which the analytical total varies from 100%."

So when one does not have a perfect analytical total and one then re-normalizes the concentrations to atoms, you will always get this discrepancy... because the atomic weights of oxygen and carbon are different!

The only way around this problem, is to take the weight concentrations and perform a charge balance calculation which I will be adding to the PFE code as soon as Julien (or some other geologist) writes it up.  I talked to Julien over the weekend and the sticking point now is that Julien's current code is in php and he is very busy right now...

Here is a web page you might find interesting:

http://epmalab.uoregon.edu/BSE.htm
« Last Edit: July 06, 2015, 11:26:32 pm by Probeman »
The only stupid question is the one not asked!

AndrewLocock

  • Professor
  • ****
  • Posts: 61
    • University of Alberta Electron Microprobe Laboratory
Re: Specifying Unanalyzed Elements For a Proper Matrix Correction
« Reply #44 on: November 27, 2015, 03:27:28 pm »
The only way around this problem, is to take the weight concentrations and perform a charge balance calculation...

Following up on this point, and on the excellent suggestions of Julien Allaz:
Attached is an explicit spreadsheet (Excel, *.xlsx) for recalculation from an analysis (wt%) to a formula (atoms per formula unit, apfu). This is a linear transformation, and so no iteration is needed.

This spreadsheet permits calculation of the formula proportions based on:
1) The number of oxygen (or oxygen equivalent, e.g. 2 F = 1 O), or
2) The number of cations present (including H, C, S as cations), or
3) The total number of atoms.

In addition, if H2O or CO2 has not been measured or input in weight percent, then the number of groups of OH, H2O, and CO2 in the formula can be specified. The spreadsheet will calculate the corresponding weight proportions of H2O and CO2.

Because the spreadsheet is general (can be used for almost any inorganic mineral), the constituents must be entered by the user in the appropriate oxidation states. A worksheet for converting between oxides (e.g. FeO and Fe2O3) or to/from elements is also included.
However, I have not implemented "recalculation of an unanalyzed element based on a fixed apfu" because of the large number of possible elements.

The attached spreadsheet uses a ferroan dolomite analysis as an example, with 2 CO3 groups specified.
The formula results are the same whether calculated on 6 oxygen, 4 cations, or 10 total atoms:
C2Mg0.664Ca1.125Mn(II)0.003Fe(II)0.208O6
The results are rounded to 3 decimal places, and concatenated in the formula in order of increasing atomic number.

For more complex calculations (e.g., garnets, amphiboles etc., where estimation of ferric/ferrous proportions by charge balance or select cation sums is needed), users may need to look at separate programs or spreadsheets dedicated to such tasks.

Andrew