Personal tools
You are here: Home FAQs & Help How-tos How to prepare a ligand file for AutoDock 4
Document Actions

How to prepare a ligand file for AutoDock 4

This How-to applies to: AutoDock 4
This How-to is intended for: User

This How-to explains how to use the Python script '' to format a ligand file for AutoDock 4. Input files for this script can be in PDB, PDBQ, PDBQT, SYBYL mol2 or PQR format. Output files from the script are in PDBQT format and include special keywords establishing the torsional flexibility. Optional arguments invoke adding hydrogens, preserving input charges, merging non-polar hydrogens, etc. (NOTE: You must have installed MGLTools).


AutoDock 4 requires the ligand file to be written in PDBQT format. PDBQT format is very similar to PDB format but it includes partial charges ('Q') and AutoDock 4 (AD4) atom types ('T'). There is one line for each atom in the ligand, plus special keywords indicating which atoms, if any, are to be flexible during the AutoDock experiment. Preparing the ligand involves ensuring that its atoms are assigned the correct AutoDock 4 atom types, adding Gasteiger charges if necessary, merging non-polar hydrogens, detecting aromatic carbons if any, and setting up the 'torsion tree'. For most atoms, the AD4 atom type is the same as its element; the exceptions are "OA", "NA", "SA" for hydrogen-bond acceptor O, N and S atoms; "HD" for hydrogen-bond donor H atoms; "N" for non-hydrogen bonding nitrogens; and "A" for carbons in aromatic rings. The AD4 atom types and their parameters can be found in the "AD4_parameters.dat" file, which is included in the source code of the AutoDock 4 distribution, in the "autodocksuite-4.0.0/src/autodock-4.0.0" directory.

The ligand file can be prepared interactively using AutoDockTools (ADT) or with, a Python script which can be found in MGLTools/MGLToolsPckgs/AutoDockTools/Utilities24. Typing just the name of the script at a shell prompt and pressing <Enter> causes the script to print the usage documentation, which gives an overview of the flags it understands and how to use the script.

Usage -l filename

Description of command...
-l ligand_filename

Optional parameters:
[-v] verbose output
[-o pdbqt_filename] (output filename)
[-d] dictionary to write types list and number of active torsions
[-A] type(s) of repairs to make:
bonds_hydrogens, bonds, hydrogens
[-C] do not add charges
[-p] preserve input charges on atom type, eg -p Zn
[-U] cleanup type:
nphs_lps, nphs, lps, ''
[-B] type(s) of bonds to allow to rotate
[-R] index for root
[-F] check for and use largest non-bonded fragment (False)
[-M] interactive (default is automatic)
[-I] string of bonds to inactivate composed of
of zero-based atom indices eg 5_13_2_10
will inactivate atoms[5]-atoms[13] bond
and atoms[2]-atoms[10] bond
(default is '')
[-Z] inactivate all active torsions
(default is leave active)


1. Install MGLTools if you have not already done so. This will install the graphical user interface and the Python shell scripts for ADT (AutoDockTools). See also: How to setup ADT scripts.

2. In your working directory either copy '' from "MGLTools/MGLToolsPckgs/AutoDockTools/Utilities24", or make sure your path includes 'yourpath', the directory where MGLTools is installed locally.

yourpath = local_install/MGLTools/MGLToolsPckgs/AutoDockTools/Utilities24

On Linux, "local_install" is either "/usr/local" or "$HOME", on Mac OS X it is "/Library". For Windows, see 1. above.

3. Run the script at the command prompt with the desired flags and arguments:
    pythonsh [yourpath or .]/ -l ligand.pdb [options]


The input file should contain only one molecule, which will be formatted as the ligand. Ideally, it should already have all hydrogens added (but see option '-A' below).


The output filename default is the input file stem plus .pdbqt. For example, 'ind.pdb' by default is written to 'ind.pdbqt'.


-A <option>
-A 'hydrogens'
adds hydrogens. PyBabel is used for adding all hydrogens, not just polar-hydrogens
-A 'bonds'
if, after having built bonds by-distance, there are any atoms that do not have any bonds, this builds a bond between each of these atoms and the atom nearest to it. This is necessary for building the torsion tree.
-A 'hydrogens_bonds'
adds hydrogens and builds bonds to any non-bonded atoms.

(The default is not to perform any repairs, i.e. to not add hydrogens and not build bonds.)

does not add Gasteiger partial atomic charges. If this option is used, the input ligand should already have partial atomic charges; the best input formats here would be SYBYL mol2 or AutoDock 3 PDBQ, since these store charges.

-p atomtype
preserves the input charge on a specific atom type; this is useful for metals where the charge has already been set, e.g. -p Zn

-U <option>
performs various kinds of clean-up.
-U 'nphs'
merges non-polar hydrogens by adding the charge of each non-polar hydrogen to the carbon to which it is bonded and then removes the non-polar hydrogen from the ligand molecule, thus implementing the 'United-Atom' model.
-U 'lps'
merges lone-pairs by adding the charge of each lone pair to the atom to which it is 'bonded' and then removes the lone-pair.
-U 'nphs_lps'
merges both non-polar hydrogens and lone pairs. (This is the default.)
-U ''
(this is two quote characters, not one double-quote) Does not perform any clean-up

(The default is 'nphs_lps')

-B <option>
defines which types of bonds to allow to rotate
-B 'backbone'
allows peptide-backbone-bonds (i.e. phi and psi) are rotatable. (This is the default).
-B 'amide'
allows amide bonds to be rotatable. (They are non-rotatable by default).
-B 'guanidinium'
allows guanidinium bonds to be rotatable. (They are non-rotatable by default).

(The default is 'backbone')

-R <integer>
defines the 0-based index of the atom that will become the root of the torsion tree.

(The default is to find the root automatically: this will be the atom with the smallest-largest-subtree)

checks for and uses largest non-bonded molecule or fragment in the input. Some files contain more than one molecule. By default, the first found is processed. If this option is used, the largest molecule found is used.

interactive mode
This option processes the molecule according to the input options but does not write the outputfile. For example:
    pythonsh -i -l ind.pdb -M
(The default is automatic mode which exits after writing the output file.)

-I <string>
defines the string of bonds to inactivate, defined using a string of zero-based atom indices separated by underscore characters. For example:
-I '5_13_2_10'
will inactivate the bond between atoms[5] and atoms[13] and the bond between atoms[2] and atoms[10]

(Note this flag is the capital i)

inactivates all active torsions. This results in a rigid ligand molecule.

Known problems

1. This script requires MGTools version 1-4-5. Previous versions of MGLTools/AutoDockTools/ had a bug in the depth-first-order traversal used to write the ligand file which could result in files which would be rejected by autodock4 with this error message:

autodock4: ERROR: All ATOM and HETATM records must be given before any nested BRANCHes; see line ## in PDBQT file "xxx.pdbqt"

2. The default for repairs is not to do repairs. Nonetheless, all hydrogens must be added to the ligand if they have not already been added. The rationale is that the user probably has already added hydrogens. If not, the 'hydrogens' repair option must be used.

3. Formatting the ligand involves building bonds between atoms which are within the van der Waals radii of each other to determine the torsion tree. For this reason, some input atom coordinates cannot be processed without using the -A 'bonds' repair option.
by Ruth Huey last modified 2007-08-27 14:17

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: