Changes between Initial Version and Version 1 of FlipZ


Ignore:
Timestamp:
Sep 3, 2020, 4:25:27 PM (6 years ago)
Author:
goddard
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FlipZ

    v1 v1  
     1= Flip Atom Z Coordinates =
     2
     3Here is Python code defining a command flip that changes atom z coordinates z -> -z.   This changes the hand of the atomic structure, for instance changing all L amino acids to D amino acids.  Open flip.py in ChimeraX 1.0 to define the flip command
     4
     5{{{
     6open flip.py
     7}}}
     8
     9then use the command on the atomic model.
     10
     11{{{
     12flip #1
     13}}}
     14
     15[[Image(flip.png, 500px)]]
     16
     17Here is the [attachment:flip.py flip.py] code:
     18
     19{{{
     20# Create command to change atom coordiates z -> -z.
     21# Opening this file in ChimeraX 1.0 defines the flip command.
     22#
     23#  flip #1
     24
     25def flip(session, atoms):
     26    xyz = atoms.coords
     27    xyz[:,2] *= -1
     28    atoms.coords = xyz
     29
     30def register_command(session):
     31    from chimerax.core.commands import CmdDesc, register
     32    from chimerax.atomic import AtomsArg
     33    desc = CmdDesc(required=[('atoms', AtomsArg)],
     34                   synopsis='flip atom z coordinates')
     35    register('flip', desc, flip, logger=session.logger)
     36
     37register_command(session)
     38}}}