Skip to content

Instantly share code, notes, and snippets.

@jhjensen2
Created August 7, 2016 13:35
Show Gist options
  • Save jhjensen2/c6c7fdbad526b3b655c2480fa382c695 to your computer and use it in GitHub Desktop.
Save jhjensen2/c6c7fdbad526b3b655c2480fa382c695 to your computer and use it in GitHub Desktop.
#conformer search with RDKIT
import sys
sys.path.append("/usr/local/lib/python2.7/site-packages/")
from rdkit import Chem
from rdkit.Chem import AllChem
m = Chem.AddHs(Chem.MolFromSmiles('CCCO')) #creates molecule from smiles and adds H's
AllChem.EmbedMultipleConfs(m,20) #makes 20 3D conformations
_=AllChem.MMFFOptimizeMoleculeConfs(m,maxIters=1000) #MMFF geometry optimization
i = 0
for conf in m.GetConformers():
tm = Chem.Mol(m,False,conf.GetId())
prop = AllChem.MMFFGetMoleculeProperties(tm, mmffVariant="MMFF94") #don't know
ff =AllChem.MMFFGetMoleculeForceField(tm,prop) #defines FF
print i,ff.CalcEnergy() #calculates and prints energy in kcal/mol
file = "out"+str(i)+".sdf"
writer = Chem.SDWriter(file) #writes sdf file for each confomer
writer.write(tm)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment