The following conventions are for general code cleanliness and readability:
tm = 1e-8.
The exception is function arguments, for example self.classic\_colour(res\_num=None, width=0.3).
< , > , == , <= , => , <> , = !, is , and in .
An example which shows most of these conventions is:
class Internal:
"""The internal relax structural data object.
The structural data object for this class is a container possessing a number of different arrays corresponding to different structural information. These objects are described in the structural container docstring.
"""
def _bonded_atom(self, attached_atom, index, mol):
"""Find the atom named attached_atom directly bonded to the atom located at the index.
@param attached_atom: The name of the attached atom to return.
@type attached_atom: str
@param index: The index of the atom which the attached atom is attached to.
@type index: int
@param mol: The molecule container.
@type mol: MolContainer instance
@return: A tuple of information about the bonded atom.
@rtype: tuple consisting of the atom number (int), atom name (str), element name (str), and atomic position (Numeric array of len 3)
"""
# Init.
bonded_found = False
# No bonded atoms, so determine the connectivities.
if not mol.bonded[index]:
# Determine the molecule type if needed.
if not hasattr(mol, 'type'):
self._mol_type(mol)