In [14]:
import ase
from ase import io
import numpy as np
import chemiscope
import pandas as pd
In [15]:
df_1 = pd.read_csv("property_2063.txt",sep='\t')
df_1.head()
Out[15]:
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
refcode metal total_charge spin_multiplicity elem_nr m_ox d_elec CN geometry rel_m
0 KIPLIH Cr 0 1 24 0 5 5 Square pyramidal 0.836
1 AYIZIS Cr 0 1 24 0 5 6 Octahedral 0.848
2 MISLAB Cr 0 1 24 0 5 6 Octahedral 0.859
3 KOQBAT Cr 0 1 24 0 5 6 Octahedral 0.860
4 VOWRAA Cr -1 1 24 0 5 6 Octahedral 0.856
In [16]:
mols_1 = []
for structure in df_1["refcode"]:
    mols_1.append(ase.io.read(f"Ground_state_spin_dataset/{structure}.xyz"))

properties_1 = {}
for key in df_1.keys():
    #print(key)
    units = None
    if key == "refcode" or key == "name":
        continue

    if "total_charge" in key:
        units = ""

    if "spin_multiplicity" in key:
        units = ""

    if "elem_nr" in key:
        units = ""

    if key == "m_ox":
        units = ""

    if key == "d_elec":
        units = "electrons"
        
    if key == "CN":
        units == ""
    
    if key == "rel_m":
        units == ""
        
    if units is not None:
        keydict = {
            "target": "structure",
            "values": df_1[f"{key}"].to_list(),
            "units": f"{units}",
        }
    else:
        continue
    properties_1[f"{key}"] = keydict

chemiscope.write_input(
    path=f"Ground_state_spin_dataset_chemiscope.json.gz",
    frames=mols_1,
    properties=properties_1,
)
/home/ruben/anaconda3/lib/python3.8/site-packages/chemiscope/structures.py:278: UserWarning: the following structure properties properties are only defined for a subset of frames: ['-1', '-2', '-3', '-4', '-5', '0', '1', '2', '3', '4', '5', '6']; they will be ignored
  warnings.warn(
In [17]:
widget = chemiscope.show(mols_1, properties_1)
In [18]:
widget
Out[18]:
ChemiscopeWidget(value=None, data='{"meta": {"name": " "}, "structures": [{"size": 59, "names": ["Cr", "O", "O…
In [19]:
df_2 = pd.read_csv("property_1838.txt",sep='\t')
df_2.head()
Out[19]:
.dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; }
refcode metal total_charge spin_multiplicity elem_nr m_ox d_elec hapticity
0 DIDSEQ Sc 0 1 21 3 0 False
1 EZUYUW Sc 0 1 21 3 0 False
2 NURLAQ Sc 0 1 21 3 0 False
3 ZIGKOS Sc 0 1 21 3 0 False
4 ACOJAD Ti 0 3 22 2 2 False
In [20]:
mols_2 = []
for structure in df_2["refcode"]:
    mols_2.append(ase.io.read(f"Supplementary_dataset/{structure}.xyz"))

properties_2 = {}
for key in df_2.keys():
    #print(key)
    units = None
    if key == "refcode" or key == "name":
        continue

    if "total_charge" in key:
        units = ""

    if "spin_multiplicity" in key:
        units = ""

    if "elem_nr" in key:
        units = ""

    if key == "m_ox":
        units = ""

    if key == "d_elec":
        units = "electrons"
        
    if key == "CN":
        units == ""
    
    if key == "rel_m":
        units == ""
        
    if key == "hapticity":
        units == ""
        
    if key == "hapttype":
        units == ""
        
    if units is not None:
        keydict = {
            "target": "structure",
            "values": df_2[f"{key}"].to_list(),
            "units": f"{units}",
        }
    else:
        continue
    properties_2[f"{key}"] = keydict

chemiscope.write_input(
    path=f"Supplementary_dataset_chemiscope.json.gz",
    frames=mols_2,
    properties=properties_2,
)
/home/ruben/anaconda3/lib/python3.8/site-packages/chemiscope/structures.py:278: UserWarning: the following structure properties properties are only defined for a subset of frames: ['-1', '-2', '-3', '-4', '0', '1', '2', '3', '4', '5', '6']; they will be ignored
  warnings.warn(
In [ ]:

In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: