Gromacs

Using Commands in Scripts

    Version as of 07:29, 2 Dec 2021

    to this version.

    Return to Version archive.

    View current version

    GROMACS scripts are typically interactive, with selection of index groups made after the script is started.

    There are two options to enable the scripts to be executed non-interactively (using the example of g_rms):

     

    Command Line

    echo 3 3 | g_rms -flags
    

     

    Within Script

    There is no fundamental difference between a script and the command line (above) but for extensive user input the following syntax may be used as well (note that this is csh / tcsh notation, bash fanatics might want to add the bash equivalent here).

    g_rms -flags <<EOF
    3
    3
    EOF
    

    Or by having the index choices contained within a text file:

    g_rms -flags < choices.txt
    

    Where choices.txt contains:

    3
    3
    

     

    Using Group Names

    As sometimes the numbers of certain choices may vary from file to file from on Gromacs 3.3.1 it is possible to pass the explicit names to the tools.

    g_energy -f ener.edr << EOF
    Pot
    Kin
    Tot
    EOF
    

    The best fit will be used, if you select e.g. Pres the first term starting with Pres will be used.

     

    Complex cases

    Should you encounter a more complex need, the expect tool automates human-script interaction in a programmatic fashion.

    Page last modified 01:24, 10 Oct 2009 by JLemkul?