Spaces:
Runtime error
Runtime error
File size: 3,132 Bytes
372e97d 174b314 372e97d a0c085b 372e97d 87f2929 372e97d 87f2929 372e97d c3760cf 372e97d 9b962b2 372e97d 9b962b2 372e97d 9b962b2 372e97d 9b962b2 372e97d 174b314 372e97d 5cbf533 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
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(
"\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):
example_file_a = gr.File(label="example file:",value="EXAMPLES/1WSe2-1.xyz" )
file_material_a = gr.File(label="material A file", )
with gr.Column(scale=1, min_width=400):
example_file_b = gr.File(label="example file:",value="EXAMPLES/2C-1.xyz" )
file_material_b = gr.File(label="material B file", )
max_angle = gr.Slider(0, 180, label=" min 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)
|