Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
b413e4c
1
Parent(s):
c37b546
another stab
Browse files
gradio_molecule3d/backend/gradio_molecule3d/molecule3d.py
CHANGED
|
@@ -102,7 +102,12 @@ def find_minimum_repeats(atoms, min_length):
|
|
| 102 |
|
| 103 |
def convert_file_to_pdb(file_path: str | Path, gradio_cache: str | Path) -> str:
|
| 104 |
# Read the file using ASE, and convert even if it's pdb to make sure all elements go lower case
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
if all(structures[0].pbc):
|
| 108 |
# find the minimum number of repeats in each unit cell direction to meet at least 20 angstroms
|
|
|
|
| 102 |
|
| 103 |
def convert_file_to_pdb(file_path: str | Path, gradio_cache: str | Path) -> str:
|
| 104 |
# Read the file using ASE, and convert even if it's pdb to make sure all elements go lower case
|
| 105 |
+
|
| 106 |
+
try:
|
| 107 |
+
structures = ase.io.read(file_path, ':')
|
| 108 |
+
except Exception as e:
|
| 109 |
+
# Bad upload structure, no need to visualize
|
| 110 |
+
return None
|
| 111 |
|
| 112 |
if all(structures[0].pbc):
|
| 113 |
# find the minimum number of repeats in each unit cell direction to meet at least 20 angstroms
|