# Module MMTK.Geometry

This module defines several elementary geometrical objects, which can be useful in the construction and analysis of molecular systems. There are essentially two kinds of geometrical objects: shape objects (spheres, planes, etc.), from which intersections can be calculated, and lattice objects, which define a regular arrangements of points.

## Class GeometricalObject3D: 3D shape object

This is an Glossary:abstract-base-class. To create 3D objects, use one of its subclasses.

Methods:

- intersectWith(other)

  Return a 3D object that represents the intersection with other (another 3D object).

## Class Box: Box

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Box(corner1, corner2)

corner1, corner2

  diagonally opposite corner points

## Class Sphere: Sphere

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Sphere(center, radius)

center

  the center of the sphere (a vector)

radius

  the radius of the sphere (a number)

## Class Cylinder: Cylinder

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Cylinder(center1, center2, radius)

center1

  the center of the bottom circle (a vector)

center2

  the center of the top circle (a vector)

radius

  the radius (a number)

## Class Plane: 2D plane in 3D space

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Plane(point, normal) or Plane(point1, point2, point3)

point

  any point in the plane

normal

  the normal vector of the plane

point1, point2, point3

  three points in the plane that are not collinear.

## Class Cone: Cone

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Cone(center, axis, angle)

center

  the center (tip) of the cone (a vector)

axis

  the direction of the axis of rotational symmetry (a vector)

angle

  the angle between any straight line on the cone surface and the axis of symmetry (a number)

## Class Circle: 2D circle in 3D space

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Circle(center, normal, radius)

center

  the center of the circle (a vector)

normal

  the normal vector of the plane of the sphere (vector)

radius

  the radius of the circle (a number)

## Class Line: Line

A subclass of MMTK.Geometry.GeometricalObject3D.

Constructor: Line(point, direction)

point

  any point on the line (a vector)

direction

  the direction of the line (a vector)

Methods:

- distanceFrom(point)

  Returns the smallest distance of point from the line.

- projectionOf(point)

  Returns the orthogonal projection of point onto the line.

## Class Lattice: General lattice

Lattices are special sequence objects that contain vectors (points on the lattice) or objects that are constructed as functions of these vectors. Lattice objects behave like lists, i.e. they permit indexing, length inquiry, and iteration by 'for'-loops. See also the example Miscellaneous/lattice.py.

This is an Glossary:abstract-base-class. To create lattice objects, use one of its subclasses.

## Class RhombicLattice: Rhombic lattice

A subclass of MMTK.Geometry.Lattice.

Constructor: RhombicLattice(elementary_cell, lattice_vectors, cells, function=`None`)

elementary_cell

  a list of points (vectors) in the elementary cell

lattice_vectors

  a list of lattice vectors. Each lattice vector defines a lattice dimension (only values from one to three make sense) and indicates the displacement along this dimension from one cell to the next.

cells

  a list of integers, whose length must equal the number of dimensions. Each entry specifies how often a cell is repeated along this dimension.

function

  a function that is called for every lattice point with the vector describing the point as argument. The return value of this function is stored in the lattice object. If the function is `None`, the vector is directly stored in the lattice object.

The number of objects in the lattice is equal to the product of the values in cells times the number of points in elementary_cell.

## Class BravaisLattice: Bravais lattice

A subclass of MMTK.Geometry.Lattice.

A Bravais lattice is a special case of a general rhombic lattice in which the elementary cell contains only one point.

Constructor: BravaisLattice(lattice_vectors, cells, function=`None`)

lattice_vectors

  a list of lattice vectors. Each lattice vector defines a lattice dimension (only values from one to three make sense) and indicates the displacement along this dimension from one cell to the next.

cells

  a list of integers, whose length must equal the number of dimensions. Each entry specifies how often a cell is repeated along this dimension.

function

  a function that is called for every lattice point with the vector describing the point as argument. The return value of this function is stored in the lattice object. If the function is `None`, the vector is directly stored in the lattice object.

The number of objects in the lattice is equal to the product of the values in cells.

## Class SCLattice: Simple Cubic lattice

A subclass of MMTK.Geometry.Lattice.

A Simple Cubic lattice is a special case of a Bravais lattice in which the elementary cell is a cube.

Constructor: SCLattice(cell_size, cells, function=`None`)

cell_size

  the edge length of the elementary cell

cells

  a list of integers, whose length must equal the number of dimensions. Each entry specifies how often a cell is repeated along this dimension.

function

  a function that is called for every lattice point with the vector describing the point as argument. The return value of this function is stored in the lattice object. If the function is `None`, the vector is directly stored in the lattice object.

The number of objects in the lattice is equal to the product of the values in cells.

## Class BCCLattice: Body-Centered Cubic lattice

A subclass of MMTK.Geometry.Lattice.

A Body-Centered Cubic lattice has two points per elementary cell.

Constructor: BCCLattice(cell_size, cells, function=`None`)

cell_size

  the edge length of the elementary cell

cells

  a list of integers, whose length must equal the number of dimensions. Each entry specifies how often a cell is repeated along this dimension.

function

  a function that is called for every lattice point with the vector describing the point as argument. The return value of this function is stored in the lattice object. If the function is `None`, the vector is directly stored in the lattice object.

The number of objects in the lattice is equal to the product of the values in cells.

## Class FCCLattice: Face-Centered Cubic lattice

A subclass of MMTK.Geometry.Lattice.

A Face-Centered Cubic lattice has four points per elementary cell.

Constructor: FCCLattice(cell_size, cells, function=`None`)

cell_size

  the edge length of the elementary cell

cells

  a list of integers, whose length must equal the number of dimensions. Each entry specifies how often a cell is repeated along this dimension.

function

  a function that is called for every lattice point with the vector describing the point as argument. The return value of this function is stored in the lattice object. If the function is `None`, the vector is directly stored in the lattice object.

The number of objects in the lattice is equal to the product of the values in cells.