Hi Jose
I have a similar problem, but I look for dihedrals between
aromatic/unsaturated rings:

rotatable_ring_bonds=Chem.MolFromSmarts("[!$(*#*)&X3&R]-!@[!$(*#*)&X3&R]")
rotatable_matches=mol.GetSubstructMatches(rotatable_ring_bonds)
rotatable=set() #set of sorted indices of the rotatable bonds
for bond in rotatable_matches:
        if bond[0]<bond[1]:
            rotatable.add((bond[0],bond[1]))
        else:
            rotatable.add((bond[1],bond[0]))
...

and then the 4 atoms defining a torsion are pulled out as follows:

def getTorsion(mol,bond):
    for atom in mol.GetAtomWithIdx(bond[0]).GetNeighbors():
        idx=atom.GetIdx()
        if idx!=bond[1]:
            first=idx
            break
    for atom in mol.GetAtomWithIdx(bond[1]).GetNeighbors():
        idx=atom.GetIdx()
        if idx!=bond[0]:
            last=idx
            break
    return (first,bond[0],bond[1],last)

In my case it works fine because the atoms defined by the "bond" tuple are
tri- or divalent (so it doesn't matter which "neighbour" is picked), but
you may need to add additional conditionals (like ensuring it is not H).

Best wishes,
Michal

On 20 October 2015 at 09:41, Jose Manuel Gally <
[email protected]> wrote:

> Hi RDKitters,
>
> I would like to consider parts of a conformation rigid (fixed dihedral
> angles) during minimization
> My end goal would be to generate only ring conformations starting with
> valid 3D molecules.
>
> I can already consider a specific dihedral angle as rigid:
>
> from rdkit import Chem
> from rdkit.Chem import AllChem, rdMolTransforms
>
> # create test mol
> s = 'COCCN1CCOCC1'
> m = Chem.MolFromSmiles(s)
> m = Chem.AddHs(m)
>
> # add 3D coordinates
> AllChem.EmbedMolecule(m)
>
> # freeze one dihedral angle (composed of atoms 0-3)
> MMFFs_MP = AllChem.MMFFGetMoleculeProperties(m, mmffVariant='MMFF94s')
> MMFFs_FF = AllChem.MMFFGetMoleculeForceField(m, MMFFs_MP)
> MMFFs_FF.MMFFAddTorsionConstraint(0, 1, 2, 3, relative=True,
> minDihedralDeg=0.0, maxDihedralDeg=0.0,forceConstant=99999999999999.0)
> c = m.GetConformer()
> print "before min", rdMolTransforms.GetDihedralDeg(c, 0,1,2,3) #
> -53.0873064656
>
> # minimize molecule with constrained dihedral angle
> MMFFs_FF.Minimize(maxIts=10)
> print "after first min", rdMolTransforms.GetDihedralDeg(c,0,1,2,3) #
> -53.0873064656
> MMFFs_FF.Minimize(maxIts=10)
> print "after second min", rdMolTransforms.GetDihedralDeg(c,0,1,2,3) #
> -53.0873064656
>
> However, I have difficulties to find all dihedral angles to consider
> rigid...
> I would like to detect dihedral angles with 4 atoms where:
>      - none is hydrogen
>      - no more than 2 atoms are in different rings
>
> First I looked for a function to return me the list of dihedral angles
> and iterate over it, but could not find any.
> My other alternative would be to iterate over atoms to get their
> neighbors, and then get their neighbor' neighbors, but that looks very
> very slow.
> Any other way to do this?
>
> Thank you!
>
> Jose Manuel
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to