Making molecules with different torsion values automatically

Hi there,

I have a molecule, and by going to Analysis > Properties > Torsion Properties, I can change the value of the torsion between four atoms.

I would like to automate this to create a set of molecules, each one from a different torsion number, from the same base molecule.

Any idea how I could script this up?

Ideally I would output X different pdb files for X different torsion values

This sounds close to the genetic algorithm to identify multiple conformers of openbabel (link to the documentation with --nconf to set the number of conformers

obabel startingConformer.mol -O ga_conformers.sdf --conformer --nconf 30
       --score rmsd --writeconformers

However I infer your preference of using a GUI is to define which of of the single bonds are free rotors (allowed to rotate). I guess the normal way in Avogadro were to select atom instead (Extensions → calculate → freeze selected atoms) and then launch the algorithm (Extensions → OpenBabel → Conformer Search) and to venture out the options provided there. See here.

I would actually suggest doing this with a Python script using Open Babel or RDKit instead. It sounds like you want to match a particular torsion pattern (e.g., with SMARTS) and then write a set of separate angles to separate files.

While I can imagine some ways to do this with Avogadro automation, it’s probably easier to do with a variety of example scripts from RDKit or Open Babel. If you can’t find any, let me know and I’ll post something to GitHub.

1 Like

Hey thomas, not really. All I want to do is, for four specified atoms, vary the torsion and have several different versions of the molecule with those different torsion values.

Hey there, thanks! I’ve tried open babel but there doesn’t seem to be an obivous way to vary the torsion of a specified set of four atoms, keeping the rest constant like you can do in avogadro. If you know of an easy way it would be much appreciated Prof. Hutchinson!

Here’s a version that matches a particular SMARTS pattern: Scan dihedral angles using Open Babel / Pybel · GitHub

If you just wanted to use particular atom numbers (in Open Babel, that’s 1, 2, 3, 4, etc.) you can remove that part of the code with the smarts = pybel.Smarts(…) and change this:

    # get the atom indexes from the SMARTS match
    a = (match[0])
    b = (match[1])
    c = (match[2])
    d = (match[3])

Hopefully it should be commented thoroughly enough to make it clear?

1 Like