I have a .pdb file for a single frame of water in a box. I need to calculate and analyse the electrostatic field for choosing a viable atom in this particular configuration.

The software I am using - g_elpot requires a .tpr file to read the charges and such. How can I generate a .tpr file for my .pdb file ?

  • 1
    $\begingroup$ It might have been obvious for others, but it's not been for me, so maybe there are others. The gromacs manual says: The tpr file extension stands for portable binary run input file. This file contains the starting structure of your simulation, the molecular topology and all the simulation parameters. Because this file is in binary format it cannot be read with a normal editor. manual.gromacs.org/archive/5.0.4/online/tpr.html $\endgroup$ Feb 13, 2022 at 13:24
  • $\begingroup$ Can you give more information about which forcefield you will use and do you also need to add any ions or specify any concentration to the existing system? $\endgroup$
    – Vasista
    Feb 13, 2022 at 14:24
  • $\begingroup$ @Vasista I am using a custom force field which is available only in LAMMPS at present. Just for reference, I am using n2p2 - compphysvienna.github.io/n2p2 $\endgroup$
    – fireball.1
    Feb 13, 2022 at 16:34
  • $\begingroup$ @fireball.1 If you have a n2p2 forcefield file, then you can use my answer to get a tpr file $\endgroup$
    – Vasista
    Feb 13, 2022 at 18:40

1 Answer 1


For generating a tpr file, you need a topology file (.top), a coordinate file (.gro/.pdb) and a input parameter file (.mdp).

Assuming, you are working with amber forcefield (a99ffSBdisp), Here's how I do it.

gmx pdb2gmx -ff a99SBdisp -f yourpdbfile.pdb -o water_1.gro -ignh -p topol.top 
gmx grompp -f water.mdp -c water_1.gro -p topol.top -o water.tpr -maxwarn 2

Below I have pasted the water.mdp file, which can also be found here.

; ions.mdp - used as input into grompp to generate ions.tpr
; Parameters describing what to do, when to stop and what to save
integrator  = steep         ; Algorithm (steep = steepest descent minimization)
emtol       = 1000.0        ; Stop minimization when the maximum force < 1000.0 kJ/mol/nm
emstep      = 0.01          ; Minimization step size
nsteps      = 50000         ; Maximum number of (minimization) steps to perform

; Parameters describing how to find the neighbors of each atom and how to calculate the interactions
nstlist         = 1         ; Frequency to update the neighbor list and long range forces
cutoff-scheme   = Verlet    ; Buffered neighbor searching 
ns_type         = grid      ; Method to determine neighbor list (simple, grid)
coulombtype     = cutoff    ; Treatment of long range electrostatic interactions
rcoulomb        = 1.0       ; Short-range electrostatic cut-off
rvdw            = 1.0       ; Short-range Van der Waals cut-off
pbc             = xyz       ; Periodic Boundary Conditions in all 3 dimensions

a99SBdisp is the forcefield file (.ff), Here I specified my forcefield exculsively, if not there will be a list of options given to you when you remove -ff a99SBdisp and run the command. Choose from the list

For more information, follow this.

  • 1
    $\begingroup$ +10. Great work answering this so quickly, it became a Hot Network Question! I made some minor edits. $\endgroup$ Feb 13, 2022 at 22:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .