Average b: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
print "average B of '", selection,"': ", averagetempfactor | print "average B of '", selection,"': ", averagetempfactor | ||
cmd.extend("average_b",average_b) | cmd.extend("average_b",average_b) | ||
[[Category:Script_Library]] |
Revision as of 16:37, 17 April 2009
average_b.py
- calculate the average B-factor of a selection.
usage
- copy code to text file and save as average_b.py. Install via Plugin>Install plugin from within PyMOL.
- restart PyMOL and then type "average_b (selection)"
author
Gregor Hagelueken
code
<source lang="python"> from pymol import cmd,stored def average_b(selection): stored.tempfactor=0 stored.atomnumber=0 cmd.iterate(selection,"stored.tempfactor=stored.tempfactor+b") cmd.iterate(selection,"stored.atomnumber=stored.atomnumber+1") print "Your selection: ", selection print "sum of B factors: ", stored.tempfactor print "number of atoms: ",stored.atomnumber averagetempfactor=stored.tempfactor/stored.atomnumber print "average B of '", selection,"': ", averagetempfactor cmd.extend("average_b",average_b)