File: snapshot.py

package info (click to toggle)
mmtk 2.7.9-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,788 kB
  • ctags: 6,600
  • sloc: python: 18,050; ansic: 12,400; makefile: 129; csh: 3
file content (30 lines) | stat: -rw-r--r-- 903 bytes parent folder | download
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
# "Manual" creation of a trajectory using the snapshot generator.
#

from MMTK import *
from MMTK.Proteins import Protein
from MMTK.Trajectory import Trajectory, SnapshotGenerator, TrajectoryOutput

# Construct system
universe = InfiniteUniverse()
universe.protein = Protein('bala1')

# Transformation to be applied between the steps
transformation = Rotation(Vector(0.,0.,1.), 1.*Units.deg)

# Create trajectory
trajectory = Trajectory(universe, "rotation.nc", "w", "A rotating molecule")

# Create the snapshot generator
snapshot = SnapshotGenerator(universe,
                             actions = [TrajectoryOutput(trajectory,
                                                         ["all"], 0, None, 1)])

# Perform rotations and write the configurations
snapshot()
for i in range(20):
    universe.protein.applyTransformation(transformation)
    snapshot()

# Close trajectory
trajectory.close()