Previous topic

4.2. Common functions for topology building — MDAnalysis.topology.core

Next topic

4.4. PSF topology parser

This Page

4.3. MDAnalysis topology tables

The module contains static lookup tables for atom typing etc. The tables are dictionaries that are indexed by the element.

MDAnalysis.topology.tables.atomelements = {'BC': 'C', 'K+': 'K', 'AC': 'C', 'LIT': 'LI', 'CA2+': 'CA', 'FE': 'FE', 'CAL': 'CA', 'MG2+': 'MG', 'CL-': 'CL', 'CLAL': 'CL', 'SOD': 'NA', 'CS+': 'CS', 'NA': 'NA', 'POT': 'K', 'LI': 'LI', 'CES': 'CS', 'RB': 'RB', 'C0': 'CA', 'ZN': 'ZN', 'CL': 'CL', 'CLA': 'CL', 'CS': 'CS', 'CU': 'CU', 'MG': 'MG', 'QR': 'RB', 'NA+': 'NA', 'LI+': 'LI', 'QC': 'CE', 'QK': 'K', 'QL': 'LI', 'QN': 'NA'}

Dictionary with hard-coded special atom names, used for guessing atom types with MDAnalysis.topology.core.guess_atom_type().

MDAnalysis.topology.tables.masses = {'ZN': 65.37, 'FE': 55.847, 'BR': 79.904, 'HE': 4.0026, 'NA': 22.98977, 'CL': 35.45, 'NE': 20.1797, 'RB': 85.4678, 'CA': 40.08, 'C': 12.011, 'F': 18.998, 'I': 126.9045, 'H': 1.008, 'K': 39.102, 'O': 15.999, 'N': 14.007, 'P': 30.974, 'S': 32.06, 'CS': 132.9, 'CU': 63.546, 'MG': 24.305, 'Ce': 140.116}

Dictionary table with atomic masses in u, indexed by the element from atomelements.

The original raw data are stored as multi-line strings that are translated into dictionaries with kv2dict(). In the future, these tables might be moved into external data files; see kv2dict() for explanation of the file format.

MDAnalysis.topology.tables.kv2dict(s, convertor=<type 'str'>)

Primitive ad-hoc parser of a key-value record list.

  • The string s should contain each key-value pair on a separate line (separated by newline). The first white space after the key separates key and value.
  • Empty lines are allowed.
  • Comment lines (starting with #) are allowed.
  • Leading whitespace is ignored.

The convertor is a function that converts its single argument to a valid Python type. The default is str() but other possibilities are int() (for integers) or float() for floating point numbers.

The raw tables are stored in the strings

MDAnalysis.topology.tables.TABLE_ATOMELEMENTS = '\n# translation of atomnames to types/element\n# based on CHARMM and AMBER usage with a little bit of GROMOS\n# NOTE: CL might be ambiguous and is interpreted as chloride!\n\n# --------- ------------------\n# atomname element\n# --------- ------------------\n\n# Calcium\nCAL CA\nC0 CA\nCA2+ CA\n\n# Cesium\nCES CS\n\n# Chloride\nCLA CL\nCLAL CL\nCL CL\nCL- CL\n\n# Iron\nFE FE\n\n# Lithium\nLIT LI\nLI LI\nLI+ LI\nQL LI\n\n# Magnesium\nMG MG\nMG2+ MG\n\n# Noble gases\n## XXX collides with NE, HE in Arg XXX\n## XXX so we remove the noble gases XXX\n##HE HE\n##NE NE\n\n# Potassium\nPOT K\nK+ K\nQK K\n\n# Sodium\nSOD NA\nNA NA\nNA+ NA\nQN NA\n\n# Zink\nZN ZN\n\n# Copper\nCU CU\n\n# Cesium\nCS CS\nCS+ CS\nCES CS\n\n# Cerium??\nQC CE\n\n# Rubidium\nRB RB\nQR RB\n\n# special carbons (Amber?)\nBC C\nAC C\n\n# other types are guessed from the name; see\n# topology.core.guess_atom_elements()\n'

Table with hard-coded special atom names, used for guessing atom types with MDAnalysis.topology.core.guess_atom_element().

MDAnalysis.topology.tables.TABLE_MASSES = '\n# masses for elements in atomic units (u)\n# (taken from CHARMM and Gromacs atommass.dat)\n\n#------------ -----------\n# atomtype mass\n#------------ -----------\nH 1.00800\nC 12.01100\nN 14.00700\nO 15.99900\nS 32.06000\nP 30.97400\nHE 4.00260\nNE 20.17970\nFE 55.84700\nNA 22.98977\nK 39.10200\nRB 85.46780\nCS 132.90000\nMG 24.30500\nCA 40.08000\nCU 63.54600\nZN 65.37000\nCe 140.11600\nF 18.99800\nCL 35.45000\nBR 79.90400\nI 126.90450\n'

Plain-text table with atomic masses in u.