# Calculating the weight percentages in the original specimen when using an internal standard

When quantifying specimens with an internal standard, TOPAS provides the keywords `spiked_phase_measured_weight_percent`, `corrected_weight_percent`, and `weight_percent_amorphous` to set the amount of spike phase added, to get the corrected weight percentage of a phase, and to get the total amorphous amount in the specimen. These values refer to the specimen _with_ the standard in it. You often need the values referring to the original specimen, that is, without the standard.

The following macros calculate those values for you. Furthermore, the macros also allow for the addition of a standard that itself has a (known) amorphous fraction; the calculation of the amorphous fraction in the original sample takes this additional amorphous fraction into account.

## To use the macros

These macros should work in TOPAS version 5-7.

The str which is the standard must be the first str to appear in the xdd

Potential usages:

The first example has a sample containing 25 wt% standard, that is itself 100% crystalline. The following “0” is a placeholder for the amorphous weight percentage, which will appear after refinement.

All non-spike phases have the Original_WP macro. After refinement, the values will be updated with their weight percentages in the the original sample.

```xdd
str 'This is the first str. It must the standard str.'
Spike_amount_in_specimen(25, 0)
str
Original_WP(0)
str
Original_WP(0)
str
Original_WP(0)```

The second example has a sample containing 50 wt% standard, which is itself 90% crystalline. That is, equal weights of standard and sample were mixed together. The analysed specimen contains 5 wt% amorphous material from the standard, in addition to any already present in the sample.

```xdd
str 'This is the first str. It must the standard str.'
Spike_amount_in_specimen(50,90, 0)
str
Original_WP(0)
str
Original_WP(0)
str
Original_WP(0)```

## The macros

```macro Spike_amount_in_specimen(& std_wt_pct, amor) 'this goes in the spike phase str'
{
'The spike phase str must be the first str in the xdd. This is because of how move_to works'
Spike_amount_in_specimen(std_wt_pct, 100, amor)
}
macro Spike_amount_in_specimen(& std_wt_pct, & std_cryst, amor) 'or this goes in the spike phase str'
{
'The spike phase str must be the first str in the xdd. This is because of how move_to works'
move_to xdd
local !original_sample_amorphous_  100 : amor
move_to str