[gmx-users] automatic selections with interactive gmx commands

Martin Mucha mucha at uochb.cas.cz
Mon May 31 16:10:48 CEST 2004


> this works, but it depends on you knowing which numbers to choose. At
> some stage it should be possible to select by name, if someone wishes to
> implement that...

till then, here is a simple perl script that you are encouraged to 
modify, especially, you can add new entries into %mappings.

Martin

---------------------------------------------------------------------
#!/usr/bin/perl

# USAGE: g_ene file.edr <one or more keywords>
# EXAMPLE: g_ene file.edr pot tot

#Here you specify the mapping of shorthanded to full
%mappings=('tot','Total Energy',
	   'kin','Kinetic En.',
	   'temp','Temperature',
	   'pot','Potential',
	   'vdw','LJ (SR)'
	   );

# first argument is the name of the .edr file:
$common = shift @ARGV;

@options = ();
foreach (split /^/m,`echo 0 | g_energy -f $common -e 0 2>&1`) {
     if (/\d+=/) { push @options,$_; }
}

@couples = "@options"=~/(\d+)=([ a-zA-Z\(\)\*\#\-.]+)/g;
for ($i=0;$i<$#couples;$i+=2) {
     @pom = split ' ',$couples[$i+1];
     $couples{"@pom"} = $couples[$i];
}

$codes = ' ';
foreach (@ARGV) {
     $codes .= "$couples{$mappings{$_}} ";
}
$codes .= "0";

system "echo '$codes' | g_energy -f $common ";
system "xmgrace -nxy energy.xvg"
------------------------------------------------------------------------------



More information about the gromacs.org_gmx-users mailing list