# Extending PDB2PQR¶

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.

## 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). The format of the names file is described in PDB2PQR NAMES files. 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. 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.

## Helping with development¶

PDB2PQR welcomes new contributions; the software API is documented in API Reference. To contribute code, submit a pull request against the master branch in the PDB2PQR repository. Please be sure to run PDB2PQR tests, as described in Testing, before submitting new code.

### Helping with to-do items¶

A list of “to-do” items for the code is available in GitHub Issues. A loosely maintained list auto-generated from the documentation is also presented below.

Todo

need to see whether super().__init__() should be called

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/aa.py:docstring of pdb2pqr.aa.Amino.__init__, line 3.)

Todo

Determine why this is different than superclass method.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/aa.py:docstring of pdb2pqr.aa.Amino.create_atom, line 3.)

Todo

why is the force field name “WAT” for this?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/aa.py:docstring of pdb2pqr.aa.LIG.__init__, line 3.)

Todo

Why is water in the amino acid module?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/aa.py:docstring of pdb2pqr.aa.WAT, line 3.)

Todo

There is a huge amount of duplicated code in this module.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/aa.py:docstring of pdb2pqr.aa.WAT.create_atom, line 5.)

Todo

This module should be broken into separate files.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/biomolecule.py:docstring of pdb2pqr.biomolecule, line 3.)

Todo

Since the misslist is used to identify incorrect charge assignments, this routine does not list the 3 and 5 termini of nucleic acid chains as having non-integer charge even though they are (correctly) non-integer.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/biomolecule.py:docstring of pdb2pqr.biomolecule.Biomolecule.charge, line 3.)

Todo

Figure out if this is redundant with Biomolecule.num_bio_atoms()

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/biomolecule.py:docstring of pdb2pqr.biomolecule.Biomolecule.num_heavy, line 3.)

Todo

This function needs to be cleaned and simplified

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/biomolecule.py:docstring of pdb2pqr.biomolecule.Biomolecule.set_termini, line 6.)

Todo

Why are we setting residue types to numeric values (see code)?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/biomolecule.py:docstring of pdb2pqr.biomolecule.Biomolecule.update_residue_types, line 3.)

Todo

Manage several blocks of data.

Todo

This class needs to be susbtantially refactored in to multiple classes with clear responsibilities.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/debump.py:docstring of pdb2pqr.debump.Debump, line 3.)

Todo

Why are files being loaded so deep in this function?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.__init__, line 3.)

Todo

Should this be a staticmethod or a classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_amber_params, line 3.)

Todo

Figure out why residue.type has int values

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_amber_params, line 5.)

Todo

Should this be a staticmethod or a classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_charmm_params, line 3.)

Todo

Figure out why residue.type has int values

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_charmm_params, line 5.)

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_params, line 7.)

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_params1, line 7.)

Todo

Should this be a staticmethod or a classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.Forcefield.get_parse_params, line 3.)

Todo

Should this be a staticmethod instead of classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.ForcefieldHandler.find_matching_names, line 3.)

Todo

Should this be a staticmethod instead of classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/forcefield.py:docstring of pdb2pqr.forcefield.ForcefieldHandler.update_map, line 4.)

Todo

This module has too many lines and should be simplified.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens, line 5.)

Todo

This class really needs to be refactored.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens.HydrogenRoutines, line 3.)

Todo

Remove hard-coded progress threshold and increment values.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens.HydrogenRoutines.optimize_hydrogens, line 6.)

Todo

This function needs to be simplified.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens.HydrogenRoutines.optimize_hydrogens, line 10.)

Todo

The type of the res appears to be incorrect.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens.HydrogenRoutines.parse_hydrogen, line 6.)

Todo

This function is too long and needs to be simplified.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/__init__.py:docstring of pdb2pqr.hydrogens.HydrogenRoutines.parse_hydrogen, line 9.)

Todo

Lots of code in this function could be accelerated with numpy.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.get_pair_energy, line 3.)

Todo

Lots of hard-coded parameters in this function that need to be abstracted out.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.get_pair_energy, line 7.)

Todo

Should this be a staticmethod rather than a classmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.get_position_with_three_bonds, line 3.)

Todo

Remove hard-coded values in function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.get_position_with_three_bonds, line 6.)

Todo

Remove some hard-coded values in this function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.get_positions_with_two_bonds, line 3.)

Todo

Remove hard-coded hydrogen bond distance and angles.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.is_hbond, line 3.)

Todo

Does this need to be a classmethod or could it be a staticmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.make_atom_with_one_bond_h, line 3.)

Todo

Does this need to be a classmethod or could it be a staticmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.make_atom_with_one_bond_lp, line 3.)

Todo

Does this need to be a classmethod or could it be a staticmethod?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.make_water_with_one_bond, line 5.)

Todo

Remove some hard-coded values in this function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.try_single_alcoholic_h, line 3.)

Todo

Remove some hard-coded values in this function and figure out where others (e.g., “72”) come from.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/optimize.py:docstring of pdb2pqr.hydrogens.optimize.Optimize.try_single_alcoholic_lp, line 3.)

Todo

Replace hard-coded values in the function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/structures.py:docstring of pdb2pqr.hydrogens.structures.Alcoholic.finalize, line 3.)

Todo

Rename this and related methods to conform with PEP8

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/structures.py:docstring of pdb2pqr.hydrogens.structures.HydrogenHandler.endElement, line 3.)

Todo

Rename this and related methods to conform with PEP8

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/structures.py:docstring of pdb2pqr.hydrogens.structures.HydrogenHandler.startElement, line 3.)

Todo

This looks like a bug: donorh ends up being the last item in donor.bonds. This may be fixed by setting a best_donorh to go with bestdist and using best_donorh in the function below

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/hydrogens/structures.py:docstring of pdb2pqr.hydrogens.structures.Water.try_acceptor, line 3.)

Todo

Remove hard-coded parameters.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/inputgen.py:docstring of pdb2pqr.inputgen.Elec.__init__, line 3.)

Todo

is this function still useful?

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/inputgen.py:docstring of pdb2pqr.inputgen.Input.dump_pickle, line 3.)

Todo

This should be a context manager (to close the open file).

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/io.py:docstring of pdb2pqr.io.get_pdb_file, line 7.)

Todo

Remove hard-coded parameters.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/io.py:docstring of pdb2pqr.io.get_pdb_file, line 8.)

Todo

This function should be moved into the APBS code base.

Todo

This function should be moved into the APBS code base.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/io.py:docstring of pdb2pqr.io.write_cube, line 6.)

Todo

Some of the definitions in this module belong in a configuration file other than here.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/ligand/__init__.py:docstring of pdb2pqr.ligand, line 3.)

Todo

It seems inconsistent that this function pulls radii from a dictionary and the biomolecule routines use force field files.

Todo

Need separate argparse groups for PDB2PKA and PROPKA. These exist but need real options.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.build_main_parser, line 3.)

Todo

this module is already too long but this function fits better here. Other possible place would be utilities.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.drop_water, line 3.)

Todo

This function should be moved into the APBS code base.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.dx_to_cube, line 8.)

Todo

These routines should be generalized to biomolecules; none of them are specific to biomolecules.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.non_trivial, line 3.)

Todo

Move this to another module (io)

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.print_pdb, line 3.)

Todo

Move this to another module (io)

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.print_pqr, line 3.)

Todo

I wish this could be done with argparse.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/main.py:docstring of pdb2pqr.main.transform_arguments, line 3.)

Todo

This code is duplicated in several places.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/na.py:docstring of pdb2pqr.na.Nucleic.create_atom, line 5.)

Todo

If multiple modifications are present, only the last one in the file is preserved.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/pdb.py:docstring of pdb2pqr.pdb.REVDAT.__init__, line 3.)

Todo

This code could be combined with inputgen.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize, line 3.)

Todo

This code should be moved to the APBS code base.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize, line 5.)

Todo

This is messed up. Why are we parsing the PQR manually here when we already have other routines to do that? This function should be replaced by a call to existing routines.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize.Psize.parse_lines, line 3.)

Todo

remove hard-coded values from this function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize.Psize.set_fine_grid_points, line 3.)

Todo

Replace hard-coded values in this function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize.Psize.set_length, line 3.)

Todo

Remove hard-coded values from this function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/psize.py:docstring of pdb2pqr.psize.Psize.set_smallest, line 9.)

Todo

There are many unnecessary parameters in this module due to FORTRAN/C assumptions about how the code should behave.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/quatfit.py:docstring of pdb2pqr.quatfit, line 13.)

Todo

Remove hard-coded parameters of function.

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/quatfit.py:docstring of pdb2pqr.quatfit.qfit, line 4.)

Todo

Should this class have a member variable for dihedrals? Pylint complains!

(The original entry is located in /home/docs/checkouts/readthedocs.org/user_builds/pdb2pqr/checkouts/v3.3.0/pdb2pqr/residue.py:docstring of pdb2pqr.residue.Residue, line 3.)