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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
# MMTK initialization
#
# Written by Konrad Hinsen
#
"""
MMTK is the base module of the Molecular Modelling Toolkit.
It contains the most common objects and all submodules. As a convenience
to the user, it also imports some commonly used objects from other
libraries:
* ``Vector`` from ``Scientific.Geometry``
* ``Translation`` and ``Rotation`` from ``Scientific.Geometry.Transformation``
* ``copy`` and ``deepcopy`` from ``copy``
* ``stdin``, ``stdout``, and ``stderr`` from ``sys``
"""
__docformat__ = 'restructuredtext'
#
# Package information
#
from __pkginfo__ import __version__
#
# Add shared library path to sys.path
#
import os, sys
sys.path.append(os.path.join(os.path.split(__file__)[0], sys.platform))
del os
del sys
#
# General library modules, for convenience
#
from Scientific.Geometry import Vector
from Scientific.Geometry.Transformation import Translation, Rotation
from copy import copy, deepcopy
from sys import stdin, stdout, stderr
#
# MMTK core modules
#
from ThreadManager import activeThreads, waitForThreads
from Universe import InfiniteUniverse, OrthorhombicPeriodicUniverse, \
CubicPeriodicUniverse, ParallelepipedicPeriodicUniverse
from ParticleProperties import ParticleScalar, ParticleVector, \
ParticleTensor, SymmetricPairTensor, \
Configuration
from ChemicalObjects import Atom, Molecule, Complex, AtomCluster
from Collections import Collection, PartitionedCollection, \
PartitionedAtomCollection
from Utility import save, load
import Units
# Pretend that certain object are defined here for documentation purposes
import sys
if sys.modules.has_key('pythondoc'):
InfiniteUniverse.__module__ = 'MMTK'
OrthorhombicPeriodicUniverse.__module__ = 'MMTK'
CubicPeriodicUniverse.__module__ = 'MMTK'
ParticleScalar.__module__ = 'MMTK'
ParticleVector.__module__ = 'MMTK'
ParticleTensor.__module__ = 'MMTK'
SymmetricPairTensor.__module__ = 'MMTK'
Configuration.__module__ = 'MMTK'
Atom.__module__ = 'MMTK'
Molecule.__module__ = 'MMTK'
Complex.__module__ = 'MMTK'
AtomCluster.__module__ = 'MMTK'
Collection.__module__ = 'MMTK'
PartitionedCollection.__module__ = 'MMTK'
PartitionedAtomCollection.__module__ = 'MMTK'
Units.__module__ = 'MMTK'
save.func_globals['__name__'] = 'MMTK'
load.func_globals['__name__'] = 'MMTK'
del sys
save.func_globals['virtual_module'] = 'MMTK'
load.func_globals['virtual_module'] = 'MMTK'
## import string
## load.func_globals['__file__'] = string.replace(load.func_globals['__file__'],
## 'Utility', '__init__')
## save.func_globals['__file__'] = string.replace(load.func_globals['__file__'],
## 'Utility', '__init__')
## del string
# Execute user-defined initialization code
import os, sys
filename = os.path.expanduser('~/.mmtk/init.py')
if os.path.exists(filename):
definitions = {}
execfile(filename, globals(), definitions)
if definitions.has_key('export'):
mod = sys.modules['MMTK']
for name, value in definitions['export'].items():
setattr(mod, name, value)
del filename
del os
del sys
|