Spaces:
Runtime error
Runtime error
import os | |
os.environ['KMP_DUPLICATE_LIB_OK']='True' | |
import gradio as gr | |
from interface_connection import compute_supercell_a, compute_supercell_b | |
with gr.Blocks() as latmatcher: | |
gr.Markdown( | |
"## LatMattcher.\n Please drop your XYZ files here to compute the minimum supercell.") | |
with gr.Tabs(): | |
with gr.TabItem(label="file"): | |
with gr.Row(): | |
with gr.Column(scale=1, min_width=400): | |
file_source_a = gr.Dropdown(["c2db.json", ".xyz", "bespoke.json"], | |
label="format", info="Select file format") | |
file_material_a = gr.File(label="material A file", ) | |
with gr.Column(scale=1, min_width=400): | |
file_source_b = gr.Dropdown(["c2db.json", ".xyz", "bespoke.json"], | |
label="format", info="Select file format") | |
file_material_b = gr.File(label="material B file", ) | |
max_angle = gr.Slider(0, 180, label=" max Angle:", step=1) | |
max_strain = gr.Slider(0, 1, label=" max Strain:", step=0.05) | |
inter_distance = gr.Slider(-0.05, 10, label=" Inter-layer distance:",info="If set to -0.05 is computed automatically.", step=0.05) | |
msc_button = gr.Button("Compute minimum super cel") | |
file_angle = gr.Text(label="Optimum Angle:") | |
file_strain = gr.Text(label="Best Strain:") | |
file_material_ab = gr.File(label="Result", ) | |
plot_overlap = gr.Plot() | |
file_txt = gr.Text(label="Result:", info=" You can use the text below to create a 3D plot in Speck \n(high-quality atomistic system rendering).") | |
msc_button.click(compute_supercell_a, | |
inputs=[file_material_a, file_material_b, inter_distance, max_angle, | |
max_strain], | |
outputs=[file_material_ab, file_angle, file_strain, plot_overlap, file_txt]) | |
with gr.TabItem(label="data"): | |
with gr.Row(): | |
with gr.Column(scale=1, min_width=400): | |
gr.Markdown( | |
"## Host lattice:") | |
host_lattice = gr.Textbox(label="Host lattice:", lines=4) | |
host_atoms = gr.Textbox(label="Host atoms:", lines=50) | |
with gr.Column(scale=1, min_width=400): | |
gr.Markdown("## Guest lattice:") | |
guest_lattice = gr.Textbox(label="Guest lattice:", lines=4) | |
guest_atoms = gr.Textbox(label="Guest atoms:", lines=50) | |
max_angle = gr.Slider(0, 180, label=" max Angle:", step=1) | |
max_strain = gr.Slider(0, 1, label=" max Strain:", step=0.05) | |
msc_button = gr.Button("Compute minimum super cel") | |
file_angle = gr.Text(label="Optimum Angle:") | |
file_strain = gr.Text(label="Best Strain:") | |
msc_button.click(compute_supercell_b, | |
inputs=[host_lattice, guest_lattice, | |
host_atoms, guest_atoms, | |
max_angle, max_strain], | |
outputs=[file_angle, file_strain]) | |
latmatcher.launch(share=True) | |