Skip to content

Random seed for Chem.MolToSmiles(mol, doRandom=True) #6489

Answered by greglandrum
daanjiskoot asked this question in Ideas
Discussion options

You must be logged in to vote

Hi @daanjiskoot, at the moment it's not possible to control the random number seed which is used (or to reset it).
The RNG is seeded at program start, so the results that the RDKit generates should be reproducible across runs, as this shows:

$ cat blah.py
from rdkit import Chem
m = Chem.MolFromSmiles('OCCC(F)CC(CCF)CC(O)(CCCCCl)O')
print(len(set([Chem.MolToSmiles(m,canonical=False,doRandom=True) for i in range(100)])))
(py311_rdkit) 
glandrum@ferret MINGW64 ~
$ python blah.py
87
(py311_rdkit) 
glandrum@ferret MINGW64 ~
$ python blah.py
87
(py311_rdkit) 
glandrum@ferret MINGW64 ~
$ python blah.py
87

but the RNG seed it not reset between calls to MolToSmiles(), so you get different results…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@daanjiskoot
Comment options

Answer selected by daanjiskoot
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants