Centroid: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| No edit summary | PedroLacerda (talk | contribs)  No edit summary | ||
| (15 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
| {{Infobox script-repo | |||
| |type      = module | |||
| |filename  = scripts/centroid.py | |||
| |author    = [[User:Inchoate|Jason Vertrees]] | |||
| |license   = BSD | |||
| }} | |||
| == Overview ==   | == Overview ==   | ||
| Centroid is a small script that returns the value of the geometric center (or centroid) of your selection.  It also can translate the object of that selection to the origin. | |||
| == Syntax == | == Syntax == | ||
| <source lang="python"> | <source lang="python"> | ||
| centroid (selection=PyMOLSelection), [center=boolean] | |||
| </source> | </source> | ||
| == Examples == | == Examples == | ||
| <source lang="python"> | <source lang="python"> | ||
| # get the  | # get the centroid of the polymer | ||
| import centroid | |||
| fetch 4ins, async=0 | |||
| centroid polymer | |||
| # move some 'ligand' to the origin | # move some 'ligand' to the origin | ||
| centroid ligand, center=1 | |||
| </source> | </source> | ||
| ===See Also=== | |||
| * [[centerofmass]] (new command in PyMOL 1.7.2) | |||
| * [[Center_Of_Mass]] | |||
| [[Category:Script_Library|CenterOfMass]] | [[Category:Script_Library|CenterOfMass]] | ||
| [[Category:Structural_Biology_Scripts]] | |||
| [[Category:Pymol-script-repo]] | |||
Latest revision as of 21:37, 22 June 2025
| Type | Python Module | 
|---|---|
| Download | scripts/centroid.py | 
| Author(s) | Jason Vertrees | 
| License | BSD | 
| This code has been put under version control in the project Pymol-script-repo | |
Overview
Centroid is a small script that returns the value of the geometric center (or centroid) of your selection. It also can translate the object of that selection to the origin.
Syntax
centroid (selection=PyMOLSelection), [center=boolean]
Examples
# get the centroid of the polymer
import centroid
fetch 4ins, async=0
centroid polymer
# move some 'ligand' to the origin
centroid ligand, center=1
See Also
- centerofmass (new command in PyMOL 1.7.2)
- Center_Of_Mass