[gmx-users] Making Commands Non-Interactive

Alexander Bujotzek bujotzek at zib.de
Mon Oct 5 10:15:42 CEST 2009

I once wrote some lines of adventurous C-code to get an observable of
choice from g_energy without typing the observable index myself... this
may also be applied to trjconv I think.

string genergyCall = "g_energy -f " + myEdrFile + " -o " + myXvgFile + "
&> /dev/null";
string energyObs = "8"; // e.g. potential

FILE *fpipe;
fpipe = popen(genergyCall.c_str(),"w");
fwrite(energyObs.data(), 1, 1, fpipe); // tell g_energy what to write

If you want to pipe more stuff to the program you are calling, the buffer
size of fwrite has to be increased.
So you might put this into a minimal C-program and start that
non-interactive with qsub or whatever.

> Dear GMX Users,
> I ask this question in this mailing list since probably a user have
> already encountered this similar problem. I would like to  post-process my
> trajectory with the command trjconv (in mpi mode). For this I use the
> following shell command:
> echo 0 | /usr/pbs/bin/mpiexec /scratch/name/gromacs-4.0.5/bin/trjconv_mpi
> -s Peptide_43A1_topol.tpr -f ./XTC/Whole_Traj_43A1.xtc -o
> ./XTC/Whole_Traj_43A1noPBC.xtc -pbc mol -ur compact. With the selection 0
> ("System")
> It works but since my simulations is very long (> 300ns) the command stops
> in the middle of the trajectory before to finish the process ( i suspect a
> time limit for using the interactive mode). So i would like to use a
> script to do the task. How to pass the choice 0 in the script (i.e.
> equivalent to the echo 0). I use a bash shell and the command qsub to
> launch a mpi job.
> I have tried to adapt the examples available in the GMX website with a
> text file as suggested by the author in GROMACS site with no success.
> Thank you again for your help
> _______________________________________________
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before posting!
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Alexander Bujotzek
Zuse Institute Berlin
Computational Drug Design Group
Tel. : +49 30 84185-234
eMail: bujotzek at zib.de

More information about the gromacs.org_gmx-users mailing list