This is a read-only mirror of pymolwiki.org

Difference between revisions of "Centroid"

From PyMOL Wiki
Jump to navigation Jump to search
(What this script is actually computing is the centroid not the center of mass. The center of mass is the mass-weighted average of the coordinates.)
Line 1: Line 1:
 
{{Infobox script-repo
 
{{Infobox script-repo
 
|type      = module
 
|type      = module
|filename  = com.py
+
|filename  = centroid.py
 
|author    = [[User:Inchoate|Jason Vertrees]]
 
|author    = [[User:Inchoate|Jason Vertrees]]
 
|license  = BSD
 
|license  = BSD
Line 7: Line 7:
  
 
== Overview ==  
 
== Overview ==  
[[COM]] is a small script that returns the value of the center of mass of your selection.  It also can translate the object of that selection to the origin.
+
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">
COM (selection=PyMOLSelection), [center=boolean]
+
centroid (selection=PyMOLSelection), [center=boolean]
 
</source>
 
</source>
  
 
== Examples ==
 
== Examples ==
 
<source lang="python">
 
<source lang="python">
# get the COM of the polymer
+
# get the centroid of the polymer
import com
+
import centroid
 
fetch 4ins, async=0
 
fetch 4ins, async=0
COM polymer
+
centroid polymer
  
 
# move some 'ligand' to the origin
 
# move some 'ligand' to the origin
COM ligand, center=1
+
centroid ligand, center=1
 
</source>
 
</source>
  

Revision as of 22:54, 14 September 2015

Type Python Module
Download 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

Center_Of_Mass