<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Henschel</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Henschel"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/Henschel"/>
	<updated>2026-06-13T10:57:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5042</id>
		<title>Center of mass</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5042"/>
		<updated>2007-04-20T17:47:46Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a script that calculates the center of mass from a selection. &lt;br /&gt;
It gets hold of the coordinates with cmd.get_model.&lt;br /&gt;
Make sure the atoms in the selection are of equal weight. &lt;br /&gt;
&lt;br /&gt;
For a sample application, see: [http://yggdrasil.biotec.tu-dresden.de/abac/b.47.1.2___b.16.1.1___g.4.1.1.html &amp;quot;Convergent Evolution Examples&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
## Author: Andreas Henschel 2006&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from pymol.cgo import *&lt;br /&gt;
&lt;br /&gt;
def centerOfMass(selection):&lt;br /&gt;
   ## assumes equal weights (best called with &amp;quot;and name ca&amp;quot; suffix)&lt;br /&gt;
   model = cmd.get_model(selection)&lt;br /&gt;
   x,y,z=0,0,0&lt;br /&gt;
   for a in model.atom:&lt;br /&gt;
       x+= a.coord[0]&lt;br /&gt;
       y+= a.coord[1]&lt;br /&gt;
       z+= a.coord[2]&lt;br /&gt;
   return (x/len(model.atom), y/len(model.atom), z/len(model.atom))&lt;br /&gt;
&lt;br /&gt;
cmd.load(&amp;quot;/group/bioinf/Data/PDBLinks/1c7c.pdb&amp;quot;)&lt;br /&gt;
cmd.select(&amp;quot;domain&amp;quot;, &amp;quot;/1c7c//A/143-283/ and name ca&amp;quot;) ## selecting a domain&lt;br /&gt;
&lt;br /&gt;
domainCenter=centerOfMass(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Center of mass: (%.1f,%.1f,%.1f)&amp;quot;% domainCenter&lt;br /&gt;
cmd.as(&amp;quot;cartoon&amp;quot;, &amp;quot;all&amp;quot;)&lt;br /&gt;
cmd.show(&amp;quot;spheres&amp;quot;, &amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
## Creating a sphere CGO&lt;br /&gt;
com = [COLOR, 1.0, 1.0, 1.0, SPHERE]+list(domainCenter) + [3.0] ## white sphere with 3A radius&lt;br /&gt;
cmd.load_cgo(com, &amp;quot;CoM&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.zoom(&amp;quot;1c7c&amp;quot;, 1.0)&lt;br /&gt;
cmd.center(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ pymol -qc centerOfMass4.py&lt;br /&gt;
#Center of mass: (-1.0,24.5,48.2)&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Category:Script_Library&amp;diff=3887</id>
		<title>Category:Script Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Category:Script_Library&amp;diff=3887"/>
		<updated>2007-04-20T17:42:28Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Zero_residues]] -- Renumber residues such that the first residue is 0.  Useful for alignments.&lt;br /&gt;
&lt;br /&gt;
* [[Cealign]] -- Implementation of the CE Structure Alignment algorithm as a PyMOL plugin.&lt;br /&gt;
&lt;br /&gt;
* [[WriteSS]] -- Writes secondary structural elements, for each residues, to a file.&lt;br /&gt;
&lt;br /&gt;
* [[Process_All_Files_In_Directory]] -- Do something to all files in a directory.  The examples show how to print the disulfide bond lengths, then in general all sulfur distances (not necessarily bound).&lt;br /&gt;
&lt;br /&gt;
* [[Kabsch]] -- Kabsch alignment of two sets of vectors.  (Part 2 of a protein alignment.)&lt;br /&gt;
&lt;br /&gt;
* [[Transform_odb]] -- Transform a selection of an existing object and output as a new object.  The transformation matrix is read from an &amp;quot;O&amp;quot;-style tranformation matrix file (.odb) written by &amp;quot;O&amp;quot; or by any of the Uppsala Software Factory programs (from Gerard Klegweit) such as LSQMAN.&lt;br /&gt;
&lt;br /&gt;
* [[Stereo_Ray]] -- This script will create two resolution specific ray traced images rotated appropriately for inclusion into a single file to represent a stereo view of the desired macromolecule.&lt;br /&gt;
&lt;br /&gt;
* [[Translate_And_Measure]] -- prints '''overlap''' if any of the atoms in molA or molB were within 4 Angstrom after translating by 1 along X&lt;br /&gt;
&lt;br /&gt;
* [[Show aromatics]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for aromatic residues displayed as green &amp;quot;sticks&amp;quot;.  Usage: Save this as &amp;quot;show_aromatics.pml&amp;quot;, load your protein in PyMOL, and run the script (select &amp;quot;Run&amp;quot; from the &amp;quot;File&amp;quot; menu). (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show hydrophobics]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for hydrophobic residues displayed as orange &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show charged]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for charged residues displayed as red (negative) or blue (posititve) &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show hydrophilic]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for hydrophilic residues displayed as green &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show NMR constrains]] -- This script will display the NMR constrains used for a structure calculation atop a structure.  Usage: Save this as &amp;quot;NMRcnstr.py&amp;quot; load your protein in PyMOL, and run the script. type upl('fname') or cns('fname') where fname is the filename with the NMR constrains you want to display. &lt;br /&gt;
&lt;br /&gt;
* [[Perp Maker]] -- Creates a perpendicular plane through the center of your protein with respect to the camera's current position.  (If you translate the protein towards the camera a bit, you get a nice surface, sometimes.) A stupid little script I wrote in response to a request a few months ago (and it doesn't even conform to the request!)  Load a protein, run the script (read the documentation in the script). (Jason Vertrees/[[User:Tree|Tree]])&lt;br /&gt;
&lt;br /&gt;
* [[PythonTerminal]] -- Allows execution of python commands from the PyMOL command line.&lt;br /&gt;
&lt;br /&gt;
* [[Axes]] -- Creates a 3D-CGO object that shows the three coordinate axes.&lt;br /&gt;
&lt;br /&gt;
* [[CGO Text]] -- Creates a 3D-CGO text object.&lt;br /&gt;
&lt;br /&gt;
* [[List Selection]] -- Prints a list of all residues in a selection (both Python and .pml).&lt;br /&gt;
&lt;br /&gt;
* [[List Colors]] -- Lists the color of all residues in a selection (both Python and .pml).&lt;br /&gt;
&lt;br /&gt;
* [[List Secondary Structures]] -- Secondary structures (both predefined and those calculated with the 'dss' command) can be exported as a long string ('HHHHLLLLSSS').&lt;br /&gt;
&lt;br /&gt;
* [[Split Movement]] -- Moves two parts of one object into different directions.&lt;br /&gt;
&lt;br /&gt;
* [[Selection Exists]] -- Python method that returns true if a selection of a given name exists.&lt;br /&gt;
&lt;br /&gt;
* [[Get Coordinates I]] -- Retrieves atom coordinates as Python objects.&lt;br /&gt;
&lt;br /&gt;
* [[Get Coordinates II]] -- Retrieves atom coordinates as Python array (list object).&lt;br /&gt;
&lt;br /&gt;
* [[grepset]] -- List all settings matching a given keyword. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[apropos]] -- List all commands matching a given keyword or whose docs contain the keyword. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[mouse_modes]] -- customize the default mouse bindings for Viewing or Editing modes. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[Measure Distance]] -- Measures the distance between two atoms (Python script).&lt;br /&gt;
&lt;br /&gt;
* [[Read PDB-String]] -- Parses a string in PDB format to a PyMOL object.&lt;br /&gt;
&lt;br /&gt;
* [[Color Objects]] -- Colors all objects differently (Python script).&lt;br /&gt;
&lt;br /&gt;
* [[Key Wait]] -- Process key events in a Python script.&lt;br /&gt;
&lt;br /&gt;
* [[Bounding Box]] -- Create a bounding box around a selection (Python script; requires numarray and Scientific; gilleain)&lt;br /&gt;
&lt;br /&gt;
* [[Ellipsoid]] -- Create callback object (opengl) ellipsoids. (Python script;  gilleain)&lt;br /&gt;
&lt;br /&gt;
* [[pdbsurvey]] -- Surveys the pdb for recently added structures that are relevant to a user-specified keywords list (in a text file)&lt;br /&gt;
&lt;br /&gt;
* [[resicolor]] -- Colors proteins according to residue type.&lt;br /&gt;
&lt;br /&gt;
* [[TransformSelectionByCameraView]] -- Transforms the selection by the camera view.&lt;br /&gt;
&lt;br /&gt;
* [[WFMesh]] -- Imports wavefront object mesh files; Starwars as an example!&lt;br /&gt;
&lt;br /&gt;
* [[grepsel]] -- Make named selections using regular expressions (protein sequence).&lt;br /&gt;
&lt;br /&gt;
* [[PowerMate Dial OS X]] -- Script and instructions to use the PowerMate dial on Mac OS X.&lt;br /&gt;
&lt;br /&gt;
* [[Plane Wizard]] -- Wizard to draw planes between three picked points.&lt;br /&gt;
&lt;br /&gt;
* [[Slerpy]] -- Pymol command extensions for key frame animation movie making.&lt;br /&gt;
&lt;br /&gt;
* [[Helicity_check]] -- helicity_check show the evolution of O - N distances over an amino acid sequence&lt;br /&gt;
&lt;br /&gt;
* [[Center Of Mass]] -- Given a selection of atoms (of equal weight) - Calculates the center of mass and represents it with a CGO sphere&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting|Script Library]]&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Category:Script_Library&amp;diff=3886</id>
		<title>Category:Script Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Category:Script_Library&amp;diff=3886"/>
		<updated>2007-04-20T17:41:08Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Zero_residues]] -- Renumber residues such that the first residue is 0.  Useful for alignments.&lt;br /&gt;
&lt;br /&gt;
* [[Cealign]] -- Implementation of the CE Structure Alignment algorithm as a PyMOL plugin.&lt;br /&gt;
&lt;br /&gt;
* [[WriteSS]] -- Writes secondary structural elements, for each residues, to a file.&lt;br /&gt;
&lt;br /&gt;
* [[Process_All_Files_In_Directory]] -- Do something to all files in a directory.  The examples show how to print the disulfide bond lengths, then in general all sulfur distances (not necessarily bound).&lt;br /&gt;
&lt;br /&gt;
* [[Kabsch]] -- Kabsch alignment of two sets of vectors.  (Part 2 of a protein alignment.)&lt;br /&gt;
&lt;br /&gt;
* [[Transform_odb]] -- Transform a selection of an existing object and output as a new object.  The transformation matrix is read from an &amp;quot;O&amp;quot;-style tranformation matrix file (.odb) written by &amp;quot;O&amp;quot; or by any of the Uppsala Software Factory programs (from Gerard Klegweit) such as LSQMAN.&lt;br /&gt;
&lt;br /&gt;
* [[Stereo_Ray]] -- This script will create two resolution specific ray traced images rotated appropriately for inclusion into a single file to represent a stereo view of the desired macromolecule.&lt;br /&gt;
&lt;br /&gt;
* [[Translate_And_Measure]] -- prints '''overlap''' if any of the atoms in molA or molB were within 4 Angstrom after translating by 1 along X&lt;br /&gt;
&lt;br /&gt;
* [[Show aromatics]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for aromatic residues displayed as green &amp;quot;sticks&amp;quot;.  Usage: Save this as &amp;quot;show_aromatics.pml&amp;quot;, load your protein in PyMOL, and run the script (select &amp;quot;Run&amp;quot; from the &amp;quot;File&amp;quot; menu). (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show hydrophobics]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for hydrophobic residues displayed as orange &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show charged]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for charged residues displayed as red (negative) or blue (posititve) &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show hydrophilic]] -- This script will display a backbone &amp;quot;worm&amp;quot; for your protein, with all of the sidechains for hydrophilic residues displayed as green &amp;quot;sticks&amp;quot;.  Usage: Same as &amp;quot;show aromatics&amp;quot;. (PyMOL script; TStout)&lt;br /&gt;
&lt;br /&gt;
* [[Show NMR constrains]] -- This script will display the NMR constrains used for a structure calculation atop a structure.  Usage: Save this as &amp;quot;NMRcnstr.py&amp;quot; load your protein in PyMOL, and run the script. type upl('fname') or cns('fname') where fname is the filename with the NMR constrains you want to display. &lt;br /&gt;
&lt;br /&gt;
* [[Perp Maker]] -- Creates a perpendicular plane through the center of your protein with respect to the camera's current position.  (If you translate the protein towards the camera a bit, you get a nice surface, sometimes.) A stupid little script I wrote in response to a request a few months ago (and it doesn't even conform to the request!)  Load a protein, run the script (read the documentation in the script). (Jason Vertrees/[[User:Tree|Tree]])&lt;br /&gt;
&lt;br /&gt;
* [[PythonTerminal]] -- Allows execution of python commands from the PyMOL command line.&lt;br /&gt;
&lt;br /&gt;
* [[Axes]] -- Creates a 3D-CGO object that shows the three coordinate axes.&lt;br /&gt;
&lt;br /&gt;
* [[CGO Text]] -- Creates a 3D-CGO text object.&lt;br /&gt;
&lt;br /&gt;
* [[List Selection]] -- Prints a list of all residues in a selection (both Python and .pml).&lt;br /&gt;
&lt;br /&gt;
* [[List Colors]] -- Lists the color of all residues in a selection (both Python and .pml).&lt;br /&gt;
&lt;br /&gt;
* [[List Secondary Structures]] -- Secondary structures (both predefined and those calculated with the 'dss' command) can be exported as a long string ('HHHHLLLLSSS').&lt;br /&gt;
&lt;br /&gt;
* [[Split Movement]] -- Moves two parts of one object into different directions.&lt;br /&gt;
&lt;br /&gt;
* [[Selection Exists]] -- Python method that returns true if a selection of a given name exists.&lt;br /&gt;
&lt;br /&gt;
* [[Get Coordinates I]] -- Retrieves atom coordinates as Python objects.&lt;br /&gt;
&lt;br /&gt;
* [[Get Coordinates II]] -- Retrieves atom coordinates as Python array (list object).&lt;br /&gt;
&lt;br /&gt;
* [[grepset]] -- List all settings matching a given keyword. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[apropos]] -- List all commands matching a given keyword or whose docs contain the keyword. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[mouse_modes]] -- customize the default mouse bindings for Viewing or Editing modes. - ''by EHP''&lt;br /&gt;
&lt;br /&gt;
* [[Measure Distance]] -- Measures the distance between two atoms (Python script).&lt;br /&gt;
&lt;br /&gt;
* [[Read PDB-String]] -- Parses a string in PDB format to a PyMOL object.&lt;br /&gt;
&lt;br /&gt;
* [[Color Objects]] -- Colors all objects differently (Python script).&lt;br /&gt;
&lt;br /&gt;
* [[Key Wait]] -- Process key events in a Python script.&lt;br /&gt;
&lt;br /&gt;
* [[Bounding Box]] -- Create a bounding box around a selection (Python script; requires numarray and Scientific; gilleain)&lt;br /&gt;
&lt;br /&gt;
* [[Ellipsoid]] -- Create callback object (opengl) ellipsoids. (Python script;  gilleain)&lt;br /&gt;
&lt;br /&gt;
* [[pdbsurvey]] -- Surveys the pdb for recently added structures that are relevant to a user-specified keywords list (in a text file)&lt;br /&gt;
&lt;br /&gt;
* [[resicolor]] -- Colors proteins according to residue type.&lt;br /&gt;
&lt;br /&gt;
* [[TransformSelectionByCameraView]] -- Transforms the selection by the camera view.&lt;br /&gt;
&lt;br /&gt;
* [[WFMesh]] -- Imports wavefront object mesh files; Starwars as an example!&lt;br /&gt;
&lt;br /&gt;
* [[grepsel]] -- Make named selections using regular expressions (protein sequence).&lt;br /&gt;
&lt;br /&gt;
* [[PowerMate Dial OS X]] -- Script and instructions to use the PowerMate dial on Mac OS X.&lt;br /&gt;
&lt;br /&gt;
* [[Plane Wizard]] -- Wizard to draw planes between three picked points.&lt;br /&gt;
&lt;br /&gt;
* [[Slerpy]] -- Pymol command extensions for key frame animation movie making.&lt;br /&gt;
&lt;br /&gt;
* [[Helicity_check]] -- helicity_check show the evolution of O - N distances over an amino acid sequence&lt;br /&gt;
&lt;br /&gt;
* [[Center of mass]] -- Given a selection of atoms (of equal weight) - Calculates the center of mass and represents it with a CGO sphere&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting|Script Library]]&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5041</id>
		<title>Center of mass</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5041"/>
		<updated>2007-04-20T17:39:14Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a script that calculates the center of mass from a selection. It gets hold of the coordinates with cmd.get_model.&lt;br /&gt;
Make sure the atoms in the selection are of equal weight. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from pymol.cgo import *&lt;br /&gt;
&lt;br /&gt;
def centerOfMass(selection):&lt;br /&gt;
   ## assumes equal weights (best called with &amp;quot;and name ca&amp;quot; suffix)&lt;br /&gt;
   model = cmd.get_model(selection)&lt;br /&gt;
   x,y,z=0,0,0&lt;br /&gt;
   for a in model.atom:&lt;br /&gt;
       x+= a.coord[0]&lt;br /&gt;
       y+= a.coord[1]&lt;br /&gt;
       z+= a.coord[2]&lt;br /&gt;
   return (x/len(model.atom), y/len(model.atom), z/len(model.atom))&lt;br /&gt;
&lt;br /&gt;
cmd.load(&amp;quot;/group/bioinf/Data/PDBLinks/1c7c.pdb&amp;quot;)&lt;br /&gt;
cmd.select(&amp;quot;domain&amp;quot;, &amp;quot;/1c7c//A/143-283/ and name ca&amp;quot;) ## selecting a domain&lt;br /&gt;
&lt;br /&gt;
domainCenter=centerOfMass(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Center of mass: (%.1f,%.1f,%.1f)&amp;quot;% domainCenter&lt;br /&gt;
cmd.as(&amp;quot;cartoon&amp;quot;, &amp;quot;all&amp;quot;)&lt;br /&gt;
cmd.show(&amp;quot;spheres&amp;quot;, &amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
## Creating a sphere CGO&lt;br /&gt;
com = [COLOR, 1.0, 1.0, 1.0, SPHERE]+list(domainCenter) + [3.0] ## white sphere with 3A radius&lt;br /&gt;
cmd.load_cgo(com, &amp;quot;CoM&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.zoom(&amp;quot;1c7c&amp;quot;, 1.0)&lt;br /&gt;
cmd.center(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ pymol -qc centerOfMass4.py&lt;br /&gt;
#Center of mass: (-1.0,24.5,48.2)&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5040</id>
		<title>Center of mass</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Center_of_mass&amp;diff=5040"/>
		<updated>2007-04-20T17:36:45Z</updated>

		<summary type="html">&lt;p&gt;Henschel: New page: &amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;  from pymol import cmd from pymol.cgo import *  def centerOfMass(selection):    ## assumes equal weights (best called with &amp;quot;and name ca&amp;quot; suffix)    model = cmd.get_model(selection...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from pymol.cgo import *&lt;br /&gt;
&lt;br /&gt;
def centerOfMass(selection):&lt;br /&gt;
   ## assumes equal weights (best called with &amp;quot;and name ca&amp;quot; suffix)&lt;br /&gt;
   model = cmd.get_model(selection)&lt;br /&gt;
   x,y,z=0,0,0&lt;br /&gt;
   for a in model.atom:&lt;br /&gt;
       x+= a.coord[0]&lt;br /&gt;
       y+= a.coord[1]&lt;br /&gt;
       z+= a.coord[2]&lt;br /&gt;
   return (x/len(model.atom), y/len(model.atom), z/len(model.atom))&lt;br /&gt;
&lt;br /&gt;
cmd.load(&amp;quot;/group/bioinf/Data/PDBLinks/1c7c.pdb&amp;quot;)&lt;br /&gt;
cmd.select(&amp;quot;domain&amp;quot;, &amp;quot;/1c7c//A/143-283/ and name ca&amp;quot;) ## selecting a domain&lt;br /&gt;
&lt;br /&gt;
domainCenter=centerOfMass(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Center of mass: (%.1f,%.1f,%.1f)&amp;quot;% domainCenter&lt;br /&gt;
cmd.as(&amp;quot;cartoon&amp;quot;, &amp;quot;all&amp;quot;)&lt;br /&gt;
cmd.show(&amp;quot;spheres&amp;quot;, &amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
## Creating a sphere CGO&lt;br /&gt;
com = [COLOR, 1.0, 1.0, 1.0, SPHERE]+list(domainCenter) + [3.0] ## white sphere with 3A radius&lt;br /&gt;
cmd.load_cgo(com, &amp;quot;CoM&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.zoom(&amp;quot;1c7c&amp;quot;, 1.0)&lt;br /&gt;
cmd.center(&amp;quot;domain&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ pymol -qc centerOfMass4.py&lt;br /&gt;
#Center of mass: (-1.0,24.5,48.2)&lt;br /&gt;
#ah@bioinfws19:~/Projects/PyMOL$ &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:Distance&amp;diff=48</id>
		<title>Talk:Distance</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:Distance&amp;diff=48"/>
		<updated>2005-08-25T09:47:39Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Concerning modes ==&lt;br /&gt;
&lt;br /&gt;
As far as I figured out, &lt;br /&gt;
'''mode 0'''  calculates distances regardless of atom type, while&lt;br /&gt;
'''mode 2''' calculates distances for polar atoms.&lt;br /&gt;
Right? Andreas (ah at biotec.tu-dresden.de)&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:Distance&amp;diff=47</id>
		<title>Talk:Distance</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:Distance&amp;diff=47"/>
		<updated>2005-08-25T09:46:47Z</updated>

		<summary type="html">&lt;p&gt;Henschel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Concerning modes ==&lt;br /&gt;
&lt;br /&gt;
As far as I figured out, &lt;br /&gt;
'''mode 0'''  calculates distances regardless of atom type, while&lt;br /&gt;
'''mode 2''' calculates distances for polar atoms.&lt;br /&gt;
Right?&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Distance&amp;diff=3595</id>
		<title>Distance</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Distance&amp;diff=3595"/>
		<updated>2005-03-11T22:09:07Z</updated>

		<summary type="html">&lt;p&gt;Henschel: /* USAGE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===DESCRIPTION===&lt;br /&gt;
&amp;quot;distance&amp;quot; creates a new distance object between two&lt;br /&gt;
selections.  It will display all distances within the cutoff.&lt;br /&gt;
&lt;br /&gt;
===USAGE===&lt;br /&gt;
 distance &lt;br /&gt;
 distance (selection1), (selection2)&lt;br /&gt;
 distance name = (selection1), (selection2) [,cutoff [,mode] ]&lt;br /&gt;
 &lt;br /&gt;
 name = name of distance object &lt;br /&gt;
 selection1, selection2 = atom selections&lt;br /&gt;
 cutoff = maximum distance to display&lt;br /&gt;
 mode = 0 (default)&lt;br /&gt;
&lt;br /&gt;
===PYMOL API===&lt;br /&gt;
 cmd.distance( string name, string selection1, string selection2,&lt;br /&gt;
               string cutoff, string mode )&lt;br /&gt;
   # returns the average distance between all atoms/frames&lt;br /&gt;
&lt;br /&gt;
===NOTES===&lt;br /&gt;
The distance wizard makes measuring distances easier than using&lt;br /&gt;
the &amp;quot;dist&amp;quot; command for real-time operations.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;dist&amp;quot; alone will show distances between selections (pk1) and (pk1),&lt;br /&gt;
which can be set using the PkAt mouse action (usually CTRL-middle-click). &lt;br /&gt;
&lt;br /&gt;
[[Category:Commands|distance]]&lt;/div&gt;</summary>
		<author><name>Henschel</name></author>
	</entry>
</feed>