## Abstract

EntraPT is a web-based application for elastic geobarometry freely accessible at the “Fiorenzo Mazzi” experimental mineralogy lab website (http://www.mineralogylab.com/software/). It provides an easy-to-use tool to calculate the entrapment conditions of inclusions, with error propagation, from the residual strain measured in mineral inclusions. EntraPT establishes a method and a workflow to import and analyze the measured residual strains, correctly calculates the mean stress in the inclusions, computes the entrapment isomekes with uncertainty estimation, and visualizes all the results in relevant graphs. It enables the user to avoid the many possible errors that can arise from manual handling of the data and from the numerous steps required in geobarometry calculations. All of the data, parameters, and settings are stored in a consistent format and can be exported as project files and spreadsheets, and imported back to EntraPT for further analysis. This allows researchers to store and/or share their data easily, making the checking and the comparison of data and results reliable. EntraPT is an online tool that does not require any download and/or installation, and it will be updated in the future with new functionalities made available from advances in the development of elastic geobarometry.

## Introduction

Mineral inclusions entrapped in their mineral hosts have provided fundamental information on geological processes, first through simple phase identification (e.g., Chopin 1984). More recently, advances in mineral physics data and the widespread availability of analysis tools such as Raman spectrometers have resulted in the rapid development of the field of piezobarometry for a wide range of geological settings. Residual strains are developed in inclusions because of the contrast between their elastic properties and those of their host. If the residual strain is measured and interpreted correctly, the conditions at entrapment (*P*_{trap}, *T*_{trap}) can be determined by using the elastic properties of the host and the inclusion. The basic concept has been known for a long time (e.g., Rosenfeld and Chase 1961; Gillet et al. 1984; Izraeli et al. 1999; Zhang 1998). Current applications are based on the assumptions that both the host and inclusion minerals are elastically isotropic and that the inclusion is an isolated sphere. Under such conditions, the stress in the inclusion will be a hydrostatic pressure. It can be determined by measuring the shift of the Raman lines of the inclusion or the unit-cell volume of the inclusion by diffraction. In the absence of plastic or viscous deformation (e.g., Zhong et al. 2018, 2020), the determination of possible entrapment conditions, the entrapment isomeke, is then a straight-forward calculation that is implemented in several freeware programs such as EosFit7c (Angel et al. 2014a), EosFit-Pinc (Angel et al. 2017a), QuIB-calc (Ashley et al. 2014), or the algorithm published in Kohn (2014).

However, no mineral crystal is elastically isotropic, and no inclusion is a perfect isolated sphere. As a consequence, the stress field inside the inclusion is not hydrostatic when the host is in the laboratory (Eshelby 1957; Murri et al. 2018; Mazzucchelli et al. 2018, 2019). The shifts of Raman lines of the inclusion are therefore different from those under hydrostatic conditions (e.g., Anzolini et al. 2018; Thomas and Spear 2018). Using hydrostatic calibrations of Raman shifts (e.g., Enami et al. 2007; Ashley et al. 2016) can lead to significantly inaccurate estimates of the residual “pressure” in the inclusion and, in turn, of the entrapment conditions, leading to fundamental misinterpretations of geological processes. The shifts of Raman lines of inclusions are correctly interpreted through the mode Grueneisen tensors of the inclusion crystal (e.g., Grüneisen 1926; Barron et al. 1980; Angel et al. 2019). These tensors allow the strains of the inclusion crystal relative to a free crystal to be determined from the measured Raman shifts. Or, the strains can be determined by direct in situ diffraction measurements of the inclusion (e.g., Nestola et al. 2011; Alvaro et al. 2020). Once the strains are determined, the residual stress and the residual pressure in the inclusion can be determined via the elastic tensor. Bonazzi et al. (2019) showed that the entrapment conditions of synthetic quartz inclusions can be determined in this way even in the presence of deviatoric stress.

The determination of reliable geological conditions of inclusion entrapment from non-spherical anisotropic inclusions is thus far more complex, involving several intermediate steps with tensor calculations, than the isotropic approach embodied in existing software. Shape corrections are made with the relaxation tensor of the inclusion that, for non-ellipsoidal inclusions or anisotropic hosts, must be determined with numerical calculations such as finite element modeling (Mazzucchelli et al. 2018, 2019; Morganti et al. 2020; Alvaro et al. 2020). Therefore, we have developed EntraPT, a web application that implements the methods developed by Angel et al. (2019) and Murri et al. (2018) and applied by Bonazzi et al. (2019), to correctly calculate the mean stress in inclusions from the measured strains, and then to calculate entrapment isomekes with the isotropic model including the propagation of uncertainties. EntraPT is freely accessible after registration. It can be used to process strain data from a single inclusion or large data sets of residual strains of multiple inclusions to obtain entrapment conditions and to easily generate plots. In this paper, we introduce the EntraPT program, document its methods, and illustrate its functionalities. A guided example of a step-by-step analysis of a data set of quartz inclusions entrapped in almandine (Bonazzi et al. 2019) is provided in the Online Material^{1}.

## Program description

The successful determination of the *P-T* of metamorphism using elastic geothermobarometry ideally requires the analysis of a large number of inclusions (e.g., Bonazzi et al. 2019). Because of the contrast in elastic properties between the two minerals, some host-inclusion systems are good geothermometers (e.g., zircon in garnet) while others are good barometers (e.g., quartz in garnet), and their coexistence in the same rock might provide a constraint on the metamorphic *P-T* path of the rock because of the different slopes of their isomekes (e.g., Zhong et al. 2019). Furthermore, to interpret correctly the conditions of metamorphism it is necessary to account for all of the uncertainties from the measurement of the residual strain to the calculation of the entrapment conditions. EntraPT is a MATLAB based online application with a Graphical User Interface (GUI) that can be used to (see Fig. 1): (1) import and visualize the residual strain and the associated uncertainties from measurements in inclusions (Figs. 1c–1f); (2) correctly calculate the mean stress in inclusions from the measured strains (Fig. 1g); (3) calculate entrapment isomekes with the isotropic model of Angel et al. (2017a) with uncertainty propagation; (4) plot the entrapment isomekes for multiple inclusions simultaneously (Fig. 1h); and (5) export all the data and results as project files or spreadsheets to store and share them (Fig. 1i).

EntraPT is freely accessible upon registration as an online application at the website of the “Fiorenzo Mazzi” Experimental Mineralogy Lab (http://www.mineralogylab.com/software/). EntraPT is supported on most of the common browsers and operating systems (Windows, macOS, Linux), and no download and/or installation is required. The app was developed with MATLAB AppDesigner and deployed with the MATLAB Compiler on Web App Server. For all of the calculations based on the equations of state (EoS) of the minerals (e.g., the calculation of the residual pressure and of the entrapment isomeke), EntraPT relies on Eosfit7 (Angel et al. 2014a) a stable and efficient Fortran code that has been validated over many years. Eosfit7n, a fast version of the program without a console or GUI for direct user interaction, is embedded in EntraPT. The instructions and EoS parameters for calculations are sent from EntraPT to Eosfit7n as files. Once the calculations are terminated, the output generated by Eosfit7n is read back into EntraPT. The use of EosFit7n as a separate executable ensures that in the future EntraPT will be able to access new EoS forms and other developments introduced into the CrysFML library (Rodriguez-Carvajal and González-Platas 2003) and the EosFit program suite.

The user interface of EntraPT consists of three main tabs: (1) Add New Analyses, (2) Calculate Entrapment, and (3) View Data (Figs. 2a–2c) designed to guide the user through the required work path. The workflow, from the definition of the host-inclusion system to the calculation of entrapment conditions and the data visualization, is illustrated in detail in the Online Material^{1}, taking as an example the data set of quartz inclusions entrapped in almandine reported by Bonazzi et al. (2019). EntraPT works on analyses. Each analysis is a container of all of the information relative to one measurement of residual strain and the calculations performed on it. An “analysis” is defined at least by:

A label.

A pair of mineral phases: the host and the inclusion phase.

The elastic properties of the host and the inclusion (EoS, stiffness tensors).

The geometry of the host-inclusion system.

The relative orientation between the host and the inclusion.

The residual strain state defined by the components of residual strain vector, and its covariance matrix.

Other data that can be optionally associated with an analysis are:

The labels of the sample, thin section, host, inclusion, and of the point analysis.

A text description.

The results of the calculation of its entrapment conditions (i.e.,

*P*and*T*of the entrapment isomeke, and all the intermediate results, such as residual stress, unrelaxed strain, their covariance matrices, etc.).

With this definition, two measurements of residual strain taken in the same inclusion crystal are stored and treated as separate analyses in EntraPT. In fact, even if they belong to the same host-inclusion system (same mineral phases, geometry, and orientation), they can differ in the residual strain. For the same reason, measurements from several inclusions in the same host crystal are also considered as separate analyses. This allows for great flexibility in storing and processing the measurements since each of them can have different data and metadata and can be handled separately.

EntraPT makes use of the Voigt notation (Voigt 1910) to represent tensors, and this notation will be assumed throughout this paper. Therefore second rank tensors are represented as vectors and fourth rank tensors as matrices. The mapping of the indices between the tensor notation and the vector (Voigt) notation is the following:

## Properties of the host-inclusion system

In EntraPT, the user first adds one or more new analyses to the project from the “Add New Analyses” tab (Fig. 2a), where the host and the inclusion minerals, the geometry of the system, and their relative orientation must be chosen. The calculation of the entrapment conditions requires the elastic properties of the minerals. EntraPT is based on an internally consistent database of elastic properties (Table 1). The database contains for each mineral phase the volume EoS and, for inclusions, the fourth rank elastic tensor at room conditions. The elastic tensors are taken from experimental determinations reported in the literature, and, if necessary, their components are rescaled to ensure that the Reuss bulk modulus equals that of the volume EoS (Table 1) at room temperature and pressure conditions. This ensures consistency throughout the entire calculation. During the rescaling, care is taken that the degree of anisotropy (evaluated through the Universal anisotropic index, Ranganathan and Ostoja-Starzewski 2008) is not altered (see Mazzucchelli et al. 2019 for further details). Only phases with published and validated elastic properties and EoS are included in the program database. In the current version, aluminosilicate garnet end-members (e.g., pyrope, almandine, and grossular) and diamond are available as hosts. The inclusion can be chosen among quartz, zircon, diamond, and garnet. Additional hosts and inclusion minerals will be added as further internally consistent elastic data and EoS become available.

## Residual strain

Once the properties of the system are set, the user must input the residual strain measured in the inclusion for each analysis (Fig. 2g). As shown by Murri et al. (2018) and Angel et al. (2019) the strain state can be obtained from the measured Raman shifts by applying the concept of the phonon-mode Grüneisen tensor. This can be done easily for inclusions such as quartz and zircon using stRAinMAN (Angel et al. 2019), a free program that can be downloaded at http://www.rossangel.com/. stRAinMAN allows the user to load the measured Raman shifts and to export the resulting strain components and the associated standard deviations and correlations in a logfile. For a uniaxial inclusion without symmetry breaking, stRAinMAN provides an output with the sum of the strain components (in Voigt notation) ε_{1} + ε_{2}, the component ε_{3}, their estimated standard deviations (e.s.d.), and the covariance between ε_{1} + ε_{2} and ε_{3}.

If the strain is measured with X-ray diffraction, measurements need to be carefully interpreted because irregular and faceted inclusions may exhibit stress and strain gradients. In this case, diffraction measurements only provide some average value of strain over the whole inclusion volume that cannot be used directly in elastic geobarometry (e.g., Campomenosi et al. 2018; Mazzucchelli et al. 2018; Murri et al. 2018; Alvaro et al. 2020). However, with XRD the value of each strain component (together with their e.s.d. and covariances) can be determined independently.

The user can input the components of the residual strain and the associated uncertainties into EntraPT for each analysis. The e.s.d. values and the covariances associated with the residual strains are needed to propagate the uncertainties into the residual pressure and the entrapment isomeke. Since the application of elastic geobarometry usually requires the processing of several measurements performed on several inclusions, the user has the option of importing a text file with a list of analyses with their strains and the associated uncertainties. The input file can be selected with a file-browser window, and it is uploaded to the server via a secure SSL connection. This procedure, applied to the data of Bonazzi et al. (2019), is described in detail in the Online Material^{1} and shown in Online Material^{1} Fig. OM2. Template files are provided with the program on the website https://www.mineralogylab.com that can be edited with a spreadsheet editor to preserve the tab-delimited structure. Each row of this file stores the data of one analysis, i.e., of one measurement. All of the analyses in one input file must belong to the same host-inclusion system (i.e., same host and inclusion phases). The file format allows each analysis to be identified (sample, thin section, host, inclusion, and point analysis) and notes associated to the analysis to be recorded. The content of the remaining columns depends on the symmetry of the residual strain, which corresponds to the symmetry of the inclusion in absence of symmetry breaking (see Online Material^{1} Table OM1 and the *.dat file for an example). The measured strain components and the statistical parameters (e.s.d., covariances) can be easily copied and pasted from the stRAinMAN logfile to this input file using any spreadsheet editor. During the import process, EntraPT checks that the file is readable and that the data are consistent. Depending on the symmetry of the inclusion selected by the user in the app, a minimum number of independent strain components is required. Moreover, the symmetry of the inclusion prescribes the equality between some of the components of the strain. A check is also performed on the consistency of the provided e.s.d. and covariances, since the resulting covariance matrix must be positive definite. Analyses that do not satisfy these requirements are discarded during the import process, and a detailed message describing the errors is shown to the user. EntraPT requires the full 6 × 6 covariance matrix **V**^{ε} of the residual strain values to propagate the uncertainties through the calculations of the residual pressure and the entrapment isomeke. For a general state of residual strain with six independent components in Voigt notation (ε_{1}, ε_{2}, ε_{3}, ε_{4}, ε_{5}, ε_{6}), the fully symmetric covariance matrix **V**^{ε} is defined as:

where esd(ε_{i}) is the estimated standard deviation on the *i*-th component of the strain vector (in Voigt notation), and cov(ε_{i}, ε_{j}) is the covariance between the strain components *i* and *j*.

The e.s.d. values and the covariances of the residual strain of uniaxial and cubic inclusions are automatically translated by EntraPT into the full 6 × 6 covariance matrix *V*^{ε} of the residual strain. For uniaxial inclusions (i.e., trigonal, tetragonal, and hexagonal crystal systems) without symmetry breaking, two normal strain components are equal (ε_{1} = ε_{2}), while the third (ε_{3}) is different. The shear components are absent (ε_{4} = ε_{5} = ε_{6} = 0). When the residual strain of uniaxial inclusions is determined from Raman spectroscopy through the stRAinMAN program, the strain sum ε_{1} + ε_{2} and ε_{3} are given as output together with the corresponding uncertainties esd(ε_{1} + ε_{2}), esd(ε_{i}). The covariance between ε_{1} + ε_{2} and ε_{3} is also computed and reported as cov(ε_{1} + ε_{2}, ε_{3}). Given these parameters, and assuming that ε_{1} = ε_{2} are completely correlated, the full covariance matrix of the residual strain **V**^{ε} is assembled by EntraPT as:

For cubic crystals without symmetry breaking, the normal strain components are equal ε_{1} = ε_{2} = ε_{3}, the shear components are absent (ε_{4} = ε_{5} = ε_{6} = 0) and the residual volume strain is ε_{V} = ε_{1} + ε_{2} + ε_{3}. Given the uncertainty on the volume strain esd(ε_{V}), the full covariance matrix of the residual strain *V*^{ε} is:

Once the strains are imported or set in the program, the user can add the analyses to the current project.

## Calculation of the entrapment isomeke with uncertainties

The possible entrapment conditions, i.e., points on the entrapment isomeke (Rosenfeld and Chase 1961; Angel et al. 2014b, 2015b), of each analysis can be calculated from the “Calculate Entrapment” tab (Fig. 2b). This calculation using isotropic elasticity and the full nonlinear EoS of the host and inclusion requires the knowledge of the residual pressure of the inclusion (Angel et al. 2017a). As shown by Bonazzi et al. (2019), when the residual strain of the inclusion is used, there are two possible definitions of residual pressure (*P*_{inc}) for anisotropic inclusions:

(1) The residual stress can be calculated from the residual strain as:

where *C*_{ij} is the matrix representation in Voigt notation of the fourth rank elastic modulus tensor of the inclusion determined at room conditions. The pressure is then the negative of the mean normal stress:

(2) Alternatively, the residual volume strain can be found as the sum of the normal components of the strain:

from which the residual pressure is obtained using the EoS of the inclusion as:

By default, EntraPT uses model 1 for the calculation of residual pressure. However, the user can enable the “Expert mode” panel from the “Settings” menu and choose model 2 or both the models to explore a comparison of the results (the procedure is explained in details in the Example section of the Online Material^{1}). The covariance matrix of the residual strain is used to propagate the uncertainties on the calculated residual pressures and the isomekes. If model 1 is selected (Eq. 4), the covariance matrix on the residual stress (**V**^{σ}) in the inclusion is obtained from that on the residual strain (**V**^{ε}) as:

where * C* is the matrix representation in Voigt notation of the fourth rank elastic modulus tensor of the inclusion, and

**C**^{T}its transpose. Equation 8 assumes that the uncertainties of the elastic components (usually <2%, e.g., Lakshtanov et al. 2007) are negligible compared to the uncertainties of the measured strains that are typically larger than 5% (Bonazzi et al. 2019). Moreover, the covariances of the elastic components determined experimentally are often not reported in the literature and cannot therefore be used for error propagation.

Once the residual stress and its covariance matrix are known, the standard deviation on the residual pressure $Pincstrain$ (Eq. 5) can be found as:

On the other hand, if model 2 is selected, the uncertainty on the strain components is propagated into the estimated standard deviation of the volume strain esd(ε_{V}) as:

Given this uncertainty on the volume strain the standard deviation on the residual pressure $PincV$ (Eq. 7) is found as:

The calculation of the possible entrapment conditions for the host-inclusion pair is performed assuming isotropic elasticity with the model proposed by Angel et al. (2017a), using the nonlinear elasticity of the host and the inclusion. The calculation of the entrapment isomeke is performed calling the specific routines in the Eosfit7n program. Since the calculation of the residual pressure (Eqs. 4–5) requires the elastic tensors (**C**) of each inclusion, which are mostly only known for room *P-T* (1 bar, 25 °C), EntraPT is necessarily restricted to calculations from strain measured when the host is at room conditions. The user can set the range of temperatures for the calculation of the entrapment isomeke. The uncertainties on the entrapment isomeke pressures are estimated from the standard deviation on the residual pressure esd(*P*_{inc}), by assuming an uncertainty on the residual pressure equivalent to one standard deviation as:

The entrapment isomeke is computed for each value of residual pressure. Therefore, for each temperature step along the isomeke (*T*_{iso}), *P*_{iso} is the mean value of the pressure on the isomeke, while $Pisomax$ and $Pisomin$ are the boundaries on the uncertainty, associated with one standard deviation on the residual pressure. For each *T*_{iso} on the isomeke the corresponding uncertainty on the *P*_{iso} is obtained as:

Once the calculation is completed, the results of the calculation (residual stress, pressure, *P-T* points on the entrapment isomekes) of each analysis are stored in the current project. An example of the use of EntraPT to calculate the entrapment isomekes of multiple analyses is reported in the Online Material^{1}.

## Viewing and plotting data

In the “View Data” tab (Fig. 3) the user can view all of the data relative to each analysis and generate relevant plots. The residual strain of one or more analyses can be analyzed visually in a scatter plot from the “Plot Strain” page (Fig. 3d). Figure 3f shows the ε_{3} vs. ε_{1} plot with the strain data measured by Bonazzi et al. (2019) on several quartz inclusions in almandine (the procedures to generate such plot are described in the Online Material^{1}). For each analysis, the associated confidence ellipse is shown, as obtained from the variance-covariance matrix **V**^{ε} determined from the measurement of the residual strain. For a visual reference, the isochors and the lines of isotropic strain and hydrostatic stress state of a crystal of the same phase as the inclusion can be added to the plot (Fig. 3h). The results of the calculation of the entrapment isomeke are shown in the “Results” page (Fig. 3b). The user can also generate a *P-T* plot with the isomeke(s) of one analysis together with the estimated uncertainty shown as a shaded area from the “Plot Isomekes” page (Fig. 3c; Online Material^{1} Fig. OM5). The isomekes of multiple analyses also can be plotted at the same time, even if they belong to different host-inclusion systems. This is particularly useful for constraining the metamorphic conditions if several host-inclusion systems within the same rock were measured. Since some host-inclusion systems are good barometers (e.g., quartz in garnet) while others are good thermometers (e.g., zircon in garnet), the intersection of their isomekes can provide constraints on the *P-T* path of the rock (e.g., Zhong et al. 2019).

## Export and import of data

Project files that contain all of the data from all of the analyses (elastic properties, strain given as input, covariance matrices, calculation parameters, results, notes, etc.) are stored in a database-like format and can be downloaded to the user’s computer. Project files can be imported back into EntraPT to view the data and generate the plots. Importing a project file puts EntraPT in the same configuration as when the project file was created. Once a project is loaded, new analyses can be added or existing analyses can be deleted. Moreover, multiple project files can be merged in EntraPT to create larger databases. Such project files can be easily shared, making the checking and the comparison of data and results reliable. The project file can be easily imported into MATLAB and custom scripts can be developed to further process the data and to generate custom plots, taking advantage that all of the data are structured consistently in the project file. An example of these scripts is included in the Online Material^{1}, and a custom plot generated with it is shown in Online Material^{1} Fig. OM6. During the export procedure from EntraPT, the user can also choose to save the data to spreadsheets that can be read by any commonly used spreadsheet application, such as Microsoft Excel or LibreOffice. To preserve the privacy of the users and the complete control of their data, all of the data are deleted from the server when the EntraPT session is terminated and cannot be recovered even by the server administrators. Therefore, downloading the project to the user’s computer is the only way to have access to the data after the EntraPT session is terminated. The upload and the download of the data to and from the server is always performed over a secure SSL connection.

## Implications

EntraPT is a web-based application freely accessible at http://www.mineralogylab.com/software that provides an easy-to-use tool to calculate entrapment pressures with error propagation from the residual strain measured in mineral inclusions. It obviates the many pitfalls that can arise from manually handling large amounts of data in the multi-step calculations required for elastic geobarometry. EntraPT establishes a consistent workflow to import and visually analyze the measured residual strains, correctly calculate the mean stress in the inclusions, compute the entrapment isomekes with uncertainty estimations and plot the results. With EntraPT, all of the data are stored in a consistent format and can be exported as project files and spreadsheets. This allows the data to be shared easily, making the checking and the comparison of data and results reliable. EntraPT will be constantly updated without requiring the user to download any program. EntraPT is designed on a modular basis, which will allow its functionalities to be expanded in the future, as automated corrections for the geometry of the system and the use of the full elastic anisotropy of the host and the inclusion are developed.

## Acknowledgments and Funding

We thank M. Bonazzi, N. Campomenosi, M. Gilio, A. Girani, J. Gonzalez, G. Mingardi, M. Morana, G. Rustioni, H. van Schrojenstein Lantman (who also named EntraPT) for comments, data, and help in testing the development versions of EntraPT. L. Brandolini, M. Cuman, D. Lanterna, and M. Parvis are thanked for support with the IT infrastructure, the website and the graphical design. J. Thomas and G. Bonnet are gratefully acknowledged for their positive and useful reviews. This project was supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement no. 714936 for the project TRUE DEPTHS to M. Alvaro). M.A. has also been supported by the Ministero dell’Università e della Ricerca (MUR) for the project Dynastar (PRIN-2017ZE49E7).

## Endnote:

^{1}