# Extending PDB2PQR¶

There are several ways to extend PDB2PQR to implement new functionality and new force fields.

## Custom charge and radius parameters¶

If you are just adding the parameters of a few residues and atoms to an existing forcefield (e.g., AMBER), you can open the forcefield data file distributed with PDB2PQR (dat/AMBER.DAT) directly and add your parameters. After the parameter addition, save the force field data file with your changes. You should also update the corresponding .names file (dat/AMBER.names) if your added residue or atom naming scheme is different from the PDB2PQR canonical naming scheme. See PDB2PQR NAMES files for more information about NAMES files.

### Adding an entirely new forcefield¶

The following steps outline how to add a new force field to PDB2PQR.

You will need to generate a forcefield data file (e.g., myff.DAT) and, if your atom naming scheme of the forcefield is different from the PDB2PQR canonical naming scheme, you will also need to provide a names files (myFF.names). It is recommended to build your own forcefield data and names files based on existing PDB2PQR .DAT and .names examples provided with PDB2PQR in the dat directory. See PDB2PQR NAMES files for more information about NAMES files. After finishing your forcefield data file and names file, these can be used with either the command line or the web server versions of PDB2PQR.

Todo

Provide documentation of the PDB2PQR DAT and NAMES formats.

PDB2PQR provides an extensions directory that allows you to add your own code to the PDB2PQR workflow. All functions in the extensions directory are automatically loaded into PDB2PQR as command line options using the function’s name, and are called after all other steps (optimization, atom addition, parameter assignment) have been completed. As a result any available functions are particularly useful for post-processing, or for analysis without any changes to the input structure by using the --clean flag.

One of the advantages of using PDB2PQR in this fashion is the ability to use built-in PDB2PQR functions. While a full and more detailed API can be found in the PDB2PQR pydoc documentation, some useful functions are listed below, organized by PDB2PQR module:

class protein.Protein

Protein objects

printAtoms(atomlist, flag)

Print a list of atoms

getResidues()

Return a list of residues

numResidues()

Return the number of residues

numAtoms()

Return the number of atoms

getAtoms()

Return a list of atom objects

getChains()

Return a list of chains

class structures.Chain

Biomolecule chain objects

getResidues()

Return a list of residues in the chain

numResidues()

Return the number of residues in the chain

numAtoms()

Return the number of atoms in the chain

getAtoms()

Return a list of atom objects in the chain

class structures.Residue

Biomolecule residue object (e.g., amino acid)

numAtoms()

Return the number of atoms in the residue

addAtom(atom)

Add the atom object to the residue

removeAtom(name)

Remove a specific atom from the residue

renameAtom(old, new)

Rename atom “old” with “new”

getAtom(name)

Return a specific atom from the residue

hasAtom(name)

Determine if the residue has the atom “name”

class structures.Atom

The atom of a residue

getCoords()

Return the x/y/z coordinates of the atom

isHydrogen()

Determine if the atom is a hydrogen or not

isBackbone()

Determine whether the atom is from the backbone

utilities.getAngle(c1, c2, c3)

Get the angle between the three coordinate sets

utilities.getDihedral(c1, c2, c3, c4)

Get the dihedral angle from the four coordinates

utilities.distance(c1, c2)

Return the distance between the two coordinates

utilities.add(c1, c2)

Return c1 + c2

utilities.subtract(c1, c2)

Return c1 - c2

utilities.cross(c1, c2)

Return the cross product of c1 and c2

utilities.dot(c1, c2)

Return the dot product of c1 and c2

utilities.normalize(c1)

Normalize the c1 coordinates (to unit length)

Todo

Incorporate PDB2PQR Python documentation into Sphinx rather than entering it here manually.