Python Interface

From ESPResSo
Jump to: navigation, search

This page discusses specific parts of ESPResSo, and how the Python interface for it could look like. The subsections could roughly go along the chapters of the User's Guide.

In general, we keep to the Python Conventions and the Python Guidelines.

Setting up the System

Global Variables (setmd)

  • We want to get rid of any global variable that is possible and put them into a corresponding class.
  • As long as specific functionality/variables are global in the C-code, the Python interface uses the Highlander Pattern that throws an exception when a class is instantiated twice.
  • Often we use properties to model variables.

Example Code

import espressomd
import numpy
system = espressomd.System()
system.time_step = 0.01      = 0.4
system.box_l = [10,10,10]
    epsilon=1.0, sigma=1.0,
    cutoff=1.12, shift="auto")
for i in range(100):
  • There can only be one System object.