# Define temperature (degrees C), pressure (bar), pH and logfO2 ranges
T <- 200
P <- "Psat"
res <- 200
pH <- c(0, 14, res)
O2 <- c(-48, -33, res)
# Define system: Fe-Cu-O-S-Cl
# NOTE: the basis species must include the first species listed
# in each of bases, species1, and species2 below
basis(c("pyrite", "Cu", "Cl-", "H2S", "H2O", "oxygen", "H+"))
basis("H2S", -2)
# Calculate solution composition for 1 mol/kg NaCl
NaCl <- NaCl(T = T, P = P, m_tot = 1)
basis("Cl-", log10(NaCl$m_Cl))
# Define arguments for stack_mosaic: Speciate aqueous sulfur
bases <- c("H2S", "HS-", "HSO4-", "SO4-2")
# Calculate stabilities of Fe-bearing minerals first
species1 <- c("pyrite", "pyrrhotite", "magnetite", "hematite")
# Calculate stabilities of Cu-bearing and FeCu-bearing minerals second
species2 <- c("copper", "cuprite", "tenorite", "chalcocite", "covellite")
species12 <- c("chalcopyrite", "bornite")
# Use abbreviations for Fe-bearing minerals and formulas for Cu-bearing minerals
names1 <- c("Py", "Po", "Mag", "Hem")
names2 <- info(info(species2))$formula
names12 <- info(info(species12))$formula
names <- list(names1, names2, names12)
# Adjust x-position for one species (chalcocite, Cu2S)
dx <- list(c(0, 0, 0, 0), c(0, 0, 0, 1, 0), c(0, 0))
# Use thick dashed lines for the bimetallic species
lwd <- list(1, 1, 2)
lty <- list(1, 1, 2)
# Make the diagram
stack_mosaic(bases, species1, species2, species12, names = names,
dx = dx, lwd = lwd, lty = lty,
pH = pH, O2 = O2, T = T, P = P, IS = NaCl$IS)
# Add legend and title
lTP <- lex(lTP(T, P))
db <- describe.basis(c(3:4))
legend("topright", c(lTP, db), bg = "white")
title("Fe-Cu-S-O-H-Cl", font.main = 1)
Run the code above in your browser using DataLab