[gmx-developers] issues in calling python with subprocess in git master code

Shirts, Michael R. (mrs5pt) mrs5pt at eservices.virginia.edu
Fri Nov 28 05:59:47 CET 2014


Hi, all-

I'm trying to write a python script using subprocess to call grompp. It
works perfectly fine when called from the command line or when debugging;
this only occurs with python (Anaconda, Python 2.7).

For example, my code looks like:

subprocess.call(['gmx_d','grompp','-f',newmdp,'-c',gro,'-p',top,'-o',tpr,'-
maxwarn','5'])



It produces to stdout:

GROMACS: gmx grompp, VERSION 5.1-dev-20141126-f367cf6 (double precision)
Executable: grompp
Library dir: 
/Users/mrshirts/work/gromacs_allv/git/gromacs_official/install_gromacs_noit
er/share/gromacs/top
Command line:
grompp -f r0000.noiter.mdp -c trpo.gro -p trpo.top -o r0000.noiter.tpr
-maxwarn 5


However, the errors that it then gives and mdout.mdp indicate that the mdp
is not actually being read in, and the default values are being used
instead. It even reports that the errors are in the mdp file I fed in,
even though the mdp does not contain those commands.

All files work perfectly well when called from the command line.

The problems also occur the same way when calling as:

subprocess.call(['grompp','-f',newmdp,'-c',gro,'-p',top,'-o',tpr,'-maxwarn'
,'5'])

So that's not the issue. Same thing happened with os.system.



I've tried a bunch of different ways of calling it in python, and all fail
to have the mdp read in.  All other files are read in, and it doesn't
matter what order they are in.

I'm just wondering if other people have experienced this sort of problem
calling gromacs with Python, or if there is something weird I'm doing.


Best,
~~~~~~~~~~~~
Michael Shirts
Associate Professor
Department of Chemical Engineering
University of Virginia
michael.shirts at virginia.edu
(434) 243-1821



More information about the gromacs.org_gmx-developers mailing list