Define the species of interest in a system; modify their physical states and logarithms of activities.
character, names or formulas of species to add to the species definition; numeric, rownumbers of species to modify or delete
character, physical states; numeric, logarithms of activities or fugacities
logical, delete the species identified by numeric values of
logical, return the affected rownumbers of
After defining the
basis species of your system you can use
species to identify the species of interest.
A species is operationally a combination of a
state, which are columns of the thermodynamic database in
The function operates on one or more character values of
For each first match of
species (optionally restricted to a
state among aq, cr, gas, liq) to the name of a species or a formula or abbreviation in the thermodynamic database, a row is added to
The data frame in
thermo$species holds the identifying characteristics of the species as well as the stoichiometric reaction coefficients for the formation of each of the species from the basis species, the logarithms of activities or fugacities that are used by
The default values for logarithms of activities are -3 for aqueous (aq) species and 0 for others.
NULL (the default), species in any state can be matched in the thermodynamic database.
If there are multiple matches for a species, the one that is in the state given by
thermo$opt$state is chosen, otherwise the matching (or n'th matching duplicate) species is used.
Note that the
states of species representing phases of minerals that undergo phase transitions are coded as cr (lowest-T phase), cr2, cr3,
... (phases with increasing temperature).
state is cr when one of these minerals is matched, all the phase species are added.
To modify the logarithms of activities of species (logarithms of fugacities for gases) provide one or more numeric values of
species referring to the rownumbers of the species dataframe, or
species NULL, to modify all currently defined species.
The values in
state, if numeric, are interpreted as the logarithms of activities, or if character are interpreted as states to which the species should be changed.
species is numeric and
TRUE, the rows representing these species are deleted from the dataframe; if the only argument is
delete and it is
TRUE, all the species are removed.
With no arguments or when adding species,
species returns the value of
index.return is TRUE, when the function returns the rownumbers of
thermo$species having the new species.
With delete=TRUE, the value is the definition that existed prior the deletion; with delete=TRUE and species not NULL, the number of species remaining after the selected ones have been deleted, or
NULL if no species remain.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# set up the basis species basis("CHNOS") # add, modify, delete species species(c("CO2","NH3")) # aqueous species species(c("CO2","NH3"),"gas") # gases # delete the first couple of species species(1:2,delete=TRUE) # modify the logarithms of activities (actually # fugacities) of the remaining species species(1:2,c(-2,-5)) # set the species to aqueous species(1:2,"aq") # delete all the species (returns the existing species # definition, then deletes the species) sd <- species(delete=TRUE) # changing the elements in the basis definition # causes species to be deleted basis(c("CaO", "CO2", "H2O", "SiO2", "MgO", "O2")) species(c("dolomite", "quartz", "calcite", "forsterite")) basis(c("CO2", "H2O", "O2")) species() # NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.