Get coordset

From PyMOLWiki
Revision as of 11:24, 4 September 2017 by Speleo3 (talk | contribs) (name argument)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

get_coordset is an API only function that returns the coordinates of one object-state (one "coordinate set") as a numpy array.

New in PyMOL 1.7.4

The order of coordinates might differ from functions like iterate or get_coords. The function does not take the state or TTT matrices into account.

PyMOL API

cmd.get_coordset(str name, int state=1, int copy=1)

Returns: ndarray, shape (N, 3), where N is the number of atoms.

Arguments

  • name = str: object name
  • state = int: state index {default: 1}
  • copy = 0/1: {default: 1} Warning: only use copy=0 if you know what you're doing. copy=0 will return a numpy array which is a wrapper of the internal coordinate set memory and provides read-write access. If the internal memory gets freed or reallocated, this wrapper will become invalid.

Examples

Move an object to its geometric center:

cs = cmd.get_coordset('1ubq', copy=0)
cs -= cs.mean(0)
cmd.rebuild()

See Also