mix {CHNOSZ}R Documentation

Combine Diagrams for Multi-Metal Systems

Description

Combine diagrams for different systems by mashing or rebalancing two diagrams or mixing two diagrams with a third.

Usage

  mash(d1, d2)
  rebalance(d1, d2, balance = NULL)
  mix(d1, d2, d3, parts = c(1, 1), .balance = NULL)

Arguments

d1

list, output of diagram for the first mono-metallic system

d2

list, output of diagram for the second mono-metallic system

balance

character or numeric, specification of secondary balancing coefficients

d3

list, output of diagram for the bimetallic system

parts

numeric, amount of each metal (i.e. fixed composition) for the mixed system

.balance

argument for internal use only

Details

These functions make a new affinity object from the output of diagram. The result can be used to make a new diagram that shows the combined system.

mash creates a set of intersecting predominance fields for all possible combinations of species in d1 and d2. The new names are formed from the names used in the source diagrams; for example if "Cp" and "Py" are predominant minerals at the same position in diagrams 1 and 2, the field for the mashed diagram will be labeled "Cp+Py". The affinities are calculated by summing the formation reactions from the two diagrams to give equal parts of the balancing coefficients in d1 and d2 (that is, equal parts of two different metals). Note that the actual values of the affinities (and therefore the ratio between the metals) doesn't affect the resulting diagram because the affinities are assigned values of -Inf wherever one of the species is not predominant in the respective single-metal diagram.

mix is an expanded form of mash that allows combinations not only between two single-metal diagrams (d1 and d2) but also between each of those diagrams and third diagram for bimetallic species (d3). All combinations of species in all crosses between the diagrams (d1-d2, d1-d3, d2-d3, d3-d3) are identified. The mole fractions of species in each combination are computed to satisfy the ratio of metals defined in parts. For example, if d1 and d2 are balanced on Fe+2 and VO4-3, the species are combined by default to give equal parts of Fe and V. Note that pairs of bimetallic species in d3 are included as well as single bimetallic species that satisfy the composition in parts (e.g. FeV for c(1, 1) or Fe3V for c(3, 1)).

From the possible combinations of species, combinations are removed that have a negative mole fraction of any species or that involve any mono-metallic species that has no predominance field in the corresponding single-metal diagram. The output consists of each unique combination of species, including the combined formation reactions and affinities (in the species and values elements of the output list), The affinities are assigned values of -Inf wherever one of the species is not predominant in the respective single-metal diagram. Therefore, either the single-metal diagrams (d1 or d2) can be recovered by setting parts to c(1, 0) or c(0, 1), respectively.

NOTE: Unlike the diagram calls used to make d1 and d2, which by themselves should produce reasonable diagrams for a single-metal system, the d3 diagram by itself probably has no useful interpretation. It is only used in mix as a way to transmit the results of affinity for the bimetmal system and the formatted names that are made by diagram.

rebalance creates a new set of affinities of reactions between species in both systems. Diagrams for different systems likely use different primary balancing coefficients, such as balancing on different metals. rebalance uses secondary balancing coefficients, specified acording to balance (see equilibrate for a description of this argument), to determine the reactions between the species in the two systems. The affinities of these reactions are then used only to identify the predominant species at each grid point. The returned value of affinity are carried forward from those used to make the source diagrams (‘⁠plotvals⁠’ in d1 and d2), and therefore reflect the primary balancing coefficients. The returned values are assigned -Inf wherever that species is determined to not predominate according to the secondary balancing.

Because mash yields finite values of affinity for only a single species at any grid point, the final diagram can be made with any setting of balance. mix gives combinations of species that each have the amount of metals defined in parts, so it makes no difference whether the final diagram is balanced on either of the metals, or on formula units (balance = 1). However, for rebalance, balance in the final diagram should be set to ‘⁠1⁠’ to balance on formula units in order to preserve the primary balancing coefficients.

Value

A list object with the same structure as the output from affinity, so it can be used as input to diagram.

See Also

More examples are in the vignette multi-metal.

Examples


par(mfrow = c(2, 2))
# Define basis species with Fe and Cu
basis(c("Fe+2", "Cu+", "hydrogen sulfide", "oxygen", "H2O", "H+"))
xlab <- ratlab("Fe+2", "Cu+")
# Calculate diagram for only Fe-bearing minerals
species(c("pyrite", "pyrrhotite", "magnetite", "hematite"))
aFe <- affinity("Fe+2" = c(0, 12), O2 = c(-40, -16), T = 400, P = 2000)
dFe <- diagram(aFe, xlab = xlab, main = "Fe-S-O-H")
# Calculate diagram for only Cu-bearing minerals
species(c("covellite", "chalcocite", "tenorite", "cuprite"))
aCu <- affinity(aFe)  # argument recall
dCu <- diagram(aCu, xlab = xlab, main = "Cu-S-O-H")
### mash() diagram
ac <- mash(dFe, dCu)
diagram(ac, xlab = xlab, main = "Cu-Fe-S-O-H with mash()")
### rebalance() diagram
ad <- rebalance(dFe, dCu)
diagram(ad, xlab = xlab, balance = 1, main = "Cu-Fe-S-O-H with rebalance()")
db <- describe.basis(3)
leg <- lex(lTP(400, 2000), db)
legend("bottomleft", legend = leg, bty = "n")

[Package CHNOSZ version 2.1.0 Index]