I'm trying to dock a ligand to several hundred PDB files (receptors). I thus need to prepare the those PDB files like removing water and adding hydrogen.

I can do that manually using Autodock or Pymol. But it's too troublesome. Is there a way to do it programmatically with Python or R or any command line procedure?

  • 1
    $\begingroup$ If you did it manually in PyMOL, it can also be scripted. But note that adding hydrogens is not that simple. There is more than one way of deciding which hydrogens are present (you may consider pH) and what are their coordinates. So I'd first think what method of adding hydrogens to use. $\endgroup$
    – marcin
    Commented Jun 17, 2021 at 9:52
  • $\begingroup$ @marcin In pymol I use h_add command. That is not enough? How would you go about scripting it? $\endgroup$ Commented Jun 17, 2021 at 10:24
  • $\begingroup$ chemistry.stackexchange.com/questions/129157/… here they use openbabel, not scripting but in batch $\endgroup$
    – pippo1980
    Commented Jun 17, 2021 at 13:17
  • 1
    $\begingroup$ I can't tell if that's enough for what you're doing. h_add in Python script would become pymol.cmd.h_add('all') $\endgroup$
    – marcin
    Commented Jun 17, 2021 at 13:21
  • 1
    $\begingroup$ Michael Word's reduce is an established method to do that $\endgroup$ Commented Jun 22, 2021 at 3:06

1 Answer 1


I believe PDB2PQR CLI will do the work wonderfully. Don't let the name trick you: PQR files are organized like PDB ones. Under the hood it runs propka, which is state-of-the-art for predicting a protein residues protonation state. The best part is that you can use PDB2PQR web server and they will give you the corresponding CLI arguments for each option you choose. It also automatically removes water (and other non-protein molecules).

You can also try looking into tutorials on how to setup proteins for dynamics on GROMACS, AMBER or OpenMM and stumble on their own tools for protonating stuff (respectively pdb2gmx (CLI), protonate (CLI), and modeller.addHydrogen (python API)), but as far as I know propka computes residues pKi in a knowledge-based manner and out-performs physics-based (if not just totally automatic, without guess) approaches like these.

For some context: acidic or basic amino-acids in proteins may have different pKi depending on their local environment (i.e. if they are in contact with solvent or not, and residues surrounding them), which is why "adding hydrogen to proteins crystallographic structures at a constant pH" is not as easy as it sounds.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.