# 7.17. PDBQT structure files in MDAnalysis — `MDAnalysis.coordinates.PDBQT`

MDAnalysis reads coordinates from PDBQT files and additional optional data such as B-factors, partial charge and AutoDock atom types. It is also possible to substitute a PDBQT file for a PSF file in order to define the list of atoms (but no connectivity information will be available in this case).

class MDAnalysis.coordinates.PDBQT.PDBQTReader(filename, convert_units=True, n_atoms=None, **kwargs)

  PDBQTReader that reads a PDBQT-formatted file, no frills.

  Records read:

    - CRYST1 for unitcell A,B,C, alpha,beta,gamm

    - ATOM. HETATM for x,y,z

  Original PDB format documentation with AutoDOCK extensions

  COLUMNS | DATA TYPE | FIELD | DEFINITION
  --- | --- | --- | ---
  1 - 6 | Record name | “CRYST1” |
  7 - 15 | Real(9.3) | a | a (Angstroms).
  16 - 24 | Real(9.3) | b | b (Angstroms).
  25 - 33 | Real(9.3) | c | c (Angstroms).
  34 - 40 | Real(7.2) | alpha | alpha (degrees).
  41 - 47 | Real(7.2) | beta | beta (degrees).
  48 - 54 | Real(7.2) | gamma | gamma (degrees).
  1 - 6 | Record name | “ATOM “ |
  7 - 11 | Integer | serial | Atom serial number.
  13 - 16 | Atom | name | Atom name.
  17 | Character | altLoc | Alternate location indicator. IGNORED
  18 - 21 | Residue name | resName | Residue name.
  22 | Character | chainID | Chain identifier.
  23 - 26 | Integer | resSeq | Residue sequence number.
  27 | AChar | iCode | Code for insertion of residues. IGNORED
  31 - 38 | Real(8.3) | x | Orthogonal coordinates for X in Angstroms.
  39 - 46 | Real(8.3) | y | Orthogonal coordinates for Y in Angstroms.
  47 - 54 | Real(8.3) | z | Orthogonal coordinates for Z in Angstroms.
  55 - 60 | Real(6.2) | occupancy | Occupancy.
  61 - 66 | Real(6.2) | tempFactor | Temperature factor.
  67 - 70 | LString(4) | footnote | Usually blank. IGNORED.
  71 - 76 | Real(6.4) | partialChrg | Gasteiger PEOE partial charge q.
  79 - 80 | LString(2) | atomType | AutoDOCK atom type t.

  We ignore torsion notation and just pull the partial charge and atom type columns:

      COMPND    NSC7810
      REMARK  3 active torsions:
      REMARK  status: ('A' for Active; 'I' for Inactive)
      REMARK    1  A    between atoms: A7_7  and  C22_23
      REMARK    2  A    between atoms: A9_9  and  A11_11
      REMARK    3  A    between atoms: A17_17  and  C21_21
      ROOT
      123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789. (column reference)
      ATOM      1  A1  INH I           1.054   3.021   1.101  0.00  0.00     0.002 A
      ATOM      2  A2  INH I           1.150   1.704   0.764  0.00  0.00     0.012 A
      ATOM      3  A3  INH I          -0.006   0.975   0.431  0.00  0.00    -0.024 A
      ATOM      4  A4  INH I           0.070  -0.385   0.081  0.00  0.00     0.012 A
      ATOM      5  A5  INH I          -1.062  -1.073  -0.238  0.00  0.00     0.002 A
      ATOM      6  A6  INH I          -2.306  -0.456  -0.226  0.00  0.00     0.019 A
      ATOM      7  A7  INH I          -2.426   0.885   0.114  0.00  0.00     0.052 A
      ATOM      8  A8  INH I          -1.265   1.621   0.449  0.00  0.00     0.002 A
      ATOM      9  A9  INH I          -1.339   2.986   0.801  0.00  0.00    -0.013 A
      ATOM     10  A10 INH I          -0.176   3.667   1.128  0.00  0.00     0.013 A
      ENDROOT
      BRANCH   9  11
      ATOM     11  A11 INH I          -2.644   3.682   0.827  0.00  0.00    -0.013 A
      ATOM     12  A16 INH I          -3.007   4.557  -0.220  0.00  0.00     0.002 A
      ATOM     13  A12 INH I          -3.522   3.485   1.882  0.00  0.00     0.013 A
      ATOM     14  A15 INH I          -4.262   5.209  -0.177  0.00  0.00    -0.024 A
      ATOM     15  A17 INH I          -2.144   4.784  -1.319  0.00  0.00     0.052 A
      ATOM     16  A14 INH I          -5.122   4.981   0.910  0.00  0.00     0.012 A
      ATOM     17  A20 INH I          -4.627   6.077  -1.222  0.00  0.00     0.012 A
      ATOM     18  A13 INH I          -4.749   4.135   1.912  0.00  0.00     0.002 A
      ATOM     19  A19 INH I          -3.777   6.285  -2.267  0.00  0.00     0.002 A
      ATOM     20  A18 INH I          -2.543   5.650  -2.328  0.00  0.00     0.019 A
      BRANCH  15  21
      ATOM     21  C21 INH I          -0.834   4.113  -1.388  0.00  0.00     0.210 C
      ATOM     22  O1  INH I          -0.774   2.915  -1.581  0.00  0.00    -0.644 OA
      ATOM     23  O3  INH I           0.298   4.828  -1.237  0.00  0.00    -0.644 OA
      ENDBRANCH  15  21
      ENDBRANCH   9  11
      BRANCH   7  24
      ATOM     24  C22 INH I          -3.749   1.535   0.125  0.00  0.00     0.210 C
      ATOM     25  O2  INH I          -4.019   2.378  -0.708  0.00  0.00    -0.644 OA
      ATOM     26  O4  INH I          -4.659   1.196   1.059  0.00  0.00    -0.644 OA
      ENDBRANCH   7  24
      TORSDOF 3
      123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789. (column reference)

  Changed in version 0.11.0: Frames now 0-based instead of 1-based

  Writer(filename, **kwargs)

    Returns a permissive (simple) PDBQTWriter for filename.

    Parameters:

      filename (str) – filename of the output PDBQT file

    Return type:

      `PDBQTWriter`

  units = {'length': 'Angstrom', 'time': None}

    dict with units of of time and length (and velocity, force, … for formats that support it)

class MDAnalysis.coordinates.PDBQT.PDBQTWriter(filename, **kwargs)

  PDBQT writer that implements a subset of the PDB 3.2 standard and the PDBQT spec.

  Changed in version 2.6.0: Files are now written in wt mode, and keep extensions, allowing for files to be written under compressed formats

  close()

    Close the trajectory file.

  units = {'length': 'Angstrom', 'time': None}

    dict with units of of time and length (and velocity, force, … for formats that support it)

  write(selection, frame=None)

    Write selection at current trajectory frame to file.

    Parameters:

      - selection (AtomGroup) – The selection to be written

      - frame (int (optional)) – optionally move to frame index frame before writing; the default is to write the current trajectory frame

    Note

    The last letter of the `segid` is used as the PDB chainID.

    Changed in version 0.11.0: Frames now 0-based instead of 1-based