<jupyter_start><jupyter_text>PubChem Radicals  Lowest SA score<jupyter_code>plot_smiles(radical_subset.sort_values('sa_score').head()['0'])<jupyter_output><empty_output><jupyter_text>Highest SA score<jupyter_code>print(radical_subset.sort_values('sa_score').tail()['0'])
plot_smiles(radical_subset.sort_values('sa_score').tail()['0'])<jupyter_output>362999                     N[C@@H]1C=[C]CC1
138459                 C[C@H]1O[P]O[C@@H]1C
237801      [CH2][C@@H]1O[S@@](=O)O[C@@H]1C
348158           N[C]1C2C[C@@H]3C1[C@@H]3C2
28517     C[C@@]1(C#N)C[C@H]2C=[C][C@@H]1C2
Name: 0, dtype: object<jupyter_text>Lowest SC score<jupyter_code>plot_smiles(radical_subset.sort_values('sc_score').head()['0'])<jupyter_output><empty_output><jupyter_text>Highest SC score<jupyter_code>plot_smiles(radical_subset.sort_values('sc_score').tail()['0'])<jupyter_output><empty_output><jupyter_text>Generated Radicals  Lowest SA score<jupyter_code>print('\n'.join(reward_subset.sort_values('sa_score').head()['smiles']))
plot_smiles(reward_subset.sort_values('sa_score').head()['smiles'])<jupyter_output>N=[C]C(=C(O)O)c1cc1=O
CCC(CCO)=C(C)[C]=O
[CH]=C1C=CC(=O)C=C1
C=[C]CC
CCNC(=O)C(=C=[N])C#N<jupyter_text>Highest SA score<jupyter_code>print('\n'.join(reward_subset.sort_values('sa_score').tail()['smiles']))
plot_smiles(reward_subset.sort_values('sa_score').tail()['smiles'])<jupyter_output>[C]1=CC2=C3C#CC2=C1C3
[C]1=C=CC=C2C3=C=C2N13
O=C1C2=C=NC3=[C]C13N2
[C]1=C=C2C#CN=C1OO2
NC12[C]=C3OC1C3=C=NO2<jupyter_text>Lowest SC score<jupyter_code>print('\n'.join(reward_subset.sort_values('sc_score').head()['smiles']))
plot_smiles(reward_subset.sort_values('sc_score').head()['smiles'])<jupyter_output>C=[C]CC
C[C]=C=C=O
C#CC(O)(O)[C]=N
C=[C]OC1=NN1C
[N]=C1C=C(O)O1<jupyter_text>Highest SC score<jupyter_code>print('\n'.join(reward_subset.sort_values('sc_score').tail()['smiles']))
plot_smiles(reward_subset.sort_values('sc_score').tail()['smiles'])
from rdkit.Chem import AllChem
def get_min_energy(smiles):

    mol = rdkit.Chem.MolFromSmiles(smiles)
    mol = Chem.rdmolops.AddHs(mol)

    is_radical = False
    radical_index = None
    for i, atom in enumerate(mol.GetAtoms()):
        if atom.GetNumRadicalElectrons() != 0:
            is_radical = True
            radical_index = i

            atom.SetNumExplicitHs(atom.GetNumExplicitHs() + 1)
            atom.SetNumRadicalElectrons(0)

    NumRotatableBonds = AllChem.CalcNumRotatableBonds(mol)
    NumConformers = np.clip(3**NumRotatableBonds, 100, 1000)

    conformers = AllChem.EmbedMultipleConfs(
        mol, numConfs=int(NumConformers), pruneRmsThresh=0.2, randomSeed=1,
        useExpTorsionAnglePrefs=True, useBasicKnowledge=True)

    def optimize_conformer(conformer):
        prop = AllChem.MMFFGetMoleculeProperties(mol, mmffVariant="MMFF94s")
        ff = AllChem.MMFFGetMoleculeForceField(mol, prop, confId=conformer)
        ff.Minimize()
        return float(ff.CalcEnergy())

    assert conformers, "Conformer embedding failed"

    conformer_energies = np.array(
        [optimize_conformer(conformer) for conformer in conformers])
    return conformer_energies.min(), mol.GetNumBonds()
get_min_energy('[CH]=CC=C1N=C1C1=C=C=N1')
get_min_energy('[C]1=CC2=C3C#CC2=C1C3')
from rdkit import Chem
from rdkit.Chem.rdDistGeom import EmbedMolecule
mol = Chem.MolFromSmiles('[C]1=CC2=C3C#CC2=C1C3')
molH = Chem.AddHs(mol)
EmbedMolecule(molH)
conformer_energies<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1677325581395349, 'fraction_numerical': 0.03488372093023256, 'mean_word_length': 6.874141876430206, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '84108', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1461, 'n_words': 137, 'path': 'examples/old/stable_radical_optimization/synthetic_accessibility_test.ipynb', 'repo_name': 'jlaw9/rlmolecule', 'size': '3440'}