Get coordset: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(created)
 
(name argument)
 
Line 15: Line 15:
== Arguments ==
== Arguments ==


* '''selection''' = str: atom selection
* '''name''' = str: object name
* '''state''' = int: state index {default: 1}
* '''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.
* '''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.

Latest revision as of 11:24, 4 September 2017

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