Hi Gianluca,

Unfortunately, Pymol offers no such functionality intrinsically. But
this is where python comes in handy. Attached you find a script I
wrote for the purpose. It allows you to shift objects or selections
over the periodic lattice:

run lattice.py
create ObjectCopy,MyObject
shift 1,0,0,ObjectCopy # make one shift over the first vector of the lattice
shift 0,1,0,ObjectCopy # make one shift over the second vector of the lattice
shift 2,2,2,ObjectCopy # make two shifts over each of the vectors of
the lattice

Hope it helps,

Tsjerk

On 4/19/07, Gianluca Santarossa <gianluca.santaro...@chem.ethz.ch> wrote:
Dear all,
is there a way to show the periodic images from a slab in PyMOL?

Thanks,
Gianluca
--
==============================================================
Gianluca Santarossa
Institute for Chemical and Bioengineering
Department of Chemistry and Applied Biosciences
ETH Zurich, Hönggerberg, HCI, 8093 Zurich

Phone: +41 44 633 4232
E-Mail: gianluca.santaro...@chem.ethz.ch
==============================================================

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users



--
Tsjerk A. Wassenaar, Ph.D.
Junior UD (post-doc)
Biomolecular NMR, Bijvoet Center
Utrecht University
Padualaan 8
3584 CH Utrecht
The Netherlands
P: +31-30-2539931
F: +31-30-2537623
from pymol import cmd
from math import *

def triclinic(L):
    B = [[0,0,0],[0,0,0],[0,0,0]]

    x, y, z, a, b, c = L[:6]

    B[0][0] = x
    if a == 90 and b == 90 and c == 90:
        B[1][1] = y
        B[2][2] = z
    else:
        a = a*pi/180
        b = b*pi/180
        c = c*pi/180
        B[1][0] = y*cos(c)
        B[1][1] = y*sin(c)
        B[2][0] = z*cos(b)
        B[2][1] = z*(cos(a)-cos(b)*cos(c))/sin(c)
        B[2][2] = sqrt(z*z-B[2][0]**2-B[2][1]**2)

    return B    

def get_lattice(selection=""):
    if selection:
        S = cmd.get_symmetry(selection)
    else:
        S = cmd.get_symmetry()
        
    print S

    return triclinic(S)

def shift(n1=0,n2=0,n3=0,selection="",L=None):
    n1, n2, n3 = float(n1), float(n2), float(n3)
    
    if not L:
        L = get_lattice(selection)
    if not selection:
        selection = "all"

    cmd.alter_state(1,selection,"(x,y,z)=(x+%f,y+%f,z+%f)"
                    %(n1*L[0][0]+n2*L[1][0]+n3*L[2][0],
                      n1*L[0][1]+n2*L[1][1]+n3*L[2][1],
                      n1*L[0][2]+n2*L[1][2]+n3*L[2][2]))
    
cmd.extend("get_lattice",get_lattice)
cmd.extend("shift",shift)

Reply via email to