This is a read-only mirror of pymolwiki.org
Difference between revisions of "Center of mass"
m (1 revision) |
|||
(14 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Infobox script-repo | ||
+ | |type = script | ||
+ | |filename = center_of_mass.py | ||
+ | |author = [[User:Henschel|Henschel]] | ||
+ | |license = | ||
+ | }} | ||
+ | |||
===Description=== | ===Description=== | ||
Line 6: | Line 13: | ||
<source lang="python"> | <source lang="python"> | ||
− | com selection [,state=None [,mass=None [, | + | com selection [,state=None [,mass=None [,object=None]]] |
</source> | </source> | ||
Line 12: | Line 19: | ||
===Examples=== | ===Examples=== | ||
− | <source lang="python> | + | <source lang="python"> |
+ | import center_of_mass | ||
fetch 1c3y, finish=1, multiplex=0 | fetch 1c3y, finish=1, multiplex=0 | ||
com 1c3y, state=1 | com 1c3y, state=1 | ||
− | # | + | #Create a pseudoatom representing the 1c3y COG and store it as "1c3y_COM" |
− | + | #The "1c3y_COM" object will contain 1 state only | |
− | |||
− | # | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | com 1c3y, state=1, object=COG | |
− | + | #Create a pseudoatom representing the 1c3y COG and store it as "COG" | |
− | + | #The "COG" object will contain 1 state only | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | com 1c3y, state=1, object=COM, mass=1 | |
− | + | #Create a pseudoatom representing the 1c3y COM and store it as "COM" | |
− | + | #The "COM" object will contain 1 state only | |
− | |||
− | |||
+ | com 1c3y, object=COM, mass=1 | ||
+ | #Create a single pseudoatom containing the COM for each state found in 1c3y and store it as "COM" | ||
+ | #The "COM" object will contain MULTIPLE states! | ||
</source> | </source> | ||
+ | === See Also === | ||
− | + | * [[centerofmass]] (new command in PyMOL 1.7.2) | |
− | + | * [[COM]] | |
− | + | * [[get_extent]] | |
− | + | * [[get_position]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Script_Library|Center of Mass]] | [[Category:Script_Library|Center of Mass]] | ||
[[Category:Math_Scripts]] | [[Category:Math_Scripts]] | ||
+ | [[Category:Pymol-script-repo]] |
Latest revision as of 00:06, 17 October 2016
Type | Python Script |
---|---|
Download | center_of_mass.py |
Author(s) | Henschel |
License | |
This code has been put under version control in the project Pymol-script-repo |
Description
This script calculates the true center-of-mass (COM) or the center-of-geometry (COG) for a given selection and returns the x, y, z values in the form of a Pseudoatom (rather than a CGO sphere). The benefit of using a Pseudoatom is that it can be selected and used in calculations. In addition, this script also iteratively goes through all states of a selection if more than one state exists and appends the corresponding COM/COG values as states into the Pseudoatom. The script itself is quite simple yet robust enough to be applied in different settings. As well, the calculation of the COM/COG is handled independently from the formation of the Pseudoatom and can be called as an independent function where applicable.
Usage
com selection [,state=None [,mass=None [,object=None]]]
Examples
import center_of_mass
fetch 1c3y, finish=1, multiplex=0
com 1c3y, state=1
#Create a pseudoatom representing the 1c3y COG and store it as "1c3y_COM"
#The "1c3y_COM" object will contain 1 state only
com 1c3y, state=1, object=COG
#Create a pseudoatom representing the 1c3y COG and store it as "COG"
#The "COG" object will contain 1 state only
com 1c3y, state=1, object=COM, mass=1
#Create a pseudoatom representing the 1c3y COM and store it as "COM"
#The "COM" object will contain 1 state only
com 1c3y, object=COM, mass=1
#Create a single pseudoatom containing the COM for each state found in 1c3y and store it as "COM"
#The "COM" object will contain MULTIPLE states!
See Also
- centerofmass (new command in PyMOL 1.7.2)
- COM
- get_extent
- get_position