Vector fields for analysis and visualization of collective motionsΒΆ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Example: Vector field analysis of the slowest normal mode of insulin.
#
# This example shows the use of vector fields in the analysis and
# visualization of collective motions. For a more elaborate application,
# see
#       A. Thomas, K. Hinsen, M.J. Field, D. Perahia
#       Tertiary and quaternary confrmational changes in aspartate
#       transcarbamylase: a normal mode study.
#       Proteins, 34(1), 96-112 (1999)
#
from MMTK import *
from MMTK.Proteins import Protein
from MMTK.ForceFields import DeformationForceField
from MMTK.NormalModes import NormalModes
from MMTK.Field import AtomicVectorField
from Scientific.Visualization import VRML2 as VRML

# Construct system
universe = InfiniteUniverse(DeformationForceField())
universe.protein = Protein('insulin.pdb', model='calpha')

# Calculate normal modes
modes = NormalModes(universe)

# Create the vector field corresponding to the first non-zero mode
field = AtomicVectorField(universe, 0.5, modes[6])

# Calculate the curl of the vector field. The curl indicated the
# local rotational motion; the direction of the curl vector is
# the rotation axis, and its length is proportional to the amount
# of the rotation.
curl = field.curl()

# Create graphics objects for the protein and the vector fields
graphics = universe.graphicsObjects(model='backbone', graphics_module=VRML) + \
           field.graphicsObjects(color='yellow',
                                 scale=80., range=(0., 0.01),
                                 graphics_module=VRML) + \
           curl.graphicsObjects(color='red',
                                 scale=80., range=(0., 0.01),
                                 graphics_module=VRML)

# Show graphics in a VRML browser
VRML.Scene(graphics).view()

This Page