Scripts: flip.py

File flip.py, 538 bytes (added by goddard, 6 years ago)
Line 
1# Create command to change atom coordiates z -> -z.
2# Opening this file in ChimeraX 1.0 defines the flip command.
3#
4# flip #1
5
6def flip(session, atoms):
7 xyz = atoms.coords
8 xyz[:,2] *= -1
9 atoms.coords = xyz
10
11def register_command(session):
12 from chimerax.core.commands import CmdDesc, register
13 from chimerax.atomic import AtomsArg
14 desc = CmdDesc(required=[('atoms', AtomsArg)],
15 synopsis='flip atom z coordinates')
16 register('flip', desc, flip, logger=session.logger)
17
18register_command(session)