Thanks Thomas,

I tried your solution (adapted to my code) and now everything is working.


def set_phi(res_num, res_name, phi):
    if res_num != 0 and res_name != 'PRO':
        cmd.set_dihedral('resi %s and name C' % (res_num-1), 'resi %s and
name N' % res_num, 'resi %s and name CA' % res_num, 'resi %s and name C' %
res_num, phi, state=1, quiet=1)
    if res_num != 0 and res_name == 'PRO':
        cmd.unbond('resi %s and name N' % res_num, 'resi %s and name CD' %
res_num)
        cmd.set_dihedral('resi %s and name C' % (res_num-1), 'resi %s and
name N' % res_num, 'resi %s and name CA' % res_num, 'resi %s and name C' %
res_num, phi, state=1, quiet=1)
        cmd.bond('resi %s and name N' % res_num, 'resi %s and name CD' %
res_num


Cheers,

Osvaldo.

On Fri, Oct 4, 2013 at 9:50 AM, Thomas Holder <[email protected]
> wrote:

> Hi Osvaldo,
>
> unfortunately PyMOL doesn't handle to set dihedrals in rings, so you have
> to break the ring first. Consider this:
>
> def set_phi(resi, phi, state=1, quiet=1):
>     x = cmd.index('(first (resi %s and guide)) extend 2 and name C+N+CA' %
> resi)
>     try:
>         a = cmd.get_model(x[2], state).atom[0]
>         if a.name != "CA":
>             raise IndexError
>     except IndexError:
>         print " missing atoms"
>         return
>     if a.resn == "PRO":
>         bondargs = (x[1], "resi %s and name CD" % resi)
>         cmd.unbond(*bondargs)
>     cmd.set_dihedral(x[0], x[1], x[2], x[3], phi, state, quiet)
>     if a.resn == "PRO":
>         cmd.bond(*bondargs)
>
> Hope that helps.
>
> Cheers,
>   Thomas
>
> On Oct 2, 2013, at 8:28 PM, Osvaldo Martin <[email protected]> wrote:
> > Hi everybody,
> >
> > I can“t change the phi angle of proline using the function below. It
> works for all other amino acids. If quiet = 0, it prints the value of the
> variable "phi" (i.e. the value that the phi_angle should adopt). The phi
> angle of proline is always around ~11.0
> >
> > def set_phi(res_num, phi):
> >     if res_num != 0:
> >         cmd.set_dihedral('resi %s and name C' % (res_num-1), 'resi %s
> and name N' % res_num, 'resi %s and name CA' % res_num, 'resi %s and name
> C' % res_num, phi, state=1, quiet=1)
> >
> > Thanks in advance.
>
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
PyMOL-users mailing list ([email protected])
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/[email protected]

Reply via email to