This is a read-only mirror of pymolwiki.org

Average b

From PyMOL Wiki
Revision as of 17:48, 16 December 2008 by Gha (talk | contribs) (New page: =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 P...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)"

Contact

Gregor Hagelueken, gh50@st-andrews.ac.uk

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)