Next: diagram: amino acid example
Up: CHNOSZ examples
Previous: species
affnty> ## Don't show:
affnty> data(thermo)
thermo$obigt has 1800 aqueous, 2925 total species
affnty> ## End Don't show
affnty>
affnty> ## set up a system and calculate
affnty> ## chemical affinities of formation reactions
affnty> basis(c("SiO2","MgO","H2O","O2"),c(-5,-5,0,999))
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
affnty> species(c("quartz","enstatite","forsterite"))
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
affnty> # chemical affinities (A/2.303RT) at 25 deg C and 1 bar
affnty> affinity()
affinity: temperature is 25 C
energy.args: pressure is Psat
subcrt: 7 species at 298.15 K and 1 bar (wet)
$sout
$sout$SiO2
T P logK G
1 298.15 1 146.0076 -199190
$sout$periclase
T P logK G
1 298.15 1 99.75194 -136086
$sout$water
T P logK G
1 298.15 1 41.55247 -56687.71
$sout$oxygen
T P logK G
1 298.15 1 0 0
$sout$quartz
T P logK G
1 298.15 1 150.0069 -204646
$sout$enstatite
T P logK G
1 298.15 1 255.768 -348930
$sout$forsterite
T P logK G
1 298.15 1 360.3197 -491564
$property
[1] "A"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 298.15
$P
[1] "Psat"
$xname
[1] ""
$xlim
[1] ""
$xvals
[1] ""
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -1.000716
$values$`1897`
[1] 0.008472902
$values$`1920`
[1] -0.1917995
affnty> # at higher temperature and pressure
affnty> affinity(T=500,P=2000)
affinity: temperature is 500 C
affinity: pressure is 2000 bar
subcrt: 7 species at 773.15 K and 2000 bar (wet)
$sout
$sout$SiO2
T P logK G
1 773.15 2000 58.67394 -207570.8
$sout$periclase
T P logK G
1 773.15 2000 39.92007 -141225.2
$sout$water
T P logK G
1 773.15 2000 19.25955 -68134.5
$sout$oxygen
T P logK G
1 773.15 2000 7.126047 -25209.82
$sout$quartz
T P logK G
1 773.15 2000 59.83361 -211673.4
$sout$enstatite
T P logK G
1 773.15 2000 102.0606 -361059.8
$sout$forsterite
T P logK G
1 773.15 2000 143.8758 -508989.4
$property
[1] "A"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 773.15
$P
[1] 2000
$xname
[1] ""
$xlim
[1] ""
$xvals
[1] ""
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -3.840332
$values$`1897`
[1] -6.533419
$values$`1920`
[1] -9.638279
affnty> # ten different temperatures at one pressure
affnty> affinity(T=c(500,1000,10),P=2000)
affinity: pressure is 2000 bar
energy.args: variable 1 is T at 10 increments from 773.15 to 1273.15
subcrt: 7 species at 10 values of T and P (wet)
subcrt: some points above T limits for quartz cr1 (ignored).
subcrt: some points above T limits for enstatite cr1 (ignored).
$sout
$sout$SiO2
T P logK G
1 773.1500 2000 58.67394 -207570.8
2 828.7056 2000 55.13264 -209057.8
3 884.2611 2000 52.05246 -210610.0
4 939.8167 2000 49.35128 -212226.1
5 995.3722 2000 46.96669 -213910.8
6 1050.9278 2000 44.85023 -215672.5
7 1106.4833 2000 42.96315 -217519.5
8 1162.0389 2000 41.27363 -219457.6
9 1217.5944 2000 39.75507 -221489.2
10 1273.1500 2000 38.38505 -223614.0
$sout$periclase
T P logK G
1 773.1500 2000 39.92007 -141225.2
2 828.7056 2000 37.48789 -142150.5
3 884.2611 2000 35.37183 -143118.3
4 939.8167 2000 33.51531 -144126.4
5 995.3722 2000 31.87442 -145172.8
6 1050.9278 2000 30.41462 -146255.6
7 1106.4833 2000 29.10829 -147373.3
8 1162.0389 2000 27.93316 -148524.5
9 1217.5944 2000 26.87103 -149707.7
10 1273.1500 2000 25.90691 -150922.0
$sout$water
T P logK G
1 773.1500 2000 19.25955 -68134.50
2 828.7056 2000 18.46115 -70002.94
3 884.2611 2000 17.78034 -71941.22
4 939.8167 2000 17.19508 -73944.30
5 995.3722 2000 16.68824 -76006.96
6 1050.9278 2000 16.24630 -78124.02
7 1106.4833 2000 15.85852 -80290.63
8 1162.0389 2000 15.51633 -82502.46
9 1217.5944 2000 15.21281 -84755.78
10 1273.1500 2000 14.94236 -87047.43
$sout$oxygen
T P logK G
1 773.1500 2000 7.126047 -25209.82
2 828.7056 2000 7.474820 -28343.81
3 884.2611 2000 7.787073 -31507.36
4 939.8167 2000 8.068901 -34698.83
5 995.3722 2000 8.325079 -37916.76
6 1050.9278 2000 8.559408 -41159.86
7 1106.4833 2000 8.774950 -44426.98
8 1162.0389 2000 8.974203 -47717.07
9 1217.5944 2000 9.159228 -51029.20
10 1273.1500 2000 9.331740 -54362.50
$sout$quartz
T P logK G
1 773.1500 2000 59.83361 -211673.4
2 828.7056 2000 56.17083 -212994.5
3 884.2611 2000 52.98451 -214381.2
4 939.8167 2000 50.18963 -215831.3
5 995.3722 2000 47.72016 -217342.5
6 1050.9278 2000 45.52410 -218913.0
7 1106.4833 2000 43.55994 -220541.0
8 1162.0389 2000 41.79411 -222225.1
9 1217.5944 2000 40.19923 -223963.7
10 1273.1500 2000 38.75268 -225755.6
$sout$enstatite
T P logK G
1 773.1500 2000 102.06059 -361059.8
2 828.7056 2000 95.80160 -363270.6
3 884.2611 2000 90.35447 -365584.2
4 939.8167 2000 85.57402 -367995.4
5 995.3722 2000 81.34761 -370499.5
6 1050.9278 2000 77.58651 -373092.4
7 1106.4833 2000 74.21991 -375770.4
8 1162.0389 2000 71.19057 -378530.1
9 1217.5944 2000 68.45179 -381368.4
10 1273.1500 2000 65.96504 -384282.6
$sout$forsterite
T P logK G
1 773.1500 2000 143.87580 -508989.4
2 828.7056 2000 135.06988 -512172.2
3 884.2611 2000 127.40729 -515504.0
4 939.8167 2000 120.68351 -518977.3
5 995.3722 2000 114.73986 -522585.2
6 1050.9278 2000 109.45135 -526321.7
7 1106.4833 2000 104.71823 -530181.4
8 1162.0389 2000 100.45991 -534159.2
9 1217.5944 2000 96.61057 -538250.7
10 1273.1500 2000 93.11598 -542451.7
$property
[1] "A"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 773.15 1273.15 10.00
$P
[1] 2000
$xname
[1] "T"
$xlim
[1] 773.15 1273.15 10.00
$xvals
[1] 500.0000 555.5556 611.1111 666.6667 722.2222 777.7778 833.3333 888.8889 944.4444 1000.0000
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -3.840332 -3.961812 -4.067943 -4.161653 -4.246532 -4.326126 -4.403215 -4.479521 -4.555847 -4.632366
$values$`1897`
[1] -6.533419 -6.818924 -7.069816 -7.292566 -7.493503 -7.678328 -7.851532 -8.016220 -8.174314 -8.326911
$values$`1920`
[1] -9.638279 -10.038539 -10.388830 -10.698385 -10.975681 -11.228104 -11.461496 -11.680047 -11.886569
[10] -12.082887
affnty> # at 25 temperatures and pressures
affnty> affinity(T=c(500,1000,5),P=c(1000,5000,5))
energy.args: variable 1 is T at 5 increments from 773.15 to 1273.15
energy.args: variable 2 is P at 5 increments from 1000 to 5000
subcrt: 7 species at 25 values of T and P (wet)
subcrt: some points above T limits for quartz cr1 (ignored).
subcrt: some points above T limits for enstatite cr1 (ignored).
$sout
$sout$SiO2
T P logK G
1 773.15 1000 58.61638 -207367.2
2 773.15 2000 58.67394 -207570.8
3 773.15 3000 58.64421 -207465.6
4 773.15 4000 58.59738 -207300.0
5 773.15 5000 58.54380 -207110.4
6 898.15 1000 51.07367 -209895.5
7 898.15 2000 51.34436 -211008.0
8 898.15 3000 51.36294 -211084.3
9 898.15 4000 51.34149 -210996.2
10 898.15 5000 51.30634 -210851.7
11 1023.15 1000 45.47259 -212885.6
12 1023.15 2000 45.87755 -214781.5
13 1023.15 3000 45.94656 -215104.6
14 1023.15 4000 45.94863 -215114.2
15 1023.15 5000 45.92870 -215020.9
16 1148.15 1000 41.24339 -216675.7
17 1148.15 2000 41.67903 -218964.4
18 1148.15 3000 41.78293 -219510.2
19 1148.15 4000 41.80251 -219613.1
20 1148.15 5000 41.79311 -219563.7
21 1273.15 1000 37.96343 -221157.8
22 1273.15 2000 38.38505 -223614.0
23 1273.15 3000 38.50388 -224306.2
24 1273.15 4000 38.53209 -224470.6
25 1273.15 5000 38.52669 -224439.1
$sout$periclase
T P logK G
1 773.15 1000 39.99606 -141494.1
2 773.15 2000 39.92007 -141225.2
3 773.15 3000 39.84408 -140956.4
4 773.15 4000 39.76809 -140687.6
5 773.15 5000 39.69210 -140418.7
6 898.15 1000 34.95068 -143635.5
7 898.15 2000 34.88527 -143366.7
8 898.15 3000 34.81985 -143097.8
9 898.15 4000 34.75444 -142829.0
10 898.15 5000 34.68902 -142560.2
11 1023.15 1000 31.18117 -145978.6
12 1023.15 2000 31.12375 -145709.7
13 1023.15 3000 31.06633 -145440.9
14 1023.15 4000 31.00891 -145172.1
15 1023.15 5000 30.95148 -144903.2
16 1148.15 1000 28.26687 -148502.4
17 1148.15 2000 28.21570 -148233.6
18 1148.15 3000 28.16453 -147964.8
19 1148.15 4000 28.11335 -147695.9
20 1148.15 5000 28.06218 -147427.1
21 1273.15 1000 25.95306 -151190.8
22 1273.15 2000 25.90691 -150922.0
23 1273.15 3000 25.86076 -150653.1
24 1273.15 4000 25.81461 -150384.3
25 1273.15 5000 25.76847 -150115.5
$sout$water
T P logK G
1 773.15 1000 19.45590 -68829.13
2 773.15 2000 19.25955 -68134.50
3 773.15 3000 19.09379 -67548.09
4 773.15 4000 18.94215 -67011.63
5 773.15 5000 18.79959 -66507.32
6 898.15 1000 17.85178 -73364.78
7 898.15 2000 17.62581 -72436.12
8 898.15 3000 17.45754 -71744.59
9 898.15 4000 17.31002 -71138.35
10 898.15 5000 17.17446 -70581.21
11 1023.15 1000 16.71777 -78266.33
12 1023.15 2000 16.45989 -77059.00
13 1023.15 3000 16.28488 -76239.70
14 1023.15 4000 16.13803 -75552.21
15 1023.15 5000 16.00624 -74935.18
16 1148.15 1000 15.87914 -83422.44
17 1148.15 2000 15.59801 -81945.48
18 1148.15 3000 15.41570 -80987.70
19 1148.15 4000 15.26800 -80211.76
20 1148.15 5000 15.13826 -79530.14
21 1273.15 1000 15.23897 -88775.36
22 1273.15 2000 14.94236 -87047.43
23 1273.15 3000 14.75404 -85950.35
24 1273.15 4000 14.60513 -85082.91
25 1273.15 5000 14.47661 -84334.20
$sout$oxygen
T P logK G
1 773.15 1000 7.126047 -25209.82
2 773.15 2000 7.126047 -25209.82
3 773.15 3000 7.126047 -25209.82
4 773.15 4000 7.126047 -25209.82
5 773.15 5000 7.126047 -25209.82
6 898.15 1000 7.860176 -32302.67
7 898.15 2000 7.860176 -32302.67
8 898.15 3000 7.860176 -32302.67
9 898.15 4000 7.860176 -32302.67
10 898.15 5000 7.860176 -32302.67
11 1023.15 1000 8.444769 -39535.24
12 1023.15 2000 8.444769 -39535.24
13 1023.15 3000 8.444769 -39535.24
14 1023.15 4000 8.444769 -39535.24
15 1023.15 5000 8.444769 -39535.24
16 1148.15 1000 8.925797 -46892.45
17 1148.15 2000 8.925797 -46892.45
18 1148.15 3000 8.925797 -46892.45
19 1148.15 4000 8.925797 -46892.45
20 1148.15 5000 8.925797 -46892.45
21 1273.15 1000 9.331740 -54362.50
22 1273.15 2000 9.331740 -54362.50
23 1273.15 3000 9.331740 -54362.50
24 1273.15 4000 9.331740 -54362.50
25 1273.15 5000 9.331740 -54362.50
$sout$quartz
T P logK G
1 773.15 1000 59.98689 -212215.6
2 773.15 2000 59.83361 -211673.4
3 773.15 3000 59.68033 -211131.1
4 773.15 4000 59.52705 -210588.8
5 773.15 5000 59.37377 -210046.6
6 898.15 1000 52.38390 -215280.1
7 898.15 2000 52.25196 -214737.9
8 898.15 3000 52.12001 -214195.6
9 898.15 4000 51.98806 -213653.4
10 898.15 5000 51.85612 -213111.1
11 1023.15 1000 46.70659 -218662.7
12 1023.15 2000 46.59076 -218120.4
13 1023.15 3000 46.47493 -217578.2
14 1023.15 4000 46.35911 -217035.9
15 1023.15 5000 46.24328 -216493.7
16 1148.15 1000 42.32178 -222341.1
17 1148.15 2000 42.21856 -221798.9
18 1148.15 3000 42.11535 -221256.6
19 1148.15 4000 42.01213 -220714.4
20 1148.15 5000 41.90891 -220172.1
21 1273.15 1000 38.84576 -226297.9
22 1273.15 2000 38.75268 -225755.6
23 1273.15 3000 38.65960 -225213.4
24 1273.15 4000 38.56652 -224671.1
25 1273.15 5000 38.47343 -224128.9
$sout$enstatite
T P logK G
1 773.15 1000 102.27189 -361807.3
2 773.15 2000 102.06059 -361059.8
3 773.15 3000 101.84929 -360312.3
4 773.15 4000 101.63799 -359564.7
5 773.15 5000 101.42669 -358817.2
6 898.15 1000 89.28363 -366925.6
7 898.15 2000 89.10174 -366178.0
8 898.15 3000 88.91984 -365430.5
9 898.15 4000 88.73795 -364683.0
10 898.15 5000 88.55606 -363935.5
11 1023.15 1000 79.57336 -372532.6
12 1023.15 2000 79.41369 -371785.1
13 1023.15 3000 79.25402 -371037.5
14 1023.15 4000 79.09435 -370290.0
15 1023.15 5000 78.93468 -369542.5
16 1148.15 1000 72.06129 -378580.2
17 1148.15 2000 71.91900 -377832.7
18 1148.15 3000 71.77671 -377085.2
19 1148.15 4000 71.63443 -376337.7
20 1148.15 5000 71.49214 -375590.1
21 1273.15 1000 66.09336 -385030.1
22 1273.15 2000 65.96504 -384282.6
23 1273.15 3000 65.83673 -383535.1
24 1273.15 4000 65.70841 -382787.6
25 1273.15 5000 65.58009 -382040.0
$sout$forsterite
T P logK G
1 773.15 1000 144.17164 -510036.0
2 773.15 2000 143.87580 -508989.4
3 773.15 3000 143.57995 -507942.8
4 773.15 4000 143.28411 -506896.2
5 773.15 5000 142.98827 -505849.6
6 898.15 1000 125.89987 -517406.0
7 898.15 2000 125.64520 -516359.3
8 898.15 3000 125.39053 -515312.7
9 898.15 4000 125.13586 -514266.1
10 898.15 5000 124.88119 -513219.5
11 1023.15 1000 112.24401 -525484.3
12 1023.15 2000 112.02046 -524437.7
13 1023.15 3000 111.79690 -523391.1
14 1023.15 4000 111.57335 -522344.5
15 1023.15 5000 111.34979 -521297.9
16 1148.15 1000 101.68301 -534200.5
17 1148.15 2000 101.48379 -533153.9
18 1148.15 3000 101.28458 -532107.3
19 1148.15 4000 101.08536 -531060.7
20 1148.15 5000 100.88614 -530014.1
21 1273.15 1000 93.29563 -543498.3
22 1273.15 2000 93.11598 -542451.7
23 1273.15 3000 92.93632 -541405.1
24 1273.15 4000 92.75666 -540358.5
25 1273.15 5000 92.57700 -539311.8
$property
[1] "A"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 773.15 1273.15 5.00
$P
[1] 1000 5000 5
$xname
[1] "T"
$xlim
[1] 773.15 1273.15 5.00
$xvals
[1] 500 625 750 875 1000
$yname
[1] "P"
$ylim
[1] 1000 5000 5
$yvals
[1] 1000 2000 3000 4000 5000
$values
$values$`2005`
[,1] [,2] [,3] [,4] [,5]
[1,] -3.629498 -3.840332 -3.963881 -4.070328 -4.170036
[2,] -3.689766 -4.092402 -4.242933 -4.353429 -4.450220
[3,] -3.766005 -4.286792 -4.471633 -4.589526 -4.685423
[4,] -3.921605 -4.460461 -4.667578 -4.790381 -4.884192
[5,] -4.117669 -4.632366 -4.844283 -4.965574 -5.053256
$values$`1897`
[,1] [,2] [,3] [,4] [,5]
[1,] -6.340555 -6.533419 -6.638997 -6.727473 -6.809210
[2,] -6.740723 -7.127890 -7.262952 -7.357977 -7.439299
[3,] -7.080409 -7.587616 -7.758877 -7.863190 -7.945507
[4,] -7.448970 -7.975724 -8.170740 -8.281441 -8.363151
[5,] -7.823127 -8.326911 -8.527915 -8.638292 -8.715061
$values$`1920`
[,1] [,2] [,3] [,4] [,5]
[1,] -9.436862 -9.638279 -9.75241 -9.849439 -9.939729
[2,] -10.075164 -10.469693 -10.61212 -10.714505 -10.803190
[3,] -10.590926 -11.104597 -11.28232 -11.393097 -11.481877
[4,] -11.094114 -11.626627 -11.82740 -11.943864 -12.031333
[5,] -11.573909 -12.082887 -12.28908 -12.404656 -12.486619
affnty> # as a function of logarithm of activity of MgO
affnty> affinity(MgO=c(-10,-5,10))
affinity: temperature is 25 C
energy.args: pressure is Psat
energy.args: variable 1 is MgO at 10 increments from -10 to -5
subcrt: 7 species at 298.15 K and 1 bar (wet)
$sout
$sout$SiO2
T P logK G
1 298.15 1 146.0076 -199190
$sout$periclase
T P logK G
1 298.15 1 99.75194 -136086
$sout$water
T P logK G
1 298.15 1 41.55247 -56687.71
$sout$oxygen
T P logK G
1 298.15 1 0 0
$sout$quartz
T P logK G
1 298.15 1 150.0069 -204646
$sout$enstatite
T P logK G
1 298.15 1 255.768 -348930
$sout$forsterite
T P logK G
1 298.15 1 360.3197 -491564
$property
[1] "A"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 298.15
$P
[1] "Psat"
$xname
[1] "MgO"
$xlim
[1] -10 -5 10
$xvals
[1] -10.000000 -9.444444 -8.888889 -8.333333 -7.777778 -7.222222 -6.666667 -6.111111 -5.555556
[10] -5.000000
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -1.000716 -1.000716 -1.000716 -1.000716 -1.000716 -1.000716 -1.000716 -1.000716 -1.000716 -1.000716
$values$`1897`
[1] -4.991527098 -4.435971543 -3.880415987 -3.324860432 -2.769304876 -2.213749321 -1.658193765 -1.102638210
[9] -0.547082654 0.008472902
$values$`1920`
[1] -10.1917995 -9.0806884 -7.9695773 -6.8584662 -5.7473551 -4.6362439 -3.5251328 -2.4140217
[9] -1.3029106 -0.1917995
affnty> ## equilibrium constants of formation reactions
affnty> affinity(property="logK")
affinity: temperature is 25 C
energy.args: pressure is Psat
subcrt: 7 species at 298.15 K and 1 bar (wet)
$sout
$sout$SiO2
T P logK G
1 298.15 1 146.0076 -199190
$sout$periclase
T P logK G
1 298.15 1 99.75194 -136086
$sout$water
T P logK G
1 298.15 1 41.55247 -56687.71
$sout$oxygen
T P logK G
1 298.15 1 0 0
$sout$quartz
T P logK G
1 298.15 1 150.0069 -204646
$sout$enstatite
T P logK G
1 298.15 1 255.768 -348930
$sout$forsterite
T P logK G
1 298.15 1 360.3197 -491564
$property
[1] "logK"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 298.15
$P
[1] "Psat"
$xname
[1] ""
$xlim
[1] ""
$xvals
[1] ""
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] 3.999284
$values$`1897`
[1] 10.00847
$values$`1920`
[1] 14.8082
affnty> # Standard molal Gibbs energies of species,
affnty> # user units (default: cal/mol)
affnty> affinity(property="G.species")
affinity: temperature is 25 C
energy.args: pressure is Psat
subcrt: 7 species at 298.15 K and 1 bar (wet)
$sout
$sout$SiO2
T P G
1 298.15 1 -199190
$sout$periclase
T P G
1 298.15 1 -136086
$sout$water
T P G
1 298.15 1 -56687.71
$sout$oxygen
T P G
1 298.15 1 0
$sout$quartz
T P G
1 298.15 1 -204646
$sout$enstatite
T P G
1 298.15 1 -348930
$sout$forsterite
T P G
1 298.15 1 -491564
$property
[1] "G.species"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 298.15
$P
[1] "Psat"
$xname
[1] ""
$xlim
[1] ""
$xvals
[1] ""
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -204646
$values$`1897`
[1] -348930
$values$`1920`
[1] -491564
affnty> # Standard molal Gibbs energies of reactions
affnty> affinity(property="G")
affinity: temperature is 25 C
energy.args: pressure is Psat
subcrt: 7 species at 298.15 K and 1 bar (wet)
$sout
$sout$SiO2
T P G
1 298.15 1 -199190
$sout$periclase
T P G
1 298.15 1 -136086
$sout$water
T P G
1 298.15 1 -56687.71
$sout$oxygen
T P G
1 298.15 1 0
$sout$quartz
T P G
1 298.15 1 -204646
$sout$enstatite
T P G
1 298.15 1 -348930
$sout$forsterite
T P G
1 298.15 1 -491564
$property
[1] "G"
$basis
H Mg O Si ispecies logact state
SiO2 0 0 2 1 72 -5 aq
MgO 0 1 1 0 1993 -5 cr
H2O 2 0 1 0 1 0 liq
O2 0 0 2 0 2691 999 gas
$species
SiO2 MgO H2O O2 ispecies logact state name
1 1 0 0 0 2005 0 cr1 quartz
2 1 1 0 0 1897 0 cr1 enstatite
3 1 2 0 0 1920 0 cr forsterite
$T
[1] 298.15
$P
[1] "Psat"
$xname
[1] ""
$xlim
[1] ""
$xvals
[1] ""
$yname
[1] ""
$ylim
[1] ""
$yvals
[1] ""
$values
$values$`2005`
[1] -5456
$values$`1897`
[1] -13654
$values$`1920`
[1] -20202
affnty> ## No test:
affnty> ## Activity of glycine as a function of those of
affnty> ## HCN and formaldehyde (200 C, 300 bar)
affnty> ## After Schulte and Shock, 1995, Fig. 5
affnty> # we can define the basis as this:
affnty> basis(c("formaldehyde","H2O","HCN","O2"))
basis: changed basis to HCHO H2O HCN O2.
C H N O ispecies logact state
HCHO 1 2 0 1 255 0 aq
H2O 0 2 0 1 1 0 liq
HCN 1 1 1 0 253 0 aq
O2 0 0 0 2 2691 0 gas
affnty> species("glycine")
HCHO H2O HCN O2 ispecies logact state name
1 1 1 1 0 1516 -3 aq glycine
affnty> a <- affinity(HCHO=c(-10,-2,9),HCN=c(-18,-2,9),T=200,P=300)
affinity: temperature is 200 C
affinity: pressure is 300 bar
energy.args: variable 1 is HCHO at 9 increments from -10 to -2
energy.args: variable 2 is HCN at 9 increments from -18 to -2
subcrt: 5 species at 473.15 K and 300 bar (wet)
affnty> # that gave us *affinities* (dimensionless) for logact(glycine)=-3
affnty> # (the default). we can now find the *activities* that
affnty> # correspond to affinity=0
affnty> logact.glycine <- species()$logact + a$values[[1]]
affnty> # note transposition of the z-value matrix in the following command
affnty> contour(x=-10:-2,y=seq(-18,-2,by=2),z=t(logact.glycine),
affnty+ xlab=axis.label("HCHO"),ylab=axis.label("HCN"),
affnty+ labcex=1,xaxs="i",yaxs="i")
affnty> title(main=paste("log activity glycine, after Schulte and Shock, 1995",
affnty+ "200 deg C, 300 bar, logaH2O = 1",sep="\n"))
affnty> ## amino acid synthesis at low and high temperatures
affnty> ## after Amend and Shock, 1998
affnty> # select the basis species and species of interest
affnty> # and set their activities (first for the 18 degree C case)
affnty> basis(c("H2O","CO2","NH4+","H2","H+","H2S"),
affnty+ log10(c(1,1e-4,5e-8,2e-9,5e-9,1e-15)))
C H N O S Z ispecies logact state
H2O 0 2 0 1 0 0 1 0.00000 liq
CO2 1 0 0 2 0 0 69 -4.00000 aq
NH4+ 0 4 1 0 0 1 18 -7.30103 aq
H2 0 2 0 0 0 0 66 -8.69897 aq
H+ 0 1 0 0 0 1 3 -8.30103 aq
H2S 0 2 0 0 1 0 70 -15.00000 aq
affnty> species(c("alanine","argininate","asparagine","aspartate","cysteine",
affnty+ "glutamate","glutamine","glycine","histidine","isoleucine",
affnty+ "leucine","lysinium","methionine","phenylalanine","proline",
affnty+ "serine","threonine","tryptophan","tyrosine","valine"),
affnty+ log10(c(3.9,0.7,1.1,3.3,0.5,3.8,1.0,5.8,1.2,0.7,
affnty+ 0.8,1.0,2.8,0.5,0.5,4.6,5.8,0.6,0.9,2.8)/1e9))
H2O CO2 NH4+ H2 H+ H2S ispecies logact state name
1 -4 3 1 6 -1 0 1504 -8.408935 aq alanine
2 -10 6 4 11 -5 0 1507 -9.154902 aq argininate
3 -5 4 2 6 -2 0 1508 -8.958607 aq asparagine
4 -4 4 1 6 -2 0 1510 -8.481486 aq aspartate
5 -4 3 1 5 -1 1 1511 -9.301030 aq cysteine
6 -6 5 1 9 -2 0 1515 -8.420216 aq glutamate
7 -7 5 2 9 -2 0 1513 -9.000000 aq glutamine
8 -2 2 1 3 -1 0 1516 -8.236572 aq glycine
9 -10 6 3 10 -3 0 1518 -8.920819 aq histidine
10 -10 6 1 15 -1 0 1520 -9.154902 aq isoleucine
11 -10 6 1 15 -1 0 1521 -9.096910 aq leucine
12 -10 6 2 14 -1 0 1523 -9.000000 aq lysinium
13 -8 5 1 11 -1 1 1525 -8.552842 aq methionine
14 -16 9 1 20 -1 0 1526 -9.301030 aq phenylalanine
15 -8 5 1 11 -1 0 1527 -9.301030 aq proline
16 -3 3 1 5 -1 0 1528 -8.337242 aq serine
17 -5 4 1 8 -1 0 1529 -8.236572 aq threonine
18 -20 11 2 23 -2 0 1530 -9.221849 aq tryptophan
19 -15 9 1 19 -1 0 1531 -9.045757 aq tyrosine
20 -8 5 1 12 -1 0 1533 -8.552842 aq valine
affnty> Tc <- 18
affnty> T <- convert(Tc,"K")
affnty> # converting A (dimensionless) to G of reaction (cal/mol)
affnty> # is like converting log K to standard G of reaction
affnty> AS98.18 <-
affnty+ convert(convert(as.numeric(affinity(T=Tc)$values),"G",T=T),"J")/1000
affinity: temperature is 18 C
energy.args: pressure is Psat
subcrt: 26 species at 291.15 K and 1 bar (wet)
affnty> # the 100 degree C case
affnty> Tc <- 100
affnty> T <- convert(Tc,"K")
affnty> basis(c("H2O","CO2","NH4+","H2","H+","H2S"),
affnty+ log10(c(1,2.2e-3,2.9e-6,3.4e-4,1.9e-6,1.6e-3)))
C H N O S Z ispecies logact state
H2O 0 2 0 1 0 0 1 0.000000 liq
CO2 1 0 0 2 0 0 69 -2.657577 aq
NH4+ 0 4 1 0 0 1 18 -5.537602 aq
H2 0 2 0 0 0 0 66 -3.468521 aq
H+ 0 1 0 0 0 1 3 -5.721246 aq
H2S 0 2 0 0 1 0 70 -2.795880 aq
affnty> species(1:20,log10(c(2.8e-9,5.0e-10,7.9e-10,2.4e-9,3.6e-10,
affnty+ 2.7e-9,7.2e-10,4.2e-9,8.6e-10,5.0e-10,
affnty+ 5.7e-10,7.2e-10,2.0e-9,3.6e-10,3.6e-10,
affnty+ 3.3e-9,4.2e-9,4.3e-10,6.5e-10,2.0e-9)))
H2O CO2 NH4+ H2 H+ H2S ispecies logact state name
1 -4 3 1 6 -1 0 1504 -8.552842 aq alanine
2 -10 6 4 11 -5 0 1507 -9.301030 aq argininate
3 -5 4 2 6 -2 0 1508 -9.102373 aq asparagine
4 -4 4 1 6 -2 0 1510 -8.619789 aq aspartate
5 -4 3 1 5 -1 1 1511 -9.443697 aq cysteine
6 -6 5 1 9 -2 0 1515 -8.568636 aq glutamate
7 -7 5 2 9 -2 0 1513 -9.142668 aq glutamine
8 -2 2 1 3 -1 0 1516 -8.376751 aq glycine
9 -10 6 3 10 -3 0 1518 -9.065502 aq histidine
10 -10 6 1 15 -1 0 1520 -9.301030 aq isoleucine
11 -10 6 1 15 -1 0 1521 -9.244125 aq leucine
12 -10 6 2 14 -1 0 1523 -9.142668 aq lysinium
13 -8 5 1 11 -1 1 1525 -8.698970 aq methionine
14 -16 9 1 20 -1 0 1526 -9.443697 aq phenylalanine
15 -8 5 1 11 -1 0 1527 -9.443697 aq proline
16 -3 3 1 5 -1 0 1528 -8.481486 aq serine
17 -5 4 1 8 -1 0 1529 -8.376751 aq threonine
18 -20 11 2 23 -2 0 1530 -9.366532 aq tryptophan
19 -15 9 1 19 -1 0 1531 -9.187087 aq tyrosine
20 -8 5 1 12 -1 0 1533 -8.698970 aq valine
affnty> AS98.100 <-
affnty+ convert(convert(as.numeric(affinity(T=Tc)$values),"G",T=T),"J")/1000
affinity: temperature is 100 C
energy.args: pressure is Psat
subcrt: 26 species at 373.15 K and 1.01 bar (wet)
affnty> # the nominal carbon oxidation state
affnty> Z.C <- ZC(as.character(thermo$obigt$formula[thermo$species$ispecies]))
affnty> # put them together
affnty> print(data.frame(T100=AS98.100,T18=AS98.18,Z.C=Z.C))
T100 T18 Z.C
1 -8.862465 113.62972 0.0000000
2 249.003712 440.26045 0.3333333
3 87.204836 201.53021 1.0000000
4 36.990300 146.70540 1.0000000
5 63.434452 224.64392 0.6666667
6 4.507084 172.08452 0.4000000
7 49.159517 223.31409 0.4000000
8 16.710202 80.46687 1.0000000
9 159.912066 350.47494 0.6666667
10 -88.795949 213.88013 -1.0000000
11 -97.981989 204.97626 -1.0000000
12 -21.063315 258.50429 -0.6666667
13 -168.781444 113.17820 -0.4000000
14 -104.416187 303.57593 -0.4444444
15 -33.119766 192.79146 -0.4000000
16 72.592217 173.65949 0.6666667
17 58.124509 216.47082 0.0000000
18 -26.742386 431.08196 -0.1818182
19 -50.034891 334.13381 -0.2222222
20 -64.020557 177.95803 -0.8000000
affnty> # values not exactly reproducing AS98 - different amino acid parameters
affnty> # forget species to run next example
affnty> species(delete=TRUE)
NULL
affnty> ## affinities of metabolic reactions
affnty> ## after Amend and Shock, 2001, Fig. 7
affnty> basis(c("CO2","H2","NH3","O2","H2S","H+"))
basis: changed basis to CO2 H2 NH3 O2 H2S H+.
basis: elements unchanged. maintaining elemental chemical potentials.
C H N O S Z ispecies logact state
CO2 1 0 0 2 0 0 69 -2.657577 aq
H2 0 2 0 0 0 0 66 -3.468521 aq
NH3 0 3 1 0 0 0 68 -9.057371 aq
O2 0 0 0 2 0 0 2691 -82.378353 gas
H2S 0 2 0 0 1 0 70 -2.795880 aq
H+ 0 1 0 0 0 1 3 -5.721246 aq
affnty> basis(c("O2","H2"),"aq") # O2 and H2 were gas
C H N O S Z ispecies logact state
CO2 1 0 0 2 0 0 69 -2.657577 aq
H2 0 2 0 0 0 0 66 -3.468521 aq
NH3 0 3 1 0 0 0 68 -9.057371 aq
O2 0 0 0 2 0 0 67 -82.378353 aq
H2S 0 2 0 0 1 0 70 -2.795880 aq
H+ 0 1 0 0 0 1 3 -5.721246 aq
affnty> species("H2O")
CO2 H2 NH3 O2 H2S H+ ispecies logact state name
1 0 1 0 0.5 0 0 1 0 liq water
affnty> doplot <- function(T) {
affnty+ res <- 20
affnty+ a <- affinity(H2=c(-10,0,res),O2=c(-10,0,res),T=T)
affnty+ T.K <- convert(T,"K") # temperature in Kelvin
affnty+ a <- convert(a$values[[1]],"G",T.K) # affinities (cal/mol)
affnty+ a <- convert(a,"J") # affinities (Joule)
affnty+ contour(x=seq(-10,0,length.out=res),
affnty+ y=seq(-10,0,length.out=res),z=t(a/1000),
affnty+ labcex=1,xlab=axis.label("H2"),ylab=axis.label("O2"))
affnty+ }
affnty> layout(matrix(c(1,1,2,3,4,5),ncol=2,byrow=TRUE),heights=c(1,4,4))
affnty> T <- c(25,55,100,150)
affnty> par(mar=c(0,0,0,0))
affnty> plot.new()
affnty> text(0.5,0.1,paste(c("H2(aq) + 0.5O2(aq) = H2O(liq)\n\n",
affnty+ "after Amend and Shock, 2001")),cex=2)
affnty> par(mar=c(3,3,0.5,0.5),cex=1.3,mgp=c(2,1,0))
affnty> for(i in 1:length(T)) doplot(T[i])
affinity: temperature is 25 C
energy.args: pressure is Psat
energy.args: variable 1 is H2 at 20 increments from -10 to 0
energy.args: variable 2 is O2 at 20 increments from -10 to 0
subcrt: 7 species at 298.15 K and 1 bar (wet)
affinity: temperature is 55 C
energy.args: pressure is Psat
energy.args: variable 1 is H2 at 20 increments from -10 to 0
energy.args: variable 2 is O2 at 20 increments from -10 to 0
subcrt: 7 species at 328.15 K and 1 bar (wet)
affinity: temperature is 100 C
energy.args: pressure is Psat
energy.args: variable 1 is H2 at 20 increments from -10 to 0
energy.args: variable 2 is O2 at 20 increments from -10 to 0
subcrt: 7 species at 373.15 K and 1.01 bar (wet)
affinity: temperature is 150 C
energy.args: pressure is Psat
energy.args: variable 1 is H2 at 20 increments from -10 to 0
energy.args: variable 2 is O2 at 20 increments from -10 to 0
subcrt: 7 species at 423.15 K and 4.76 bar (wet)
affnty> # this is so the plots in the next examples show up OK
affnty> layout(matrix(1))
affnty> ## continuation of last example, affinity calculations
affnty> ## in three dimensions
affnty> print(affinity(H2=c(-10,0,3),O2=c(-10,0,3),T=c(25,150,4))$values)
energy.args: pressure is Psat
energy.args: variable 1 is H2 at 3 increments from -10 to 0
energy.args: variable 2 is O2 at 3 increments from -10 to 0
energy.args: variable 3 is T at 4 increments from 298.15 to 423.15
subcrt: 7 species at 4 values of T and P (wet)
$`1`
, , 1
[,1] [,2] [,3]
[1,] 31.10664 33.60664 36.10664
[2,] 36.10664 38.60664 41.10664
[3,] 41.10664 43.60664 46.10664
, , 2
[,1] [,2] [,3]
[1,] 25.10194 27.60194 30.10194
[2,] 30.10194 32.60194 35.10194
[3,] 35.10194 37.60194 40.10194
, , 3
[,1] [,2] [,3]
[1,] 20.29182 22.79182 25.29182
[2,] 25.29182 27.79182 30.29182
[3,] 30.29182 32.79182 35.29182
, , 4
[,1] [,2] [,3]
[1,] 16.34186 18.84186 21.34186
[2,] 21.34186 23.84186 26.34186
[3,] 26.34186 28.84186 31.34186
affnty> ## calculations on a transect
affnty> # suppose that temperature and oxygen fugacity
affnty> # both change in space (say from 1 to 6 meters),
affnty> # that we have six values for each but want to
affnty> # interpolate them to make a plot with smooth curves
affnty> T <- splinefun(1:6,c(0,25,30,40,55,75))(seq(1,5,length.out=100))
affnty> O2 <- splinefun(1:6,c(-90,-83,-78,-73,-68,-63))(seq(1,5,length.out=100))
affnty> # what system could this be?
affnty> basis("CHNOS+")
C H N O S Z ispecies logact state
CO2 1 0 0 2 0 0 69 -3 aq
H2O 0 2 0 1 0 0 1 0 liq
NH3 0 3 1 0 0 0 68 -4 aq
H2S 0 2 0 0 1 0 70 -7 aq
O2 0 0 0 2 0 0 2691 -80 gas
H+ 0 1 0 0 0 1 3 -7 aq
affnty> species(paste("CSG",c("METBU","METVO","METTL","METJA"),sep="_"))
protein: found CSG_METBU (C1362H2111N355O442S4, 278 residues)
protein: found CSG_METVO (C2575H4097N645O884S11, 553 residues)
protein: found CSG_METTL (C2484H4000N638O844S7, 530 residues)
protein: found CSG_METJA (C2555H4032N640O865S14, 530 residues)
CO2 H2O NH3 H2S O2 H+ ispecies logact state name
1 1362 519 355 4 -1400.5 0 2926 -3 aq CSG_METBU
2 2575 1070 645 11 -2668.0 0 2927 -3 aq CSG_METVO
3 2484 1036 638 7 -2580.0 0 2928 -3 aq CSG_METTL
4 2555 1042 640 14 -2643.5 0 2929 -3 aq CSG_METJA
affnty> # now pass T and O2 to affinity, which because their lengths
affnty> # are greater than three, treats them like coordinates for a
affnty> # transect through chemical potential space rather than
affnty> # the definition of a 2-dimensional grid
affnty> a <- affinity(T=T,O2=O2)
energy.args: pressure is Psat
energy.args: variable 1 is T at 100 increments from 273.15 to 328.15
energy.args: variable 2 is O2 at 100 increments from -90 to -68
affinity: loading ionizable protein groups
subcrt: 27 species at 100 values of T and P (wet)
affnty> diagram(a,ylim=c(-4,-2))
diagram: immobile component is protein backbone group
diagram: conservation coefficients are 278 553 530 530
diagram: using residue equivalents
diagram: log total activity of PBB (from species) is 0.2766915
affnty> title(main=paste("Computed abundances of surface-layer proteins",
affnty+ "as a function of T and logfO2",sep="\n"))
affnty> ## End(No test)
affnty>
affnty>
affnty>
affnty>
Next: diagram: amino acid example
Up: CHNOSZ examples
Previous: species