Àlex Solé commited on
Commit
4e099cc
·
2 Parent(s): 6afeebe 1380046

Merge branch 'main' of https://huggingface.co/spaces/alexsoleg/cartnet-demo into main

Browse files
Files changed (1) hide show
  1. main.py +9 -15
main.py CHANGED
@@ -34,21 +34,15 @@ def main():
34
  atoms = read(filename, format="cif")
35
  cif = ReadCif(filename)
36
  cif_data = cif.first_block()
37
- st.markdown(cif_data.keys())
38
- st.markdown(cif_data)
39
- for key in cif_data.keys():
40
- if key.lower().startswith("data"):
41
- st.markdown(cif_data[key])
42
- st.markdown(cif_data["_publ_section_comment"])
43
- temperature = 100
44
- # if "_diffrn_ambient_temperature" in cif_data.keys():
45
- # temperature = float(cif_data["_diffrn_ambient_temperature"].split("(")[0])
46
- # elif "_cell_measurement_temperature" in cif_data.keys():
47
- # temperature = float(cif_data["_cell_measurement_temperature"].split("(")[0])
48
- # else:
49
- # raise ValueError("Temperature not found in the CIF file. \
50
- # Please provide a temperature in the field _diffrn_ambient_temperature o in the field _cell_measurement_temperature from the CIF file.")
51
- # st.success("CIF file successfully read.")
52
 
53
  data = Data()
54
  data.x = torch.tensor(atoms.get_atomic_numbers(), dtype=torch.int32)
 
34
  atoms = read(filename, format="cif")
35
  cif = ReadCif(filename)
36
  cif_data = cif.first_block()
37
+
38
+ if "_diffrn_ambient_temperature" in cif_data.keys():
39
+ temperature = float(cif_data["_diffrn_ambient_temperature"].split("(")[0])
40
+ elif "_cell_measurement_temperature" in cif_data.keys():
41
+ temperature = float(cif_data["_cell_measurement_temperature"].split("(")[0])
42
+ else:
43
+ raise ValueError("Temperature not found in the CIF file. \
44
+ Please provide a temperature in the field _diffrn_ambient_temperature o in the field _cell_measurement_temperature from the CIF file.")
45
+ st.success("CIF file successfully read.")
 
 
 
 
 
 
46
 
47
  data = Data()
48
  data.x = torch.tensor(atoms.get_atomic_numbers(), dtype=torch.int32)