|
Using Commands in ScriptsTable of contents
GROMACS programs are typically interactive, with selection of index groups made after the program is started. There are two options to enable the programs to be executed non-interactively in shell scripts (using the example of g_rms):
Command Lineecho 3 3 | g_rms -flags
Within ScriptThere 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 NamesAs sometimes the numbers of certain choices may vary from case to case, in Gromacs 3.3.1 and later 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 casesShould you encounter a more complex need, the expect tool automates human-script interaction in a programmatic fashion. |