A MATLAB toolbox and Excel workbook for calculating the densities, seismic wave speeds, and major element composition of minerals and rocks at pressure and temperature
Abstract
To interpret seismic images, rock seismic velocities need to be calculated at elevated pressure and temperature for arbitrary compositions. This technical report describes an algorithm, software, and data to make such calculations from the physical properties of minerals. It updates a previous compilation and Excel® spreadsheet and includes new MATLAB® tools for the calculations. The database of 60 mineral end-members includes all parameters needed to estimate density and elastic moduli for many crustal and mantle rocks at conditions relevant to the upper few hundreds of kilometers of Earth. The behavior of α and β quartz is treated as a special case, owing to its unusual Poisson's ratio and thermal expansion that vary rapidly near the α-β transition. The MATLAB tools allow integration of these calculations into a variety of modeling and data analysis projects.
Key Points:
- MATLAB toolbox and Excel workbook calculates rock physical properties for any composition
- Quartz has complex properties due to highly unusual properties at the alpha-beta transition
- Calculations of rock seismic velocities from mineralogy can be integrated with other effects
1 Introduction
Seismic imaging provides a wealth of data on the subsurface at many scales primarily by in the form of P and S wave speeds or their contrasts across interfaces. These data potentially provide information on the composition and mineralogy of the crust and mantle, which can vary considerably. The connection between seismic wave speeds and composition can be made in at least two ways. First, velocities can be measured in the laboratory for natural rocks recovered from the field. However, retrogression and alteration of exposed natural samples tend to reduce their wave speeds relative to the same rocks at depth [Carlson, 2014] and accurate pressure and temperature derivatives are required to extrapolate to conditions at depth. Alternatively, seismic velocities can be predicted for any arbitrary rock composition if mineral abundances are known and mineral elastic properties can be adequately described [e.g., Bina and Helffrich, 1992]. The latter approach is taken here.
This technical report updates Hacker and Abers [2004], a Microsoft Excel® worksheet, and macro for calculating rock and mineral physical properties at pressure (P) and temperature (T) relevant to the Earth's crust and mantle. Several improvements have been made to this rock velocity calculator from the 2004 version. First, the calculations have been rewritten as a suite of MATLAB® functions, allowing the user to rapidly construct complex calculations and create figures. An optional MATLAB graphical user interface (GUI) allows simple calculations to be made in a manner suitable for classroom use. Second, the underlying mineral database has been updated to include new mineral-physics data published over the last decade; a more accurate model for quartz elasticity is the biggest change. Third, the rock major element composition is now calculated. Except for quartz, the underlying models of the temperature and pressure sensitivity of density and elastic moduli remain the same, as does the multicomponent mixing approach; the reader is referred to Hacker and Abers [2004] for specifics. An updated macro and spreadsheet is also included for users who prefer to use Excel. The Excel spreadsheet continues to be the primary organizational tool for the underlying mineral elasticity and composition database, and is exported for use by the MATLAB functions. This approach makes it easy for users to update the database and include other minerals as they see fit.
Although this approach has widespread application, it has shortcomings. One obvious limitation is the lack of any anelastic or physical dispersion effects for finite-frequency signals, which can be as important as anharmonic effects at mantle adiabatic conditions [Karato, 1993]. Unfortunately, anelasticity is well calibrated for only a few minerals, principally olivine [e.g., Jackson and Faul, 2010], so we could not systematically include these effects here. It is possible that generalizations of scaling laws may allow extrapolation to other mineral systems [McCarthy et al., 2011], should such extrapolations be sufficiently validated. A second limitation is the assumption of isotropy; the reader is referred to a variety of other toolboxes [e.g., Mainprice, 1990; Walker and Wookey, 2012] for estimating elasticity in mineral aggregates with sufficient data. Third, these calculations deal with minerals, whereas in many situations, poroelastic effects can be important. A rich literature exists describing the effects of water and melt within pores in calculations of elastic moduli, including recipes and toolboxes for MATLAB [e.g., Mavko et al., 2009; Schmeling et al., 2012]. One advantage of the MATLAB toolbox provided here is that it may be easier to interface with calculations that take into account some of these effects. Fourth, this toolbox includes mineral physics and compositional data for only a small subset of natural minerals, most of which are end-member compositions. Data for many end-members are missing (e.g., Mn-garnet, K-amphibole, Na-mica, Cr-spinel, and Fe-pumpellyite), meaning that the effects of these minerals—in velocities, densities, and rock compositions—are ignored, and the relative influence of other end-members enhanced. The reader is referred to Hacker and Abers [2004] for a discussion of other limitations.
We caution the user that this toolbox will calculate elastic properties for any chosen minerals and mineral compositions, and it does not test whether the mineral assemblage is stable at the specified P and T (except for the α-β quartz transition as discussed below)—or, indeed, at any P and T. This can be of great use, but caution is warranted. Also, the end-member mineral names in the spreadsheets need not have a 1:1 correlation with minerals in rocks, so some understanding of mineral systematics is required. To give two common examples, (i) a plagioclase feldspar may contain K2O, in which case that part must be represented in the spreadsheet by orthoclase or sanidine and (ii) an orthopyroxene may contain CaO, in which case that part must be represented in the spreadsheet by Ca-Tschermak or diopside.
2 Database
The database of thermoelastic properties for 60 minerals is similar to that in Hacker and Abers [2004], with updated values from the literature, and a half a dozen new minerals. Supporting information Table S1 summarizes all of these references. Many recent experiments and ab initio calculations have improved the mineral database. These new values and the related references are highlighted in red in the Excel spreadsheet, and the related references are noted in supporting information Table S1 by a “*.”
3 Quartz
The updated algorithm pays particular attention to quartz because it is a common crustal mineral with unusual elastic properties (e.g., a Poisson's ratio <0.1 at STP) requiring special treatment. In the lower crust of hot orogenic belts, α quartz should transform to the hexagonal, high-temperature polymorph β quartz [Shen et al., 1993]; the transition from α quartz to β quartz has a remarkable elastic signature [Ohno, 1995] that is expected to be visible in VP or VP/VS measurements [Mainprice and Casey, 1990; Mechie et al., 2004; Kuo-Chen et al., 2012; Sheehan et al., 2014]. As previous studies have emphasized, this elastic signature provides one of the few ways to assess middeep crustal temperatures in active orogenic belts (Figure 1). In spite of this potential, the elastic properties of quartz have not been measured at high P and high T, such that making a concrete link between seismic velocities and the α-β transition is somewhat speculative.

Predicted quartz properties across the α-β quartz transition along a hot (red) and moderate (blue) continental geotherm. Geotherms calculated for exponentially decaying crustal heat production with depth [Turcotte and Schubert, 2002] for a 20 km e-folding production depth, mantle heat input of 20 mW/m2, thermal conductivity of 2.5 W m−1 K−1, and surface heat flow of 90 or 120 mW m2. (a) VP or VS velocity as labeled. (b) VP/VS ratio; VP/VS = 1.414 corresponds to a Poisson's ratio of zero. (c) Impedance as product of VP and density, changes in which scale to reflection amplitude. (d) Geotherms used for the two models, labeled with surface heat flow (mW m−2) along with α-β quartz transition (dashed).
The α-β transition in quartz is a displacive transformation that is reversible at laboratory time scales [Buerger, 1951; Keith and Tuttle, 1952; Ghiorso et al., 1979; Raz et al., 2002; Zappone and Benson, 2013]; it is not a reconstructive transformation or net-transfer reaction that requires significant catalysis to operate. Structural changes—in atomic positions, amplitudes of atomic vibration, bond angles, and the development of Dauphiné twins—occur over tens of Kelvin below the transition [Young, 1962] and are mirrored by changes in volume, heat capacity, and elastic behavior [Ghiorso et al., 1979; Carpenter et al., 1998]. The transformation temperature is affected by impurities, but typically by not more than a few Kelvin [Keith and Tuttle, 1952]. In summary, the α-β transition is expected to occur in Earth under near-equilibrium conditions. For these reasons, the toolbox does not allow the user to specify the quartz polymorph, but calculates which polymorph is stable at the specified pressure and temperature.
The stiffness tensor, Cij, of quartz has been measured at elevated T and 1 atm, and at elevated P and 25°C; VP and VS have also been measured in quartzite at elevated P and T. It is uncertain, however, how the values of Cij change with increasing P and T—for example, does the temperature dependence of the Cij simply scale with ΔT from the α-β equilibrium boundary as the boundary shifts to higher temperature with increasing pressure? Below we summarize what is known.
3.1 Effect of Temperature on Quartz Elasticity
The stiffness tensor, Cij, of quartz single crystals has been measured in detail at 1 atm under increasing temperature, most recently using rectangular parallelepiped resonance [Ohno et al., 2006] and Brillouin spectroscopy [Lakshtanov et al., 2007]. At standard temperature and pressure (STP), the bulk and shear moduli are K = 37.9–38.2 GPa and G = 44.9 GPa, corresponding to VP = 6.1 km/s [Ohno et al., 2006; Lakshtanov et al., 2007]; note that K < G, which is quite unusual. The calculated values of the bulk and shear moduli as a function of temperature differ by <1% between the two techniques—except for a narrow, <25°C, interval just above the α-β transition, where the derived bulk moduli differ by up to 8%.
In quartz single crystals, the first 300°C of heating beyond STP induces a 3% decrease in VP—similar to some other minerals. In the next 200°C—approaching the 1 atm α-β transition temperature of 575°C—VP plummets an additional 14% to reach a minimum of 5.0 km/s [Ohno et al., 2006; Lakshtanov et al., 2007]. Inside the β quartz stability field, VP rebounds rapidly with temperature, reaching 7 km/s at 700°C, and then—in contrast to nearly all other minerals—continues to increase up to at least 1050°C [Ohno et al., 2006; Lakshtanov et al., 2007], partly because the thermal expansivity of β quartz is weakly negative [Welche et al., 1998].
This unusual elastic behavior is also evident in Poisson's ratio. The calculated Poisson's ratio for an α quartz crystal is very unusual at STP—0.08 (VP/VS = 1.48)—but gets even stranger with increasing temperature, reaching a minimum of −0.27 (VP/VS = 1.27) at ∼570°C, just below the α-β transition. At temperatures above the α-β transition, quartz starts to behave more normally, and by 700°C at 1 atm, β quartz approaches a typical Poisson solid (VP/VS = 1.72). Novaculites (fine-grained quartzose rocks) display similarly unusual behavior across the α-β transition, indicating that the behavior is not unique to single crystals [McKnight et al., 2008]; in novaculite and quartzite, the magnitude of the changes is muted (relative to single crystals) by the different orientations of the grains.
3.2 Effect of Pressure on Quartz Elasticity
The pressure dependence of the bulk modulus has been measured in quartz single crystals compressed in a diamond-anvil cell using X-ray diffraction [Angel et al., 1997], and the complete stiffness tensor, Cij, of quartz has been measured in a hydraulic press to 1 GPa using ultrasonic travel times [Calderon et al., 2007] and by Brillouin spectroscopy along with the pressure derivatives [Wang et al., 2014]. Cij have also been calculated at high pressure using density functional theory [Kimizuka et al., 2007]. These methods obtained slightly different results, but the 1 GPa values for the bulk modulus for all the studies are relatively similar—40.4 [Calderon et al., 2007], 41.3 GPa [Angel et al., 1997; Kimizuka et al., 2007], and 43.4 GPa [Wang et al., 2014].
Experiments have also been conducted on quartzite at 25°C and pressures to 1 GPa using the pulse-transmission technique [Christensen, 1965, 1966, 1996; Musacchio et al., 1997]. The application of modest pressure is required to close cracks in polycrystalline materials; measured elastic properties above ∼200 MPa show the expected linear dependence on pressure [Christensen, 1965; Kern et al., 2008].
3.3 Effect of Pressure and Temperature on Quartz Elasticity
There has been minimal investigation of the elastic properties of quartz at high pressure and temperature—in fact, 0.2 GPa is the highest pressure at which elevated-temperature measurements have been done, and only on quartzite [Fielitz, 1971; Christensen, 1979; Kern, 1979; Lu and Jackson, 1998]. At 0.2 GPa, thermally induced cracks in quartzite are closed [e.g., Lu and Jackson, 1998], and the α-β transition induces a reduction in VP [Fielitz, 1971; Christensen, 1979; Kern, 1979] identical to that seen in quartz single crystals. One set of experiments on a metasedimentary rock with 36% quartz demonstrated that the acoustic changes associated with the α-β transition at 1 atm are also seen at temperatures appropriate for the α-β transition pressures of 200–400 MPa [Zappone and Benson, 2013].
3.4 Summary
None of this unusual elastic behavior of quartz is well fit by the standard thermal expansion models used for other minerals. For these reasons, the algorithm included in this toolbox handles the elastic properties of α and β quartz independently from the primary calculation framework used for other minerals [Hacker and Abers, 2004], through a series of functional regressions on density, bulk, and shear modulus data (Figure 1). We assume, after Zappone and Benson [2013], that the elastic behavior of the α-β transition at elevated pressure is identical to that at 1 atm. Specifically, we assume that the temperature dependences of the elastic properties scale with the difference in temperature from the α-β transition, matching Ohno et al. [2006] at zero pressure and shifting to higher temperatures as the transition temperature increases with pressure [Shen et al., 1993]. The elastic moduli also increase with pressure as indicated by variable-pressure studies at room temperature [Angel et al., 1997; Calderon et al., 2007; Kimizuka et al., 2007; Wang et al., 2014]; we assume that the pressure variations are independent of temperature except in defining the temperature of the α-β transition. These assumptions remain to be tested by experiments—beyond Zappone and Benson [2013]—that measure the elastic properties of quartz at elevated P and T.
4 Excel Workbook
The Excel workbook is similar to the 2004 version, with the following changes: (a) the mineral-physics data in the “database” sheet has been updated, (b) the bulk-rock major element composition is now calculated and reported in the “rocks” page, and (c) more accurate elastic properties of quartz are now calculated in the code. Supporting information Table S1 describes codes for all references from which properties are derived, and supporting information Table S2 lists notes on database parameters not described previously [Hacker and Abers, 2004]. The workbook was tested under Microsoft Excel 2003 and 2010 for Windows.
5 Using the MATLAB Toolbox
To use the MATLAB toolbox, place the directory containing all.m code files and.txt database tables on your MATLAB search path, e.g., via the “addpath” function. In the compressed supporting information file distributed with this paper, this directory is called “ABERSHACKER16.” All of the files are described below and summarized in Table 1. The codes were tested under MATLAB 2014a.
File | Description |
---|---|
ah16_loaddb.m | Loads database files into MATLAB structures |
ah16_minervel.m | Calculates properties for all minerals at P, T |
ah16_rockvel.m | Calculates physical properties for composites (rocks) |
ah16_rockcomp.m | Major element compositions for rocks |
ah16_hsvbounds.m | Hashin-Shtrikman-Walpole bounds on elastic moduli |
ah16_guidriver.m | Creates graphical user interface |
rockvelcalculate.m | Example script demonstrating calculations |
test_quartz.m | Example script that created Figure 1 |
AbersHackerMacroJan2016.xls | Excel spreadsheet |
AbersHackerMacroJan2016.txt | Thermal-elastic database |
mindict_AbersHackerMacroJan2016.txt | Mineral names and rock compositions |
5.1 Data Files
- AbersHackerMacroJan2016.txt
- mindict_AbersHackerMacroJan2016.txt
The first file compiles the elasticity and thermodynamic data for each mineral, whereas the second includes a dictionary of mineral names and compositions, and a suite of model rock compositions. Both can be regenerated from the Excel spreadsheets if the user changes the primary values in the spreadsheets. To do so, open Excel and save (i) the “database” worksheet and (ii) the “rock mineral modes” worksheet, as “separate files of Windows Formatted Text (.txt).” The filenames can be changed, although the second filename must be the same as the first with “mindict_” prepended. As a caution, we found that Excel only exports numerical values to text files at the precision shown on the screen, so that severe roundoff errors can occur during generation of text files with insufficient precision. To generate the.txt tables provided here, we saved tables with six digits after the decimal for elastic moduli and oxide weights and with four digits for most other parameters, leading to consistency between Excel and MATLAB calculations better than one part in 10−6.
5.2 MATLAB Function Files
- ah16_loaddb.m: this function reads the two data files and creates MATLAB structures for use elsewhere. The input parameter is the filename of the primary thermoelastic database. Files are first searched for in the user's current directory, and then in the directory where this routine is located (e.g., ABERSHACKER16). Output includes a structure “minpropar” with physical properties for each mineral and a structure “compar” with compositional data for each mineral; both are keyed to a 2–5 letter code for each mineral. Optional output includes “mindict” a dictionary providing an explanation of the mineral code (full name, composition, and mineral family), and tables of model rock compositions “rocknames” and “rockmodes” providing a short name and mineral modes for those compositions. Unless otherwise stated, these rock names and modes correspond to the mafic and ultramafic compositions described in Hacker et al. [2003].
- ah16_minervel.m: calculates elastic properties for a single mineral at elevated T and P. Input parameters are T, P, and a MATLAB structure of mineral properties of the same form as minpropar above, but for one mineral. Quartz is handled by an internal function in this file. Outputs include scalar density, elastic moduli, and velocities for the mineral at the specified P and T.
- ah16_rockvel.m: calculates physical properties for a mineral composite (rock) at elevated temperature and pressure. Input parameters are T, P, the minpropar structure, and a list of minerals and their modal abundances in the rock of interest. Creates a structure with the elastic moduli, velocities, and densities for the rock at the specified P and T, as well as structures with Hashin-Shtrikman bounds and Voigt-Reuss bounds on elasticity. Optionally, this routine also calculates major element oxide abundances (wt %).
- ah16_rockcomp.m: calculates the major element compositions for a rock. The input is an array of mineral compositions (i.e., compar from ah16_loaddb) and an array of mineral modal abundances in vol %. Output is a structure like compar with aggregate rock composition as wt % oxides. Primarily used through calls to ah16_rockvel.
- ah16_hswbounds.m: calculates the Hashin-Shtrikman-Walpole bounds on the elastic moduli of a composite material [Berryman, 1995]. Primarily used through calls to ah16_rockvel.
5.3 MATLAB GUI
The function “ah16_guidriver.m” generates a simple graphical user interface (GUI) to allow quick calculation for a single rock (Figure 2). To use the calculator, enter P (GPa) and T (°C), enter the volume-fraction mode of each mineral in the “Mode” column, and press the “Go” button. The calculated physical properties (density, moduli, wave speeds, Poisson's ratio, and major element composition) appear in tables. Clicking on a mineral code in the left column of the “Mineral Mode” table generates a popup showing the full mineral name, chemical formula, and mineral family. The “Min. Dict.” button provides the same information for all minerals. The “Sum:” textbox at the bottom of the “Mineral Mode” table shows the sum of the mineral modes; these are renormalized to 100% prior to calculation. The “Rock Menu” button allowing users to select mineral modes for a predefined rock composition from the “mindict” table; users can add frequently used rocks as columns to this table. Data in the output tables can be copied and pasted into other windows or applications.

Snapshot of the GUI.
5.4 MATLAB Example Scripts
rockvelcalculate.m: this example script generates two plots (Figure 3). The first shows VP and VP/VS as a function of the Mg/(Mg + Fe) content in olivine, at constant P and T. The second shows the pressure dependence of VP and VS at constant temperature for fo90 olivine.
test_quartz.m: this script generates Figure 1, showing how velocities and impedances can be calculated over a range of conditions, in this case corresponding to two example geotherms. It illustrates the behavior of quartz across the α-β transition.

Velocities in olivine generated by the test script. (a) VP and VP/VS varying with Mg/(Mg + Fe) or mol % fo in olivine, at 3 GPa and 1000°C. (b) VP and VS varying with pressure for fo90 olivine, at 1000°C.
6 Summary
Updated data on mineral elastic and thermodynamic properties, along with increased development of elaborate calculations with high-level scripting languages, motivate the release of a new MATLAB toolbox and updated Excel workbook for rock velocity calculations. The unusual behavior of quartz, particularly as it passes through the α-β transition, receives special treatment. The MATLAB toolbox enables a wide variety of applications that predict velocities and other properties of rocks at elevated pressures and temperatures. The ease of its use, the inclusion of major element data, and a basic graphical user interface enable a wide variety of educational applications.
Acknowledgments
This work was funded by NSF award OCE-1446970 (G.A.) and EAR-1249703 (B.H.). All data used in this paper are taken from the references listed in supporting information Table S1. We thank the Associate Editor, C.-T. Lee, and the reviewer, M. Behn, for their constructive comments and suggestions. MATLAB is a registered trademark of The MathWorks, Inc. Excel is a registered trademark of Microsoft, Inc.