t7morgen
commited on
Commit
·
d5bad3a
1
Parent(s):
2382dff
thermo
Browse files- app.py +5 -49
- dummy_struct_dens.cub +0 -0
app.py
CHANGED
@@ -174,7 +174,7 @@ def plot_thermo(thermo_data):
|
|
174 |
#ax1.legend(loc='lower right')
|
175 |
return fig
|
176 |
|
177 |
-
def predict(input_file):
|
178 |
input_f = open(input_file.name, "r").read()
|
179 |
input_format = input_file.name.split('.')[-1]
|
180 |
|
@@ -182,69 +182,28 @@ def predict(input_file):
|
|
182 |
oF.write(input_f)
|
183 |
|
184 |
input_f2 = open('dummy_struct.'+input_format, "r").read()
|
185 |
-
gfn2_input = ["filename","geom=dummy_struct."+input_format, 'calcdens=1', 'thermo=1']
|
186 |
gfn2_output = run_gfn2(gfn2_input)
|
187 |
-
print(gfn2_output['fetchthermo'].keys())
|
188 |
|
189 |
-
#qm_mol_features = get_qm_mol_features(gfn2_output, checked_features)
|
190 |
-
#basic_visualization_html = get_basic_visualization(input_f,input_format)
|
191 |
feature_visualization_html = get_feature_visualization(input_f2,input_format, gfn2_output, gfn2_output['xyz'])
|
192 |
qm_atom_features = get_qm_atom_features(gfn2_output)
|
193 |
thermo_data = get_thermo_data(gfn2_output)
|
194 |
plot = plot_thermo(thermo_data)
|
195 |
-
#pd.DataFrame(thermo_data)
|
196 |
-
return feature_visualization_html, pd.DataFrame(qm_atom_features), pd.DataFrame(thermo_data), plot#, pd.DataFrame(thermo_data)#, pd.DataFrame(qm_mol_features, index=[0])
|
197 |
-
|
198 |
-
|
199 |
-
def line_plot_fn(input_exe):
|
200 |
-
#input_f = open(input_file.name, "r").read()
|
201 |
-
#input_format = input_file.name.split('.')[-1]
|
202 |
-
#
|
203 |
-
#with open('dummy_struct.'+input_format, "w") as oF:
|
204 |
-
# oF.write(input_f)
|
205 |
-
|
206 |
-
#input_f2 = open('dummy_struct.'+input_format, "r").read()
|
207 |
-
gfn2_input = ["filename",input_exe, 'thermo=1']
|
208 |
-
gfn2_output = run_gfn2(gfn2_input)
|
209 |
-
print(gfn2_output['fetchthermo'].keys())
|
210 |
-
|
211 |
-
#qm_mol_features = get_qm_mol_features(gfn2_output, checked_features)
|
212 |
-
#basic_visualization_html = get_basic_visualization(input_f,input_format)
|
213 |
-
#feature_visualization_html = get_feature_visualization(input_f2,input_format, gfn2_output, gfn2_output['xyz'])
|
214 |
-
#qm_atom_features = get_qm_atom_features(gfn2_output)
|
215 |
-
thermo_data = get_thermo_data(gfn2_output)
|
216 |
-
pd.DataFrame(thermo_data)
|
217 |
-
return pd.DataFrame(thermo_data)#, pd.DataFrame(qm_mol_features, index=[0])
|
218 |
-
|
219 |
|
|
|
220 |
|
221 |
-
#def get_plot_data(input_format):
|
222 |
-
# gfn2_input = ["filename","geom=dummy_struct."+input_format, 'thermo=1']
|
223 |
-
# gfn2_output = run_gfn2(gfn2_input)
|
224 |
-
# print('plot data output', gfn2_output)
|
225 |
|
226 |
with gr.Blocks() as demo:
|
227 |
gr.Markdown("# QM property calculation")
|
228 |
-
|
229 |
-
#text_input = gr.Textbox()
|
230 |
-
#text_output = gr.Textbox()
|
231 |
-
#text_button = gr.Button("Flip")
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
with gr.Row():
|
236 |
input_file = gr.File(label="Structure file for input (xyz format)")
|
237 |
input_file2 = input_file
|
238 |
charge = gr.Textbox(placeholder="Total charge", label="Give the total charge of the input molecule. (Default=0)")
|
239 |
|
240 |
-
#checked_features = gr.CheckboxGroup(["Charge", "Polarizability", "Koopman IP", "Electronic Density"], label="QM features", info="Which features shall be calculated?")
|
241 |
-
#temperature = gr.Slider(value=300,minimum=0, maximum=1000, label="Temperature for Thermodynamics evaluation in K", step=5)
|
242 |
-
|
243 |
single_btn = gr.Button(label="Run")
|
244 |
with gr.Row():
|
245 |
basic_html = gr.HTML()
|
246 |
plot = gr.Plot()
|
247 |
-
#gr.LinePlot(get_plot_data(input_format), every=5, x="Date", y="Sales", y_title="Sales ($ millions)", overlay_point=True, width=500, height=500)
|
248 |
gr.HighlightedText(value=[("Positive Charge","Purple"),("Negative charge","red"),("Polarizability","Light blue"), ("Electronic Densities", "Beige")], color_map={"red":"#a0210f", "Light blue":"#809BAC", "Purple":"#4c4e9e", "Beige":"#F7D7BE"})
|
249 |
|
250 |
with gr.Row():
|
@@ -257,13 +216,10 @@ with gr.Blocks() as demo:
|
|
257 |
df_atom_features = gr.Dataframe()
|
258 |
df_thermo_props = gr.Dataframe()
|
259 |
|
260 |
-
#with gr.Row():
|
261 |
-
# plot = gr.Plot()
|
262 |
|
263 |
-
single_btn.click(fn=predict, inputs=[input_file], outputs=[basic_html, df_atom_features, df_thermo_props, plot])
|
264 |
Dbutton.click(export_csv, df_atom_features, csv)
|
265 |
-
D2button.click(export_csv_thermo, df_thermo_props, csv2)
|
266 |
-
#demo.load(fn=line_plot_fn, inputs=[input_exe], ouputs=plot)
|
267 |
|
268 |
|
269 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
174 |
#ax1.legend(loc='lower right')
|
175 |
return fig
|
176 |
|
177 |
+
def predict(input_file, charge):
|
178 |
input_f = open(input_file.name, "r").read()
|
179 |
input_format = input_file.name.split('.')[-1]
|
180 |
|
|
|
182 |
oF.write(input_f)
|
183 |
|
184 |
input_f2 = open('dummy_struct.'+input_format, "r").read()
|
185 |
+
gfn2_input = ["filename","geom=dummy_struct."+input_format, 'calcdens=1', 'thermo=1', "charge="+charge]
|
186 |
gfn2_output = run_gfn2(gfn2_input)
|
|
|
187 |
|
|
|
|
|
188 |
feature_visualization_html = get_feature_visualization(input_f2,input_format, gfn2_output, gfn2_output['xyz'])
|
189 |
qm_atom_features = get_qm_atom_features(gfn2_output)
|
190 |
thermo_data = get_thermo_data(gfn2_output)
|
191 |
plot = plot_thermo(thermo_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
+
return feature_visualization_html, pd.DataFrame(qm_atom_features), pd.DataFrame(thermo_data), plot#, pd.DataFrame(thermo_data)#, pd.DataFrame(qm_mol_features, index=[0])
|
194 |
|
|
|
|
|
|
|
|
|
195 |
|
196 |
with gr.Blocks() as demo:
|
197 |
gr.Markdown("# QM property calculation")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
with gr.Row():
|
199 |
input_file = gr.File(label="Structure file for input (xyz format)")
|
200 |
input_file2 = input_file
|
201 |
charge = gr.Textbox(placeholder="Total charge", label="Give the total charge of the input molecule. (Default=0)")
|
202 |
|
|
|
|
|
|
|
203 |
single_btn = gr.Button(label="Run")
|
204 |
with gr.Row():
|
205 |
basic_html = gr.HTML()
|
206 |
plot = gr.Plot()
|
|
|
207 |
gr.HighlightedText(value=[("Positive Charge","Purple"),("Negative charge","red"),("Polarizability","Light blue"), ("Electronic Densities", "Beige")], color_map={"red":"#a0210f", "Light blue":"#809BAC", "Purple":"#4c4e9e", "Beige":"#F7D7BE"})
|
208 |
|
209 |
with gr.Row():
|
|
|
216 |
df_atom_features = gr.Dataframe()
|
217 |
df_thermo_props = gr.Dataframe()
|
218 |
|
|
|
|
|
219 |
|
220 |
+
single_btn.click(fn=predict, inputs=[input_file, charge], outputs=[basic_html, df_atom_features, df_thermo_props, plot])
|
221 |
Dbutton.click(export_csv, df_atom_features, csv)
|
222 |
+
D2button.click(export_csv_thermo, df_thermo_props, csv2)
|
|
|
223 |
|
224 |
|
225 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
dummy_struct_dens.cub
CHANGED
The diff for this file is too large to render.
See raw diff
|
|