10
$\begingroup$

I have a bunch of monomers in the form of SMILES string and I want to generate conformers from them.

At the moment, I am using RDKit to convert these SMILES strings to .sdf files, then using OpenBabel to generate conformers using OpenBabel's default genetic algorithm.

The problem with this method is that I am having to write these sdf files to disk using RDKit. Once that is done, I then separately run a OpenBabel command on my terminal to produce the low-energy conformers I want.

My question is, is there a way to write a python script that accepts SMILES strings, creates an sdf-like object, and then calls the genetic algorithm to go to work on the file and generate conformer file for me to use? I don't want to have the preliminary step of converting the SMILES string to sdf in my workflow.

The method I have right now works fine on my personal computer, but when I am accessing a remote cluster with memory constraints, I can't afford to use disk space by storing .sdf/.pdb/.mol files.

Any advice you have would be appreciated.

For reference, I am using this to create my conformers. Is there a python command in openbabel or pybel that I can use to generate conformers from that SMILES string?

The bash script I am using is:

#! /bin/bash

obabel -:"CC(=C)C(=O)OCCN(C)C" -O test_.pdb --gen3D -d
obabel test_.pdb -O test_op.pdb --conformer --nconf 30 --score rmsd --writeconformers
rm test_.pdb
$\endgroup$
2
  • 2
    $\begingroup$ I think that you can use OpenBabel to do all that steps from a bash script. $\endgroup$
    – Camps
    Jan 7, 2021 at 0:09
  • 1
    $\begingroup$ I know. I was wondering if there was a way to do it from a python script @Camps. Added my bash script for completeness $\endgroup$
    – megamence
    Jan 7, 2021 at 5:29

1 Answer 1

7
$\begingroup$

My colleague David Koes has a script for this purpose using RDKit rdconf.py

A related Open Babel / Pybel script would be globalopt.py, the main portion of which is reproduced below:

pybel._builder.Build(mol.OBMol)
mol.addh()

ff = pybel._forcefields["mmff94"]
success = ff.Setup(mol.OBMol)
if not success:
    ff = pybel._forcefields["uff"]
    success = ff.Setup(mol.OBMol)
    if not success:
        sys.exit("Cannot set up forcefield")

ff.ConjugateGradients(100, 1.0e-3) # optimize geometry
ff.WeightedRotorSearch(100, 25) # generate conformers

ff.GetCoordinates(mol.OBMol)
mol.write("sdf", "test.sdf", overwrite=True)

This isn't quite what you describe because it only saves the lowest energy conformer. I have to go finish some other work, but should give you the basic idea. Both RDKit and Open Babel can do what you describe.

$\endgroup$
2
  • $\begingroup$ thank you! this seems interesting. Looking at this script, I have a quick quesiton. What force field does the generic genetic algorithm conformer search utilize? ie when i run obabel test_.pdb -O test_op.pdb --conformer --nconf 30 --score rmsd --writeconformers rm test_.pdb, what force field is it using in its comuptation? uff, or gaff, or? $\endgroup$
    – megamence
    Jan 7, 2021 at 17:31
  • 1
    $\begingroup$ The default is to use MMFF94 if not specified. $\endgroup$ Jan 7, 2021 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .