complicator 0.3.0__py3-none-any.whl

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.
@@ -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