Get coordset

From PyMOLWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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