NORRRM : A Free Software to Calculate the CIPW Norm

This work gives an introduction to the R package NORRRM whose main purpose is to calculate the CIPW Norm. Although there are many softwares and spreadsheets available to estimate the standard mineral assemblages in igneous rocks, this package has the following advantages: a) it has the ability to be run on any operating computer systems (BSD, GNU/Linux, Mac OS X®, Windows®); b) an input argument allows choose different procedures to set the Fe-oxidation ratio; c) the options to use whole-rock major as well as minor oxides and trace elements in the computation; d) the output data yields highly consistent results achieving absolute match between the sum of the input weights of oxides recalculated on an anhydrous basis and the sum of the weights of estimated normative minerals and; e) the functions are written in R language and released under terms that guarantee users the freedom to study, adapt, modify, and distribute the software.


Introduction
The igneous rocks have always been recognized as extremely difficult to set a systematic classification, owing of their almost infinite variation and the gradation from one kind to another in many ways.According to the IUGS (International Union of Geological Science), Subcommission on the Systematics of Igneous Rocks, the primary classification of igneous rocks must be based according to their modal mineral composition, expressed as volume percent [1].Nevertheless, where these data are unavailable or can not be determined owing to fine-grained mineral assemblage, glassy content or changes in the original mineralogy, then other criteria based on bulk chemical composition may be used.
Computed from its chemical composition, the normative mineralogy is an alternative approach for modal classification and useful for set the naming of igneous rocks and plot specific compositions in phase diagrams.
The CIPW Norm (acronym from the surnames of the authors: Cross, Iddings, Pirrson and Washington) is based upon assumptions about the order of mineral formation and known phase relationships of rocks and minerals, using simplified mineral formulas.It is the most commonly used calculation algorithm to estimate the standard mineral assemblages for igneous rocks, generated over more than a hundred years ago [2] and thereafter modified by some authors as the years passed (e.g., [3]- [6]).In spite of there are many softwares and spreadsheets available to generate the CIPW Norm (summarized the most popular computer programs in [7]), the most used schemes are based on an outdated algorithm, and lacks the rigor suggested by the modern geochemistry ( [5] [7] [8]).Furthermore, all of them depend on proprietary operating systems.In this paper, I shall present NORRRM a user-created extension of R language [9], which main purpose is to calculate comprehensive normative compositions of igneous rocks based on the algorithm after [5].

Installation and General Considerations
Practically all Norms calculated today are produced by computer, but it is essential to understand the algorithm used by the software to know the nature of the calculation through the source code.To facilitate the access to the script and adapt it to your needs, NORRRM is released under GNU General Public License (GPL), both a free software license, and a copyleft license.It is important to note that the term "free software" was coined by [10] to refers the four freedoms that users of software should have: 0) to run the program, for any purpose; 1) to study how the program works; 2) to redistribute copies; 3) the freedom to improve the program, and release your improvements to the public, so that the whole community benefits.In this sense, proprietary software may limit their use within the geoscience community because have licensing terms that restricted their usage to a specific set of software/hardware.NORRRM is distributed free of charge as cross-platform program that can be run on any operating system with an installed R environment (version 3.1.1or greater).NORRRM can be downloaded from CRAN repositories (http://cran.r-project.org/) or installed via R terminal: >install.packages("NORRRM")>library(NORRRM) For its part, like any function in R, the NORRRM's functions include arguments as objects (mainly conditional expressions) which are defined by default within the script; these default values may be modified by the user by specifying options in the console.Then, the overall use of NORRRM is explained starting from the command-line interface.

Input Data
Results of major elements in geochemical analysis, traditionally used in Norm calculation are submitted as oxides and expressed in weight percent (% wt).These are SiO 2 , TiO 2 , Al 2 O 3 , MnO, MgO, CaO, Na 2 O, K 2 O and P 2 O 5 .A special case is the Fe, because it can be determined as FeO and Fe 2 O 3 , but sometimes expressed as "total Fe" and given as either FeO t and Fe 2 O 3t ( t = total).On the other hand, trace element data are expressed in parts per million (ppm) of element and exceptionally exceeding 2000 ppm (0.2%).The trace elements that can be used in NORRRM are Ba, Cl, Co, Cr, Cs, F, Li, Ni, Rb, S, Sr, V and Zr.Additionally, the oxides concentrations of Cr 2 O 3 , NiO and SO 3 (expressed as % wt) are handled like trace elements as well.However Cr 2 O 3 are preferable to Cr and NiO to Ni. Sulfur concentration when available is reported as either SO 3 or S, in which case their separate identity should be maintained.
There are many different ways to import data sets of almost any file extensions using R.However, the header format of the input data to run NORRRM should be specific.Examples of data are provided by the CRAN and can be called by commands as: # load TestTAS data > data(TestTAS) to call a compilation of major elements data for 37 representative samples of volcanic rocks.This data is also available as part of IUGSTAS, the software developed by the IUGS [1] to calculate the CIPW Norm.On the other hand, to call a compilation of more than 1500 major-and trace-elements analysis of igneous rocks from central Andes [11] can be used the command: # load Andes data > data(Andes)

TASplot
The Total Alkalis (TA: Na 2 O + K 2 O) vs Silica (S: SiO 2 ) diagram is one of the most useful classification schemes available for volcanic rocks.TAS classification can be used to assign names to many common types of volcanic rocks based upon the relationships between the combined alkali content and the silica content, because it play an important role in propose a modal mineralogy and determining the normative mineralogy [1].
It is important to note that the TAS classification is purely descriptive, and that no genetic significance is implied.Furthermore, analyses of rocks that weathered, altered, metasomatized or have undergone crystal accumulation should be used with caution in this or any classification scheme, as spurious results may be obtained [1] [12].The TASplot function provides a powerful model of TAS plot considering that analyses are recalculated on an anhydrous basis.This graphical function can be displayed in the screen by typing the following at the command line: where "filename" is a dataset of major elements stored in R and, "colour" is the color of the points (another graphical parameters can be specified by the arguments).The output of TASplot function create a ggplot2 object [13], an output example of this function is shown in Figure 1.

AdjRock
In most terrestrial magmas, Fe is overwhelmingly the most abundant element occurring in more than one oxide- tion state, chiefly as Fe 2+ and Fe 3+ [14], both in nature as the Norm, the oxidation states behave differently, giving rise to different types of minerals.The ratio of these oxidation states (described as FeO/(FeO + Fe 2 O 3 ), Fe 3+ /(Fe 3+ + Fe + ) or Fe 2 O 3 /FeO) varies widely in different rock types [1].Since Fe 2 O 3 and FeO are rarely separately determined, in which case are reported as "total Fe", the Fe-ratio must be calculated in some way owing this ratio can profundly affect the degree of silica saturation in the norm and, the nature and abundance of the species of critical normative minerals [8].In this sense, Middlemost [8] has proposed a range of oxidation ratios (as Fe 2 O 3 /FeO) for use with volcanic rocks, depending on the type of rock drawn in TAS diagram.The Fe-ratio is calculated by default in NORRRM following the method of [8], helped by the function pnt.in.poly within of SDMTools package [15].
Furthermore, another method to fix Fe-oxidation ratio is available, Le Maitre [16] determine an approach of Fe ratio partitioning based on multiple regression analyses with a large database of young volcanic and plutonic rocks, using (Na 2 O + K 2 O) vs SiO 2 diagram.From linear regression models this author computed the Equation (1) to specifying oxidation ratios: FeO FeO Fe O 0.93 0.0042 SiO 0.022 and for volcanics rocks the Equation ( 2), ( ) ( ) FeO FeO Fe O 0.88 0.0016 SiO 0.027 for plutonics rocks.In specific cases where FeO and Fe 2 O 3 are available, no method is used to correct the Fe analyses and the measured ratios are maintained.Once determined the Fe-oxidation ratio, the major elements data is recalculated to 100% on an anhydrous basis, subtracting the Loss On Ignition (LOI) on the sum of major elements.An example to call AdjRock function applied to a data set is given as: # recalculated the geochemical data on an anhydrous basis AdjRock(filename, Volcanic=FALSE, AdjTAS=FALSE,Cancrinite=TRUE) where "filename" is a dataset of major elements stored in R, the denial of the arguments "Volcanic" and "Adj-TAS" involves that the Fe-oxidation ratio is performed by plutonic Le Maitre's equation and, the affirmation of third argument allows add CO 2 as major element.

CIPW
The feedstock of the CIPW Norm computation is the mol proportion of each constituent, which is determined dividing the adjust oxide by the appropriate molecular weight.The most up-to-date weights of elements recommended by the IUPAC (International Union of Pure and Applied Chemistry) Commission on Atomic Weights and Isotopic Abundances have been used for the calculation of molecular weights [18].
# load and view OxiWeigth data > data(OxiWeigth) > View(OxiWeigth) It is important to note that the CIPW norm is widely used by igneous petrologists as an aid for naming the igneous rocks.In this sense, step-by-step procedure is shown in many classical books of both geochemistry and igneous petrology (e.g., [19]- [23]).However, Verma et al. [5] proposed their scheme based on mass-balance principles and claimed your algorithm as standard methodology for CIPW norm computation, calling it Standard Igneous Norm (SIN).In this regard, NORRRM adheres to the main rules set by the SIN.
To compute the Norm, it is necessary set up chemical formulae compatible with hypothetical phases at an idealized magma oxides saturation.Such an approach to generate Norm minerals requires continuous monitoring of oxides mol proportion abundance, every step of the Norm that involve the formation of a mineral, consumes a specified quantity of chemical components, having two or three options depending on its saturation.Once the quantity of specific mol proportion is exhausted, this entity is no longer available for mineral generation.The process of mineral creation continues until the entire composition is consumed, tracking the silica saturation provided by silicate formation.After the step of established silica saturation, if the silica deficient is positive, some minerals previously calculated are undone to release some of their components to construct remaining minerals, until the deficiency has been reduced to zero and the provisional normative minerals have been converted to definite ones.Finally, the computation is completed by conversion of the mol proportions to weight percentages of normative minerals, multiplying molar data by the respective mineral molecular weights (Table 1).

# load and view MinWeight data > data(MinWeight) > View(MinWeight)
It is important to note that the calculation is based on the following assumptions: 1) the magma from which the rock is derived is assumed to be anhydrous, therefore hydrous phases such as amphibole and micas are ignored; 2) the ferromagnesian minerals are assumed to be free of Al 2 O 3 , therefore the amount of alumina must be used to calculate feldspar and feldspathoid; 3) differs between the two endmembers of the solid solution series (e.g., forsterite (Mg-endmember: 2MgOSiO 2 ) and fayalite (Fe-endmember: 2FeOSiO 2 )) and 4) due to the algorithm, several mineral pairs are considered to be incompatible (e.g., [Qz] and [Ol] or [Hy] and [Ne]), therefore never appear together in the norm although in real rocks that may be present.An example call CIPW function applied to a data set is given as: where "filename" is a dataset of major elements stored in R, the affirmation of the arguments "Volcanic" and the denial "AdjTAS" involves that the adjust of Fe-oxidation ratio is performed by Volcanic Le Maitre's equation and, the affirmation of the Cancrinite argument allows calculate Sodium Carbonate (Na 2 OCO 2 ) in the Norm.

CIPW.trace
In spite altogether the trace elements used in the Norm rarely exceed more than 0.6% of the weights of the oxides recalculated on an anhydrous basis.Some rocks may attain high concentrations of these components and significantly influence the results of the norm (e.g., high Ba-Sr rocks, mafic-ultramafic rocks with high concentrations of compatible elements).An important difference between the SIN (using trace element) and the function CIPW.trace is that NORRRM only performed one adjust to an anhydrous basis, done after the conversion of trace concentration data (ppm) to percent, handling the concentrations of major and trace elements as a whole.
The trace elements are used in the Norm computation by two different ways: 1) assigned to different minerals according to generally accepted chemical substitutions of trace elements into major elements (e.g., CaO wtmol.where "filename" is a dataset of major and trace elements stored in R, the absence of arguments involves the compliance of defined by default arguments in the function: Volcanic = TRUE, AdjTAS = TRUE, Cancrinite = FALSE, Calcite = FALSE, digits = 3.

Output Data
Any calculation in R, and consequently in NORRRM computations, produce results that are not automatically stored in the memory.They can be appended to the current environment for further processing, turning them into objects by standard operators (<− or =).On the other hand, to check the stoichiometric balance and generate quality data, the results of the sum of the weights of the oxides on an anhydrous basis, the sum of the weights of the calculated normative minerals and the differences between them were plotted on histograms to prove the data reliability (Figure 2).
The histograms have been performed by both CIPW and CIPW.trace functions applied on Andes database included in the CRAN, which has wide compositional range.The patterns show normal distribution and gives sums of normative minerals and oxide weigths of 100% (±0.005).Futhermore, the differences between the input (oxide weigths) and output (normative minerals) data are very small, ranging in most cases between −0.0025 and +0.0025, with the exception of some observations.In addition, NORRRM computes several geochemical parameters and casts them in the numeric output.This parameters include commonly utilized petrological ratios and indices (Table 2).

Concluding Remarks
NORRRM is a program for handling geochemical data of igneous rocks and to calculate the CIPW Norm, which has the attribute to be run on any operating computer systems.The NORRRM's capacity on the number of samples that can be processed is limited only by the limits of information processed by R.Although there are a lot of programs to calculate the Norm, most of them depend on others software or hardware that do not have long-term support or are based on an outdated algorithm.The proposed scheme, gives precisely and accurately data, using a free software.

Figure 2 .
Figure 2. Histograms of the sum of the weights of the oxides on an anhydrous basis (A and D), the sum of the weights of the calculated normative minerals (B and E) and differences (∆ output) between the sum of the weights of the oxides and normative minerals (C and F) obtained by both CIPW (in blue) and CIPW.trace (in red) functions applied on data from central Andes (n = 1511, function: data(Andes)), rounded to the third decimal place (default argument).

Table 1 .
Mineral formulae, weigths and densities to be used in the NORRM computations.