next up previous
Next: affinity Up: CHNOSZ examples Previous: basis

species

specis>   ## Don't show: 
specis> data(thermo)
thermo$obigt has 1800 aqueous, 2925 total species

specis> ## End Don't show
specis>   ## add, modify, delete species
specis>   basis("CHNOS")
    C H N O S ispecies logact state
CO2 1 0 0 2 0       69     -3    aq
H2O 0 2 0 1 0        1      0   liq
NH3 0 3 1 0 0       68     -4    aq
H2S 0 2 0 0 1       70     -7    aq
O2  0 0 0 2 0     2691    -80   gas

specis>   species(c("CO2","NH3"))  # aqueous species
  CO2 H2O NH3 H2S O2 ispecies logact state name
1   1   0   0   0  0       69     -3    aq  CO2
2   0   0   1   0  0       68     -3    aq  NH3

specis>   species(c("CO2","NH3"),"gas")  # gases
  CO2 H2O NH3 H2S O2 ispecies logact state           name
1   1   0   0   0  0       69     -3    aq            CO2
2   0   0   1   0  0       68     -3    aq            NH3
3   1   0   0   0  0     2683      0   gas carbon dioxide
4   0   0   1   0  0     2690      0   gas        ammonia

specis>   # delete the first couple of species
specis>   species(1:2,delete=TRUE)
  CO2 H2O NH3 H2S O2 ispecies logact state           name
1   1   0   0   0  0     2683      0   gas carbon dioxide
2   0   0   1   0  0     2690      0   gas        ammonia

specis>   # modify the logarithms of activities (actually
specis>   # fugacities) of the remaining species
specis>   species(1:2,c(-2,-5))
  CO2 H2O NH3 H2S O2 ispecies logact state           name
1   1   0   0   0  0     2683     -2   gas carbon dioxide
2   0   0   1   0  0     2690     -5   gas        ammonia

specis>   # set the species to aqueous
specis>   species(1:2,"aq")
  CO2 H2O NH3 H2S O2 ispecies logact state name
1   1   0   0   0  0       69     -2    aq  CO2
2   0   0   1   0  0       68     -5    aq  NH3

specis>   # delete all the species
specis>   species(delete=TRUE)
NULL

specis>   ## add and delete species
specis>   basis(c("CaO","CO2","H2O","SiO2","MgO","O2"))
basis: changed basis to CaO CO2 H2O SiO2 MgO O2.
     C Ca H Mg O Si ispecies logact state
CaO  0  1 0  0 1  0     1958      0    cr
CO2  1  0 0  0 2  0       69      0    aq
H2O  0  0 2  0 1  0        1      0   liq
SiO2 0  0 0  0 2  1       72      0    aq
MgO  0  0 0  1 1  0     1993      0    cr
O2   0  0 0  0 2  0     2691      0   gas

specis>   # a species with Fe (faylite) can be loaded,
specis>   # but its initial logarithm of activity is NA to
specis>   # indicate that it falls outside the basis definition
specis>   species(c("dolomite","quartz","calcite","forsterite","fayalite"))
basis.comp: missing element Fe from species 1904.
  CaO CO2 H2O SiO2 MgO O2 ispecies logact state       name
1   1   2   0    0   1  0     1892      0    cr   dolomite
2   0   0   0    1   0  0     2005      0   cr1     quartz
3   1   1   0    0   0  0     1851      0    cr    calcite
4   0   0   0    1   2  0     1920      0    cr forsterite
5   0   0   0    1   0  1     1904     NA    cr   fayalite

specis>   # changing the elements in the basis definition
specis>   # causes species to be deleted
specis>   basis(c("CO2","H2O","O2"))
basis: changed basis to CO2 H2O O2.
    C H O ispecies logact state
CO2 1 0 2       69      0    aq
H2O 0 2 1        1      0   liq
O2  0 0 2     2691      0   gas

specis>   species()  # NULL
NULL


next up previous
Next: affinity Up: CHNOSZ examples Previous: basis