Recalculatation for Cpx. Fe3+ calculated.
Reference | R. Sturm PX-NOM an interactive spreadsheet program for the computation of pyroxene analyses derived from the electron microprobe, 2002 [ref] |
---|---|
Input | SiO2_wtp, TiO2_wtp, Al2O3_wtp, FeO_wtp, MnO_wtp, MgO_wtp, CaO_wtp, K2O_wtp, Na2O_wtp, Li2O_wtp, ZnO_wtp, NiO_wtp, Cr2O3_wtp, Sc2O3_wtp |
Results | pfu, Fe_p2_pfu, Fe_p3_pfu, Si_T_pfu, Al_M1_pfu, Fe_M1_pfu, Al_T_pfu, Fe_T_pfu, Mg_M2_pfu, Fe_M2_pfu, Mg_M1_pfu |
source("recalc_common_cation.r") source("recalc_common_oxygen.r") recalc.cpx_sturm <- function (wtp_data, ...) { ox_group <- c("SiO2_wtp","TiO2_wtp", "Al2O3_wtp", "FeO_wtp", "MnO_wtp", "MgO_wtp", "CaO_wtp", "K2O_wtp", "Na2O_wtp" ,"Li2O_wtp", "ZnO_wtp", "NiO_wtp", "Cr2O3_wtp", "Sc2O3_wtp"); wtp_group <- selectNames(wtp_data,ox_group); oxcoeff <- c( 2 / 60.0848, 2 / 79.8988, 3 / 101.96128, 1 / 71.8464, 1 / 70.9374, 1 / 40.3044, 1 / 56.0794, 1 / 94.1954, 1 / 61.97894, 1 / 29.8814, 1 / 81.3794, 1 / 74.7094, 3 / 151.9902, 3 / 137.91 ); cxcoeff <- c( 1 / 60.0848, 1 / 79.8988, 2 / 101.96128, 1 / 71.8464, 1 / 70.9374, 1 / 40.3044, 1 / 56.0794, 2 / 94.1954, 2 / 61.97894, 2 / 29.8814, 2 / 81.3794, 1 / 74.7094, 2 / 151.9902, 2 / 137.91); step1_data <- rowApply(`*`, wtp_group, oxcoeff); step1_sum <- 6 / rowSums(step1_data); step1_data <- rowApply(`*`, wtp_group, cxcoeff) * step1_sum; sum_pfu <- rowSums(step1_data); names(step1_data) <- c("Si_pfu","Ti_pfu", "Al_pfu", "Fe_pfu", "Mn_pfu", "Mg_pfu", "Ca_pfu", "K_pfu", "Na_pfu" ,"Li_pfu" , "Zn_pfu", "Ni_pfu", "Cr_pfu", "Sc_pfu"); fe3_droop <- ifelse( ifelse( sum_pfu > 6 / 1.5, 2 * 6 * (1 - (6 / 1.5) / sum_pfu), 0 ) > step1_data$Fe_pfu, step1_data$Fe_pfu, ifelse( sum_pfu > 6 / 1.5, 2 * 6 * (1 - (6 / 1.5) / sum_pfu), 0 ) ); fe3_lind <- ifelse( (2 - step1_data$Si_pfu * ((6 / 1.5) / sum_pfu) ) + step1_data$Na_pfu * ((6 / 1.5) / sum_pfu) - (step1_data$Al_pfu * ( (6 / 1.5) / sum_pfu) - (2 - step1_data$Si_pfu * ( (6 / 1.5) / sum_pfu) ) ) - step1_data$Cr_pfu * ( (6 / 1.5) / sum_pfu) - 2 * step1_data$Ti_pfu * ( (6 / 1.5) / sum_pfu) > 0, (2 - step1_data$Si_pfu * ( (6 / 1.5) / sum_pfu) ) + step1_data$Na_pfu * ( (6 / 1.5) / sum_pfu) - (step1_data$Al_pfu * ( (6 / 1.5) / sum_pfu) - (2 - step1_data$Si_pfu * ( (6 / 1.5) / sum_pfu) ) ) - step1_data$Cr_pfu * ( (6 / 1.5) / sum_pfu) - 2 * step1_data$Ti_pfu * ( (6 / 1.5) / sum_pfu), 0); step1_data$Fe_p3_pfu <- fe3_droop; step1_data$Fe_p2_pfu <- step1_data$Fe_pfu - step1_data$Fe_p3_pfu; compose_data <- step1_data; compose_data$Sum_T_pfu <- 0.0; compose_data$Sum_M1_pfu <- 0.0; compose_data$Sum_M2_pfu <- 0.0; compose_data <- occupation (compose_data, "Sum_T_pfu", 2.0, c("Si_pfu", "Al_pfu", "Fe_p3_pfu")); step1_data$Al_M1_pfu <- compose_data$Al_pfu; step1_data$Al_T_pfu <- step1_data$Al_pfu - step1_data$Al_M1_pfu; step1_data$Fe_T_pfu <- step1_data$Fe_p3_pfu - compose_data$Fe_p3_pfu; compose_data <- occupation (compose_data, "Sum_M1_pfu", 1.0, c("Al_pfu", "Fe_p3_pfu", "Ti_pfu", "Cr_pfu", "Sc_pfu", "Zn_pfu", "Mg_pfu", "Fe_p2_pfu")); step1_data$Fe_M1_pfu <- step1_data$Fe_p3_pfu - step1_data$Fe_T_pfu - compose_data$Fe_p3_pfu; ret <- data.frame(Name = wtp_data$Name); return (cbind(ret, step1_data)); } recalc.cpx_sturm.test <- function () { src <- data.frame(Name="test", SiO2_wtp=57.10, TiO2_wtp=0.17, Al2O3_wtp=0.7, FeO_wtp=5.57, MnO_wtp=0.17, MgO_wtp=34.52, CaO_wtp=0.62, K2O_wtp=0.03, Na2O_wtp=0.07, Cr2O3_wtp=0.27); result <- recalc.cpx_sturm (src); expect_equal(object = result$Fe_p2_pfu, 0.16, tolerance = 0.005); expect_equal(object = result$Si_pfu, 1.977, tolerance = 0.005); }