This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Python Gaussian Network Model

Project Description

A Python module for Gaussian Network Model calculations with integrated plotting functions.

Python is an object oriented scripting language with powerful standard and rich third-party libraries. It is suitable for rapid and flexible code development. If you are not familiar with Python, but know programming, you can learn enough to use this package in a couple of hours by following Python Tutorial.

PyGNM is pure Pyton code depending on widely used numeric and graphics packages. All GNM convenience and plotting functions are documented and illustrated in the tutorial. PyGNM can be used to analyze a single protein structure (see tutorial) and to perform automated analysis of multiple structures (with of course some more Python code).


  • Direct evaluation of thermal fluctuations in proteins using a single parameter harmonic potential I. Bahar, A. R. Atilgan, and B. Erman Folding & Design 2, 173-181, 1997.
  • Gaussian dynamics of folded proteins Haliloglu, T. Bahar, I. & Erman, B. Phys. Rev. Lett. 79, 3090-3093, 1997.
  • Wikipedia article


This Python package is distributed under GNU General Public License.


Biopython Numpy Scipy Matplotlib (Optional, but needed for plotting capability.)



Extract tarball contents and run as follows: tar -xzf ppygnm-0.x.tar.gz cd pygnm-0.x python install You may need root access for the last step.


Use executable to install PyGNM.


This tutorial is also contained in the PyGNM package.

"""This is an example use of PyGNM, and is distributed with PyGNM package.

This example assumes that you have installed Matplotlib.
A ubiquitin structureis used in this example.
(PDB id 2BWF, Lowe et al., 2006 Acta Crystallogr., Sect. D 62:177)

# Import plotting library
>>> import matplotlib.pyplot as pl

# Import GNM module from pygnm package
>>> from pygnm import GNM

# Initialize a GNM object
# Please make sure that the PDB file is in the current working directory
# You may need to download this, or another, PDB file
# Both .pdb and pdb.gz extensions are handled
>>> gnm = GNM('2BWF.pdb.gz')

# Select residues to be included in the model
# Some examples are
#      "*" and "*:*"
#        select all chains and residues
#      "A:x,y-z,w D:k-l G:*"
#        select residues x, y to z (inclusive),
#                     and w in chain A
#        and residues k to l (inclusive) in chain D
#        and all residues in chain G
#      "A B"
#        select all residues in chains A and B
#      "*:5-25,50-100"
#        select same set of residues in all chains
>>> gnm.select_residues('A:1-70')

# Build Kirchhoff matrix
#   cutoff=10., gamma=1.0 are default values, and may be omitted
>>> gnm.set_kirchhoff(cutoff=10., gamma=1.0)

# Calculate GNM modes
#   An optional parameter is n_modes
#   If you want to see only 20 nonzero modes, you can set n_modes=20
#   gnm.calculate_modes(n_modes=20)
>>> gnm.calculate_modes()

# Get first 20 eigenvalues, including the zero eigenvalue
>>> gnm.get_eigenvalues( range(20) )
# Get first eigenvector with a nonzero eigenvalue
>>> gnm.get_eigenvectors(1)
# Get first and second modes (eigenvector^2) with nonzero eigenvalues
>>> gnm.get_modes( [1, 2] )
# Get covariance matrix (pseudo-inverse of Kirchhoff)
>>> gnm.get_covariance()
# Get cross-correlations calclated using first 9 modes (w/ nonzero eigenvalues)
>>> gnm.get_cross_correlations( range(1, 10))

# Note that before each plot command, pl.figure() function is called
# to prevent plotting over the previous figure.
# Plot eigenvector shape
>>> pl.figure()
>>> gnm.plot_eigenvector(1)

# Plot mode shape
>>> pl.figure()
>>> gnm.plot_mode(1)

# Plot bfactors from PDB file
>>> pl.figure()
>>> gnm.plot_bfactors()

# Plot GNM square-fluctuations
>>> pl.figure()
>>> gnm.plot_square_fluctuations()

# Plot GNM square-fluctuations for low frequence nonzero 10 modes
>>> pl.figure()
>>> gnm.plot_square_fluctuations(indices=range(1, 11))

# Plot GNM cross-correlations
>>> pl.figure()
>>> gnm.show_cross_correlations()

# Plot GNM cross-correlations for low frequence nonzero 10 modes
>>> pl.figure()
>>> gnm.show_cross_correlations(indices=range(1, 11))

# Write a PDB file with square fluctuations on beta column
>>> gnm.write_pdb( bfactors=gnm.get_square_fluctuations(indices=range(1, 11)) )
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pygnm-0.1.tar.gz (81.3 kB) Copy SHA256 Checksum SHA256 Source Feb 20, 2010
pygnm-0.1.win32.exe (202.7 kB) Copy SHA256 Checksum SHA256 any Windows Installer Feb 20, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting