Konrad Hinsen
Mon, 2 Nov 1998 17:14:23 +0100

> examples provided with the MMTK distribution.  One thing that I would
> like to do is to place the atoms of a molecule on a lattice and view
> them.

I suppose you want to place whole molecules at each lattice point,
right? There are not so many molecules whose atomic structure is
a lattice!

Here's an example which will become part of the next MMTK distribution:

# Example: water molecules on a lattice
# This example creates a system of water molecules whose centers
# of mass are positioned simple cubic lattice consisting of
# 3x4x5 cells, i.e. there are 60 water molecules in total.
# The molecules are put into a suitably sized periodic universe.

from mmtk import *

# Define parameters of the lattice
edge_length = 0.5*Units.nm
lattice_size = (3, 4, 5)

# Construct the universe
world = OrthorhombicPeriodicUniverse((edge_length*lattice_size[0],

# Add the water molecules
for point in SCLattice(edge_length, lattice_size):
    world.addObject(Molecule('water', position = point))

# Visualization

Konrad Hinsen                            | E-Mail:
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-
Rue Charles Sadron                       | Fax:  +33-
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais