gromacs.tools – Gromacs commands classes

A Gromacs command class produces an instance of a Gromacs tool command ( gromacs.core.GromacsCommand), any argument or keyword argument supplied will be used as default values for when the command is run.

Classes has the same name of the corresponding Gromacs tool with the first letter capitalized and dot and dashes replaced by underscores to make it a valid python identifier. Gromacs 5 tools are also aliased to their Gromacs 4 tool names (e.g, sasa to g_sas) for backwards compatibility.

The list of tools to be loaded is configured with the tools and groups options of the ~/.gromacswrapper.cfg file. Guesses are made if these options are not provided.

In the following example we create two instances of the gromacs.tools.Trjconv command (which runs the Gromacs trjconv command):

from gromacs.tools import Trjconv

trjconv = tools.Trjconv()
trjconv_compact = tools.Trjconv(ur='compact', center=True, boxcenter='tric', pbc='mol',
                                input=('protein','system'))

The first one, trjconv, behaves as the standard commandline tool but the second one, trjconv_compact, will by default create a compact representation of the input data by taking into account the shape of the unit cell. Of course, the same effect can be obtained by providing the corresponding arguments to trjconv but by naming the more specific command differently one can easily build up a library of small tools that will solve a specific, repeatedly encountered problem reliably. This is particularly helpful when doing interactive work.

Multi index

It is possible to extend the tool commands and patch in additional functionality. For example, the GromacsCommandMultiIndex class makes a command accept multiple index files and concatenates them on the fly; the behaviour mimics Gromacs’ “multi-file” input that has not yet been enabled for all tools.

class gromacs.tools.GromacsCommandMultiIndex(**kwargs)

Command class that accept multiple index files.

It works combining multiple index files into a single temporary one so that tools that do not (yet) support multi index files as input can be used as if they did.

It creates a new file only if multiple index files are supplied.

gromacs.tools.merge_ndx(*args)

Takes one or more index files and optionally one structure file and returns a path for a new merged index file.

Parameters:args – index files and zero or one structure file
Returns:path for the new merged index file

Helpers

gromacs.tools.tool_factory(clsname, name, driver, base=<class 'gromacs.core.GromacsCommand'>)

Factory for GromacsCommand derived types.

gromacs.tools.load_v4_tools()

Load Gromacs 4.x tools automatically using some heuristic.

Tries to load tools (1) in configured tool groups (2) and fails back to automatic detection from GMXBIN (3) then to a prefilled list.

Also load any extra tool configured in ~/.gromacswrapper.cfg

Returns:dict mapping tool names to GromacsCommand classes
gromacs.tools.load_v5_tools()

Load Gromacs 5.x tools automatically using some heuristic.

Tries to load tools (1) using the driver from configured groups (2) and falls back to automatic detection from GMXBIN (3) then to rough guesses.

In all cases the command gmx help is ran to get all tools available.

Returns:dict mapping tool names to GromacsCommand classes
gromacs.tools.find_executables(path)

Find executables in a path.

Searches executables in a directory excluding some know commands unusable with GromacsWrapper.

Parameters:path – dirname to search for
Returns:list of executables
gromacs.tools.make_valid_identifier(name)

Turns tool names into valid identifiers.

Parameters:name – tool name
Returns:valid identifier
exception gromacs.tools.GromacsToolLoadingError

Raised when no Gromacs tool could be found.

Gromacs tools

class gromacs.tools.G_spatial
class gromacs.tools.G_g_anaeig
class gromacs.tools.G_g_spol
class gromacs.tools.G_g_mindist
class gromacs.tools.G_filter
class gromacs.tools.Genrestr
class gromacs.tools.G_g_cluster
class gromacs.tools.G_g_traj
class gromacs.tools.G_g_nmtraj
class gromacs.tools.Trjcat
class gromacs.tools.G_g_luck
class gromacs.tools.G_helixorient
class gromacs.tools.G_gyrate
class gromacs.tools.G_densmap
class gromacs.tools.G_g_confrms
class gromacs.tools.G_g_pme_error
class gromacs.tools.G_g_clustsize
class gromacs.tools.G_g_energy
class gromacs.tools.G_nmens
class gromacs.tools.Grompp
class gromacs.tools.G_g_sorient
class gromacs.tools.G_dist
class gromacs.tools.Trjconv
class gromacs.tools.G_g_select
class gromacs.tools.G_cluster
class gromacs.tools.G_sgangle
class gromacs.tools.G_g_disre
class gromacs.tools.G_g_angle
class gromacs.tools.G_anaeig
class gromacs.tools.G_g_rmsf
class gromacs.tools.Genion
class gromacs.tools.G_gmxdump
class gromacs.tools.G_sham
class gromacs.tools.G_protonate
class gromacs.tools.G_enemat
class gromacs.tools.G_density
class gromacs.tools.G_sigeps
class gromacs.tools.G_nmeig
class gromacs.tools.G_g_tcaf
class gromacs.tools.Tpbconv
class gromacs.tools.G_tcaf
class gromacs.tools.Mdrun_d
class gromacs.tools.Genbox
class gromacs.tools.G_rms
class gromacs.tools.G_current
class gromacs.tools.G_dielectric
class gromacs.tools.G_g_chi
class gromacs.tools.G_msd
class gromacs.tools.G_g_anadock
class gromacs.tools.G_g_densmap
class gromacs.tools.G_disre
class gromacs.tools.G_analyze
class gromacs.tools.Mdrun
class gromacs.tools.G_g_analyze
class gromacs.tools.G_g_sgangle
class gromacs.tools.G_g_dielectric
class gromacs.tools.G_confrms
class gromacs.tools.Trjorder
class gromacs.tools.G_principal
class gromacs.tools.G_g_polystat
class gromacs.tools.G_g_velacc
class gromacs.tools.G_g_rotacf
class gromacs.tools.G_rdf
class gromacs.tools.G_anadock
class gromacs.tools.G_g_helix
class gromacs.tools.G_g_morph
class gromacs.tools.G_hbond
class gromacs.tools.G_g_kinetics
class gromacs.tools.G_g_sigeps
class gromacs.tools.G_g_sham
class gromacs.tools.G_g_nmeig
class gromacs.tools.Gmxdump
class gromacs.tools.G_h2order
class gromacs.tools.G_traj
class gromacs.tools.G_g_bar
class gromacs.tools.G_g_order
class gromacs.tools.G_x2top
class gromacs.tools.G_g_vanhove
class gromacs.tools.G_g_enemat
class gromacs.tools.G_dih
class gromacs.tools.G_g_saltbr
class gromacs.tools.Gmxcheck
class gromacs.tools.G_mindist
class gromacs.tools.G_sas
class gromacs.tools.G_g_dyndom
class gromacs.tools.G_g_current
class gromacs.tools.G_g_rmsdist
class gromacs.tools.G_nmtraj
class gromacs.tools.G_g_gyrate
class gromacs.tools.G_g_bundle
class gromacs.tools.G_g_covar
class gromacs.tools.G_bond
class gromacs.tools.G_covar
class gromacs.tools.G_g_dih
class gromacs.tools.Editconf
class gromacs.tools.Pdb2gmx
class gromacs.tools.G_g_sas
class gromacs.tools.G_g_lie
class gromacs.tools.G_helix
class gromacs.tools.Mk_angndx
class gromacs.tools.G_mdmat
class gromacs.tools.Eneconv
class gromacs.tools.G_g_rotmat
class gromacs.tools.G_energy
class gromacs.tools.G_rmsdist
class gromacs.tools.G_tpbconv
class gromacs.tools.G_clustsize
class gromacs.tools.G_g_protonate
class gromacs.tools.G_dipoles
class gromacs.tools.G_lie
class gromacs.tools.G_g_hbond
class gromacs.tools.Xpm2ps
class gromacs.tools.G_rama
class gromacs.tools.G_wham
class gromacs.tools.G_vanhove
class gromacs.tools.G_rotacf
class gromacs.tools.G_g_spatial
class gromacs.tools.G_g_rama
class gromacs.tools.G_luck
class gromacs.tools.G_spol
class gromacs.tools.G_g_membed
class gromacs.tools.G_pme_error
class gromacs.tools.G_g_tune_pme
class gromacs.tools.Make_edi
class gromacs.tools.G_angle
class gromacs.tools.G_potential
class gromacs.tools.G_g_mdmat
class gromacs.tools.G_g_dist
class gromacs.tools.G_select
class gromacs.tools.G_gmxcheck
class gromacs.tools.G_g_nmens
class gromacs.tools.G_g_filter
class gromacs.tools.G_velacc
class gromacs.tools.G_g_dipoles
class gromacs.tools.G_g_x2top
class gromacs.tools.G_g_wheel
class gromacs.tools.G_rotmat
class gromacs.tools.G_g_potential
class gromacs.tools.G_polystat
class gromacs.tools.G_genbox
class gromacs.tools.G_bundle
class gromacs.tools.G_order
class gromacs.tools.G_g_density
class gromacs.tools.G_g_wham
class gromacs.tools.G_g_helixorient
class gromacs.tools.G_g_bond
class gromacs.tools.G_g_rms
class gromacs.tools.G_saltbr
class gromacs.tools.G_g_msd
class gromacs.tools.Do_dssp
class gromacs.tools.G_bar
class gromacs.tools.G_g_h2order
class gromacs.tools.G_wheel
class gromacs.tools.Make_ndx
class gromacs.tools.G_mk_angndx
class gromacs.tools.G_dyndom
class gromacs.tools.Genconf
class gromacs.tools.G_tune_pme
class gromacs.tools.G_g_rdf
class gromacs.tools.G_kinetics
class gromacs.tools.G_morph
class gromacs.tools.G_chi
class gromacs.tools.G_membed
class gromacs.tools.G_sorient
class gromacs.tools.G_rmsf
class gromacs.tools.G_g_principal