script to convert GROMACS tpr to psf/prm

1,904 views
Skip to first unread message

Peter

unread,
Aug 28, 2010, 7:51:54 AM8/28/10
to cp2k
Dear All,
Some time ago I wrote a (python) code to convert GROMACS binary TPR
files into CP2K readable PSF (topology) and PRM (FF parameters) files.
Unfortunately I didn't achieve exact match between energies calculated
by GROMACS and CP2K/FIST. Respective energies calculated by GROMACS
and CP2K/FIST match in case of bonds, angles and sometimes dihedrals.
Nonbonded interactions (Coulomb and VdW, both long range and 1-4) are
different for most of tested systems. Gradients calculated by both
codes for some large system correlate with covariance coefficient 0.4.
At some point I considered this result satisfactory and moved on. For
now I don't have an intention to further improve this conversion tool,
but probably others will find it to be a good starting point for
creating such a conversion tool or probably try it as-is. So I put an
archive with script, auxillary library (modified libgmx wrapper by
Martin Hofling [http://oldwww.gromacs.org/pipermail/gmx-developers/
2009-March/003183.html]) and some sample files here:
http://groups.google.com/group/cp2k/web/gmx2psf.tar.bz2

Best regards,
Peter Mamonov
Lomonosov Moscow State University
Biological faculty
biophysics dept.

P.S. Here is a help message from script, which provides some
additional info:

ABOUT:
This script reads GROMACS .tpr file and produces .psf and .prm files
readable by CP2K[ http://cp2k.berlios.de/] and probably some other MM
software.
This script uses modified version of GROMACS library python wrapper,
written by Martin Hofling [http://oldwww.gromacs.org/pipermail/gmx-
developers/2009-March/003183.html].

NB: This script IS NOT capable of exact conversion between tpr and psf/
prm topology/force field representation. Respective energies
calculated by GROMACS and CP2K/FIST match in case of bonds, angles and
sometimes dihedrals. Nonbonded interactions (Coulomb and VdW, both
long range and 1-4) are different for most of tested systems.
Gradients calculated by both codes for some large system correlate
with covariance coefficient 0.4.

REQUIREMENTS:
* GROMACS dynamic libraries (libgmx*.so)
* Modified version of GromPy wrapper (distributed with this script)

USAGE: tpr2psf.py system.tpr
Will produce system.psf and system.prm


Peter

unread,
Dec 13, 2014, 7:59:01 AM12/13/14
to cp...@googlegroups.com, abhi....@gmail.com
Dear cp2k users,

Since a few people asked me to share the tpr2psf script, here is the link: https://github.com/pmamonov/tpr2psf

Regards,
Peter

Santanu Das

unread,
Jan 7, 2015, 2:49:23 PM1/7/15
to cp...@googlegroups.com
Hi,
 I have tried to create prm and psf file from a gromacs tpr file with tpr2psf.py , from the link https://github.com/pmamonov/tpr2psf
and I encounter the error
FF parameters
    Bonds: 93
    Angles: 38
    Proper dihedrals: 176
    Ryckaert-Belleman dihedrals: 0
    Improper dihedrals: 25
Traceback (most recent call last):
  File "tpr2psf.py", line 400, in <module>
    tpr.print_ff(prm)
  File "tpr2psf.py", line 342, in print_ff
    print >>f, "%.5f 0 %.4f" % (imp.k*j2cal/2, imp.psi)
AttributeError: STUFF instance has no attribute 'psi'


can anyone tell me how to overcome ?
thank you

Peter Mamonov

unread,
Jan 8, 2015, 1:58:19 PM1/8/15
to cp...@googlegroups.com, sant...@iiserb.ac.in
Hi Das,

Here is the fix:
https://github.com/pmamonov/tpr2psf/commit/f402ff4cfc51c91ca29cb4efbb2ea4553826125f

Update your local repository and give it a try.

Regards,
Peter

В Wed, 7 Jan 2015 11:49:23 -0800 (PST)
Santanu Das <sant...@iiserb.ac.in> пишет:

> Hi,
> I have tried to create prm and psf file from a gromacs tpr file with
> *tpr2psf.py* , from the link https://github.com/pmamonov/tpr2psf
> and I encounter the error
>
>
>
>
>
>
>
>
>
>
>
> *FF parameters Bonds: 93 Angles: 38 Proper dihedrals: 176
> Ryckaert-Belleman dihedrals: 0 Improper dihedrals: 25Traceback
> (most recent call last): File "tpr2psf.py", line 400, in <module>
> tpr.print_ff(prm) File "tpr2psf.py", line 342, in print_ff print
> >>f, "%.5f 0 %.4f" % (imp.k*j2cal/2, imp.psi)AttributeError: STUFF
> >>instance has
> no attribute 'psi'*
>
> can anyone tell me how to overcome ?
> thank you
>
> <https://github.com/pmamonov/tpr2psf>
> On Saturday, August 28, 2010 5:21:54 PM UTC+5:30, Peter wrote:
> >
> > Dear All,
> > Some time ago I wrote a (python) code to convert GROMACS binary TPR
> > files into CP2K readable PSF (topology) and PRM (FF parameters)
> > files. Unfortunately I didn't achieve exact match between energies
> > calculated by GROMACS and CP2K/FIST. Respective energies calculated
> > by GROMACS and CP2K/FIST match in case of bonds, angles and
> > sometimes dihedrals. Nonbonded interactions (Coulomb and VdW, both
> > long range and 1-4) are different for most of tested systems.
> > Gradients calculated by both codes for some large system correlate
> > with covariance coefficient 0.4. At some point I considered this
> > result satisfactory and moved on. For now I don't have an intention
> > to further improve this conversion tool, but probably others will
> > find it to be a good starting point for creating such a conversion
> > tool or probably try it as-is. So I put an archive with script,
> > auxillary library (modified libgmx wrapper by Martin Hofling
> > [http://oldwww.gromacs.org/pipermail/gmx-developers/
> > 2009-March/003183.html
> > <http://oldwww.gromacs.org/pipermail/gmx-developers/2009-March/003183.html>])
> > and some sample files here:
> > http://groups.google.com/group/cp2k/web/gmx2psf.tar.bz2
> >
> > Best regards,
> > Peter Mamonov
> > Lomonosov Moscow State University
> > Biological faculty
> > biophysics dept.
> >
> > P.S. Here is a help message from script, which provides some
> > additional info:
> >
> > ABOUT:
> > This script reads GROMACS .tpr file and produces .psf and .prm
> > files readable by CP2K[ http://cp2k.berlios.de/] and probably some
> > other MM software.
> > This script uses modified version of GROMACS library python
> > wrapper, written by Martin Hofling
> > [http://oldwww.gromacs.org/pipermail/gmx-
> > developers/2009-March/003183.html
> > <http://oldwww.gromacs.org/pipermail/gmx-developers/2009-March/003183.html>].
Reply all
Reply to author
Forward
0 new messages