complicator 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- complicator-0.3.0/LICENSE.txt +19 -0
- complicator-0.3.0/MANIFEST.in +14 -0
- complicator-0.3.0/PKG-INFO +59 -0
- complicator-0.3.0/README.md +42 -0
- complicator-0.3.0/complicator/CoCl4_activity.py +136 -0
- complicator-0.3.0/complicator/__init__.py +1 -0
- complicator-0.3.0/complicator/autopp93s4.py +1954 -0
- complicator-0.3.0/complicator/complicator_fit.py +177 -0
- complicator-0.3.0/complicator/example_input_file.csv +531 -0
- complicator-0.3.0/complicator/wrm_data.csv +1957 -0
- complicator-0.3.0/complicator/wrm_ligand_abbrv.csv +13 -0
- complicator-0.3.0/complicator.egg-info/PKG-INFO +59 -0
- complicator-0.3.0/complicator.egg-info/SOURCES.txt +21 -0
- complicator-0.3.0/complicator.egg-info/dependency_links.txt +1 -0
- complicator-0.3.0/complicator.egg-info/not-zip-safe +1 -0
- complicator-0.3.0/complicator.egg-info/requires.txt +3 -0
- complicator-0.3.0/complicator.egg-info/top_level.txt +1 -0
- complicator-0.3.0/html/complicator/CoCl4_activity.html +210 -0
- complicator-0.3.0/html/complicator/autopp93s4.html +1928 -0
- complicator-0.3.0/html/complicator/complicator_fit.html +250 -0
- complicator-0.3.0/html/complicator/index.html +83 -0
- complicator-0.3.0/pyproject.toml +34 -0
- complicator-0.3.0/setup.cfg +4 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2025 Grayson Boyer and GEOPIG Lab.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Include documentation
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE.txt
|
|
4
|
+
|
|
5
|
+
# Include HTML documentation
|
|
6
|
+
recursive-include html *.html *.css *.js
|
|
7
|
+
|
|
8
|
+
# Include data files in the package
|
|
9
|
+
include complicator/*.csv
|
|
10
|
+
|
|
11
|
+
# Exclude build artifacts and cache
|
|
12
|
+
global-exclude __pycache__
|
|
13
|
+
global-exclude *.py[co]
|
|
14
|
+
global-exclude .DS_Store
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: complicator
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Estimate thermodynamic properties of aqueous metal complexes with monovalent ligands.
|
|
5
|
+
Author-email: Grayson Boyer <gmboyer@asu.edu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/gmboyer/complicator
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
Requires-Dist: pandas
|
|
14
|
+
Requires-Dist: wormutils
|
|
15
|
+
Requires-Dist: chemparse
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
# The Complicator
|
|
19
|
+
|
|
20
|
+
Code Authors: Grayson Boyer, Everett Shock
|
|
21
|
+
Data Compilers: GEOPIG Lab, Apar Prasad
|
|
22
|
+
|
|
23
|
+
This is a Python package for estimating standard state thermodynamic properties and Helgeson-Kirkham-Flowers (HKF) equation of state parameters for aqueous metal complexes with monovalent ligands using published methods from [Sverjensky et al. (1997)](https://doi.org/10.1016/s0016-7037(97)00009-4) and [Shock et al. (1997)](https://doi.org/10.1016/S0016-7037(96)00339-0)
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
This package can be installed through PyPI with:
|
|
28
|
+
`pip install Complicator`
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
The best way to learn about the Complicator is through the WORM Portal ([worm-portal.asu.edu](worm-portal.asu.edu)). Check out Jupyter notebook demo 4-2-1 in the WORM Library that is available when you log in.
|
|
33
|
+
|
|
34
|
+
What follows is a brief example of how the Complicator can be used.
|
|
35
|
+
|
|
36
|
+
Supply a dataframe containing names of metals, ligands, stability constants for the first through fourth association at 25 °C, and optionally, standard state entropies of association for the first through fourth association complex. An example is assigned to the variable `df_input` in the example below.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
import pandas as pd
|
|
40
|
+
from Complicator import complicate
|
|
41
|
+
|
|
42
|
+
df_input = pd.DataFrame({
|
|
43
|
+
"Metal":["Ag+", "Al+3"],
|
|
44
|
+
"Ligand":["OH-", "OH-"],
|
|
45
|
+
"BETA_1":[2, 9.03], # stability constant for the first association complex
|
|
46
|
+
"BETA_2":[3.97, 17.6], # second stability constant
|
|
47
|
+
"BETA_3":[float('NaN'), 26.4], # third stability constant
|
|
48
|
+
"BETA_4":[float('NaN'), 33.8], # fourth stability constant
|
|
49
|
+
"Sass_1":[float('NaN'), 36.5], # entropy of association for the first complex (cal/mol/K)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
df_out, _, _, _ = complicate(df_in=df_input)
|
|
53
|
+
|
|
54
|
+
df_out
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The output is a dataframe containing estimated thermodynamic properties, parameters for the revised Helgeson Kirkham Flowers (HKF) equation of state, and more. [The format of the output is explained in more detail here](https://worm-portal.asu.edu/docs/database/). This Water-Organic-Rock-Microbe (WORM) database format is designed to be compatible with the free and open source online geochemical modeling platform [WORM Portal](https://worm-portal.asu.edu/). Estimated thermodynamic properties of complexes from the Complicator can be used in conjunction with the rest of the WORM database to:
|
|
58
|
+
- calculate properties of reactions and create activity or predominance diagrams.
|
|
59
|
+
- expand the number of aqueous complexes available in geochemical speciation (equilibration) and mass transfer calculations.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# The Complicator
|
|
2
|
+
|
|
3
|
+
Code Authors: Grayson Boyer, Everett Shock
|
|
4
|
+
Data Compilers: GEOPIG Lab, Apar Prasad
|
|
5
|
+
|
|
6
|
+
This is a Python package for estimating standard state thermodynamic properties and Helgeson-Kirkham-Flowers (HKF) equation of state parameters for aqueous metal complexes with monovalent ligands using published methods from [Sverjensky et al. (1997)](https://doi.org/10.1016/s0016-7037(97)00009-4) and [Shock et al. (1997)](https://doi.org/10.1016/S0016-7037(96)00339-0)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
This package can be installed through PyPI with:
|
|
11
|
+
`pip install Complicator`
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
The best way to learn about the Complicator is through the WORM Portal ([worm-portal.asu.edu](worm-portal.asu.edu)). Check out Jupyter notebook demo 4-2-1 in the WORM Library that is available when you log in.
|
|
16
|
+
|
|
17
|
+
What follows is a brief example of how the Complicator can be used.
|
|
18
|
+
|
|
19
|
+
Supply a dataframe containing names of metals, ligands, stability constants for the first through fourth association at 25 °C, and optionally, standard state entropies of association for the first through fourth association complex. An example is assigned to the variable `df_input` in the example below.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
import pandas as pd
|
|
23
|
+
from Complicator import complicate
|
|
24
|
+
|
|
25
|
+
df_input = pd.DataFrame({
|
|
26
|
+
"Metal":["Ag+", "Al+3"],
|
|
27
|
+
"Ligand":["OH-", "OH-"],
|
|
28
|
+
"BETA_1":[2, 9.03], # stability constant for the first association complex
|
|
29
|
+
"BETA_2":[3.97, 17.6], # second stability constant
|
|
30
|
+
"BETA_3":[float('NaN'), 26.4], # third stability constant
|
|
31
|
+
"BETA_4":[float('NaN'), 33.8], # fourth stability constant
|
|
32
|
+
"Sass_1":[float('NaN'), 36.5], # entropy of association for the first complex (cal/mol/K)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
df_out, _, _, _ = complicate(df_in=df_input)
|
|
36
|
+
|
|
37
|
+
df_out
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The output is a dataframe containing estimated thermodynamic properties, parameters for the revised Helgeson Kirkham Flowers (HKF) equation of state, and more. [The format of the output is explained in more detail here](https://worm-portal.asu.edu/docs/database/). This Water-Organic-Rock-Microbe (WORM) database format is designed to be compatible with the free and open source online geochemical modeling platform [WORM Portal](https://worm-portal.asu.edu/). Estimated thermodynamic properties of complexes from the Complicator can be used in conjunction with the rest of the WORM database to:
|
|
41
|
+
- calculate properties of reactions and create activity or predominance diagrams.
|
|
42
|
+
- expand the number of aqueous complexes available in geochemical speciation (equilibration) and mass transfer calculations.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import math
|
|
3
|
+
from .autopp93s4 import complicate
|
|
4
|
+
import plotly.express as px
|
|
5
|
+
import plotly.graph_objects as go
|
|
6
|
+
from ipywidgets import interactive, interact_manual
|
|
7
|
+
interact_manual.opts['manual_name'] = 'Calculate'
|
|
8
|
+
|
|
9
|
+
import pychnosz
|
|
10
|
+
_ = pychnosz.thermo("WORM", messages=False)
|
|
11
|
+
|
|
12
|
+
@interact_manual(log_beta=(-5, 5, 0.01), S=(-100, 100, 1), Cp=(-100, 100, 1), V=(-100, 150, 1))
|
|
13
|
+
def CoCl4_2_activity(log_beta=0, S=0, Cp=0, V=0):
|
|
14
|
+
|
|
15
|
+
df_input = pd.DataFrame({
|
|
16
|
+
"Metal":["Co+2"],
|
|
17
|
+
"Ligand":["Cl-"],
|
|
18
|
+
"BETA_1":[0],
|
|
19
|
+
"BETA_2":[0],
|
|
20
|
+
"BETA_3":[0],
|
|
21
|
+
"BETA_4":[log_beta],
|
|
22
|
+
"S_4":[S],
|
|
23
|
+
"Cp_4":[Cp],
|
|
24
|
+
"V_4":[V],
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
df_out, _, _, _ = complicate(df_in=df_input, print_warnings=False)
|
|
28
|
+
|
|
29
|
+
G = df_out[df_out["name"] == "Co(Cl)4-2"]["G"].values[0]
|
|
30
|
+
H = df_out[df_out["name"] == "Co(Cl)4-2"]["H"].values[0]
|
|
31
|
+
|
|
32
|
+
_ = pychnosz.add_OBIGT(df_out, force=True, messages=False)
|
|
33
|
+
T = [0.01, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350]
|
|
34
|
+
out_estimate_psat = pychnosz.subcrt(["Co+2", "Cl-", "Co(Cl)4-2"], [-1, -4, 1], T=T, show=False, messages=False).out
|
|
35
|
+
out_estimate_600bars = pychnosz.subcrt(["Co+2", "Cl-", "Co(Cl)4-2"], [-1, -4, 1], T=T, P=600, show=False, messages=False).out
|
|
36
|
+
|
|
37
|
+
out_estimate_psat["type"] = "Psat (model)"
|
|
38
|
+
out_estimate_600bars["type"] = "600 bars (model)"
|
|
39
|
+
df_plot = pd.concat([out_estimate_psat, out_estimate_600bars], axis=0)
|
|
40
|
+
|
|
41
|
+
fig = px.line(df_plot, x="T", y="logK", color="type", template="simple_white")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
fig.add_trace(go.Scatter(x=[25, 50, 90],
|
|
45
|
+
y=[-2.09, -1.72, -1.41],
|
|
46
|
+
mode='markers', name="Psat (Pan and Susak, 1990)",
|
|
47
|
+
marker=dict(
|
|
48
|
+
line_color='#1F77B4',
|
|
49
|
+
color='#17BECF',
|
|
50
|
+
size=10,
|
|
51
|
+
symbol="circle",
|
|
52
|
+
line_width=2,
|
|
53
|
+
),
|
|
54
|
+
error_y=dict(
|
|
55
|
+
type='data',
|
|
56
|
+
array=[0.05, 0.05, 0.05],
|
|
57
|
+
color='#1F77B4',
|
|
58
|
+
visible=True)
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
fig.add_trace(go.Scatter(x=[150, 250, 350],
|
|
64
|
+
y=[-0.69, 2.16, 5.68],
|
|
65
|
+
mode='markers', name="600 bars (Liu et al., 2011)",
|
|
66
|
+
marker=dict(
|
|
67
|
+
line_color='#FF7F0E',
|
|
68
|
+
color='#FECB52',
|
|
69
|
+
size=10,
|
|
70
|
+
symbol="circle",
|
|
71
|
+
line_width=2,
|
|
72
|
+
),
|
|
73
|
+
error_y=dict(
|
|
74
|
+
type='data',
|
|
75
|
+
array=[0.2, 0.15, 0.6],
|
|
76
|
+
color='#FF7F0E',
|
|
77
|
+
visible=True)
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
a1 = df_out[df_out["name"]=="Co(Cl)4-2"]["a1.a"].values[0]
|
|
84
|
+
a2 = df_out[df_out["name"]=="Co(Cl)4-2"]["a2.b"].values[0]
|
|
85
|
+
a3 = df_out[df_out["name"]=="Co(Cl)4-2"]["a3.c"].values[0]
|
|
86
|
+
a4 = df_out[df_out["name"]=="Co(Cl)4-2"]["a4.d"].values[0]
|
|
87
|
+
c1 = df_out[df_out["name"]=="Co(Cl)4-2"]["c1.e"].values[0]
|
|
88
|
+
c2 = df_out[df_out["name"]=="Co(Cl)4-2"]["c2.f"].values[0]
|
|
89
|
+
omega = df_out[df_out["name"]=="Co(Cl)4-2"]["omega.lambda"].values[0]
|
|
90
|
+
|
|
91
|
+
annotation_text = ("Co<sup>2+</sup> + 4Cl<sup>-</sup> = CoCl<sub>4</sub><sup>2-</sup>"
|
|
92
|
+
"<br>logβ<sub>4</sub> = {}".format(round(log_beta, 2))+""
|
|
93
|
+
"<br>∆<sub>f</sub>G° = {} cal mol<sup>-1</sup>".format(int(G))+""
|
|
94
|
+
"<br>∆<sub>f</sub>H° = {} cal mol<sup>-1</sup>".format(int(H))+""
|
|
95
|
+
"<br>S° = {} cal mol<sup>-1</sup>K<sup>-1</sup>".format(S)+""
|
|
96
|
+
"<br>Cp° = {} cal mol<sup>-1</sup>K<sup>-1</sup>".format(Cp)+""
|
|
97
|
+
"<br>V° = {} cm<sup>3</sup> mol<sup>-1</sup>".format(V)+""
|
|
98
|
+
"<br>a<sub>1</sub> × 10 = {} cal mol<sup>-1</sup> bar<sup>-1</sup>".format(a1)+""
|
|
99
|
+
"<br>a<sub>2</sub> × 10<sup>-2</sup> = {} cal mol<sup>-1</sup>".format(a2)+""
|
|
100
|
+
"<br>a<sub>3</sub> = {} cal K mol<sup>-1</sup> bar<sup>-1</sup>".format(a3)+""
|
|
101
|
+
"<br>a<sub>4</sub> × 10<sup>-4</sup> = {} cal K mol<sup>-1</sup>".format(a4)+""
|
|
102
|
+
"<br>c<sub>1</sub> = {} cal mol<sup>-1</sup>".format(c1)+""
|
|
103
|
+
"<br>c<sub>2</sub> × 10<sup>-4</sup> = {} cal K mol<sup>-1</sup>".format(c2)+""
|
|
104
|
+
"<br>ω × 10<sup>-5</sup> = {} cal K mol<sup>-1</sup>".format(omega)+""
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
fig.add_annotation(
|
|
108
|
+
x=0.05, y=1,
|
|
109
|
+
xref='paper', yref='paper',
|
|
110
|
+
showarrow=False,
|
|
111
|
+
text=annotation_text,
|
|
112
|
+
align="left",
|
|
113
|
+
font = dict(size = 10),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
fig.update_layout(
|
|
118
|
+
xaxis_title="T, °C",
|
|
119
|
+
yaxis_title="logβ<sub>4</sub>",
|
|
120
|
+
title=None,
|
|
121
|
+
width=600,
|
|
122
|
+
height=350,
|
|
123
|
+
legend_title=None,
|
|
124
|
+
font=dict(size=12),
|
|
125
|
+
title_x=0.5,
|
|
126
|
+
xaxis_range=[0, 360],
|
|
127
|
+
yaxis_range=[-4, 8],
|
|
128
|
+
margin=dict(l=50,r=50,b=0,t=1),
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
config = {'toImageButtonOptions': {'format': "png", # one of png, svg, jpeg, webp
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
fig.show(config=config)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .autopp93s4 import complicate
|