Skip to content

Specify random seed to make RDKit embedding deterministic #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sevyharris
Copy link

Overview

The geometries for conformer generation aren't deterministic: #94

I added a random seed so that every time you generate a species conformer, TS, or set the chirality, you will get the same result.

This is important if you want to generate conformers in AutoTST and then go back and analyze them later. If you want to rebuild the AutoTST species objects in memory, you want to get the same result each time.

Testing

Here's the code I used to test species conformers:

all_atoms = ase.Atoms()
for i in range(3):
    my_species = autotst.species.Species(smiles=['CCCC'])
    all_atoms += my_species.conformers['CCCC'][0].get_ase_mol()
    
ase.visualize.view(all_atoms, viewer='x3d')

And setting the chirality:

# need chiral center example
all_atoms = ase.Atoms()
for i in range(10):

    my_chiral_smiles = 'ClC=C(C(Cl)N)O'
    my_chiral_species = autotst.species.Species(smiles=[my_chiral_smiles])
    
    chiral_centers = my_chiral_species.conformers[my_chiral_smiles][0].get_chiral_centers()
    my_chiral_species.conformers[my_chiral_smiles][0].set_chirality(chiral_centers[0].index, 'R')
    
    all_atoms += my_chiral_species.conformers[my_chiral_smiles][0].get_ase_mol()
  
ase.visualize.view(all_atoms, viewer='x3d')

And making the TS object:

all_atoms = ase.Atoms()
my_reaction_smiles = 'CCCC+[OH]_O+[CH2]CCC'
for i in range(5):
    
    my_reaction = autotst.reaction.Reaction(label=my_reaction_smiles)
    my_reaction.ts

    all_atoms += my_reaction.ts['forward'][0].ase_molecule

@sevyharris
Copy link
Author

Unclear whether setting the random seed is causing embed failure in old tests or whether tests are just old. Will investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant