image thumbnail

extract a PDB from Gromacs TPR files

version (4.05 KB) by Evan
Extracts structure data from a Gromacs TPR file and outputs it to PDB format.


Updated 24 May 2013

View License

%% TPR2PDB.m
% Gromacs is useful for simulating all-atom systems, and it initiates these
% simulations with a TPR file. All TPR files contain coordinate data to
% initiate the simulation. Occasionally it is useful to open and check that
% structure. This program extracts it and converts it to PDB format for
% convenient viewing. The information extracted is coordinates, atom type,
% and partial charges. Partial charges are stored in the beta-factor column
% of the output file.
% ----- Requirements -----
% This program uses the Gromacs command 'GMXdump' to create a text
% file. This avoids any problems that may precipitate from Gromacs
% updates and version changes. Be sure this command is in a valid
% path.
% gmxdump
% See above. The command that initiates this file is
% $> gmxdump -s [TPR file] > textForAnalysis.txt
% This program fails if this can't be done properly. Note that this
% is a Unix system command style, and may have issues when run with
% Windows. Use Putty or cygwin wrappers if using Windows. MatLab can
% be initiated from these wrappers.
% TPR file
% This is necessary. These are the files used to prepare Gromacs
% simulations.
% ----- Inputs -----
% TPR file (required)
% intermediate text file (optional, output of GMXdump)
% ----- Examples -----
% TPR2PDB('3IJU.tpr') % outputs coordinates to '3IJU.pdb'

Cite As

Evan (2021). extract a PDB from Gromacs TPR files (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!