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 2018/2016/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.Dyecoupl
class gromacs.tools.G_spatial
class gromacs.tools.Sigeps
class gromacs.tools.Density
class gromacs.tools.Chi
class gromacs.tools.G_filter
class gromacs.tools.Genrestr
class gromacs.tools.Nmtraj
class gromacs.tools.Analyze
class gromacs.tools.Helixorient
class gromacs.tools.G_sans
class gromacs.tools.Trjcat
class gromacs.tools.G_densorder
class gromacs.tools.G_helixorient
class gromacs.tools.Velacc
class gromacs.tools.G_principal
class gromacs.tools.Spol
class gromacs.tools.G_densmap
class gromacs.tools.Confrms
class gromacs.tools.G_order
class gromacs.tools.G_nmens
class gromacs.tools.Grompp
class gromacs.tools.G_angle
class gromacs.tools.Editconf
class gromacs.tools.Bar
class gromacs.tools.Trjconv
class gromacs.tools.Clustsize
class gromacs.tools.G_sgangle
class gromacs.tools.G_pairdist
class gromacs.tools.G_dyecoupl
class gromacs.tools.G_hydorder
class gromacs.tools.Sasa
class gromacs.tools.Vanhove
class gromacs.tools.G_help
class gromacs.tools.Help
class gromacs.tools.Solvate
class gromacs.tools.Hydorder
class gromacs.tools.Enemat
class gromacs.tools.Genion
class gromacs.tools.G_sham
class gromacs.tools.Polystat
class gromacs.tools.G_enemat
class gromacs.tools.G_density
class gromacs.tools.G_sigeps
class gromacs.tools.Check
class gromacs.tools.Select
class gromacs.tools.Tpbconv
class gromacs.tools.G_tcaf
class gromacs.tools.Genbox
class gromacs.tools.Nmens
class gromacs.tools.G_rms
class gromacs.tools.Pairdist
class gromacs.tools.G_dielectric
class gromacs.tools.Spatial
class gromacs.tools.G_anadock
class gromacs.tools.H2order
class gromacs.tools.G_disre
class gromacs.tools.Wham
class gromacs.tools.Nmr
class gromacs.tools.Mdrun
class gromacs.tools.Densorder
class gromacs.tools.G_confrms
class gromacs.tools.Trjorder
class gromacs.tools.G_view
class gromacs.tools.Awh
class gromacs.tools.G_dos
class gromacs.tools.G_hbond
class gromacs.tools.Tune_pme
class gromacs.tools.Anadock
class gromacs.tools.G_rdf
class gromacs.tools.Rmsf
class gromacs.tools.Sans
class gromacs.tools.Rmsdist
class gromacs.tools.Saltbr
class gromacs.tools.G_rama
class gromacs.tools.Disre
class gromacs.tools.Rdf
class gromacs.tools.Gmxdump
class gromacs.tools.Gangle
class gromacs.tools.G_h2order
class gromacs.tools.G_traj
class gromacs.tools.Anaeig
class gromacs.tools.Dump
class gromacs.tools.G_rotacf
class gromacs.tools.Energy
class gromacs.tools.G_lie
class gromacs.tools.G_x2top
class gromacs.tools.G_nmeig
class gromacs.tools.Rotmat
class gromacs.tools.G_dist
class gromacs.tools.G_gyrate
class gromacs.tools.Gmxcheck
class gromacs.tools.G_mindist
class gromacs.tools.G_sas
class gromacs.tools.Convert_tpr
class gromacs.tools.G_nmtraj
class gromacs.tools.Helix
class gromacs.tools.Densmap
class gromacs.tools.Msd
class gromacs.tools.Sham
class gromacs.tools.G_covar
class gromacs.tools.Saxs
class gromacs.tools.Bundle
class gromacs.tools.Pdb2gmx
class gromacs.tools.Mindist
class gromacs.tools.G_helix
class gromacs.tools.Mk_angndx
class gromacs.tools.G_mdmat
class gromacs.tools.Sorient
class gromacs.tools.G_nmr
class gromacs.tools.Insert_molecules
class gromacs.tools.Morph
class gromacs.tools.G_energy
class gromacs.tools.Filter
class gromacs.tools.G_rmsdist
class gromacs.tools.Gyrate
class gromacs.tools.G_clustsize
class gromacs.tools.Mdmat
class gromacs.tools.G_dipoles
class gromacs.tools.Freevolume
class gromacs.tools.Rama
class gromacs.tools.Xpm2ps
class gromacs.tools.Rms
class gromacs.tools.G_wham
class gromacs.tools.G_vanhove
class gromacs.tools.G_anaeig
class gromacs.tools.Cluster
class gromacs.tools.G_spol
class gromacs.tools.Dyndom
class gromacs.tools.G_pme_error
class gromacs.tools.G_current
class gromacs.tools.Eneconv
class gromacs.tools.Make_edi
class gromacs.tools.Lie
class gromacs.tools.G_potential
class gromacs.tools.Angle
class gromacs.tools.X2top
class gromacs.tools.Pme_error
class gromacs.tools.Trajectory
class gromacs.tools.G_select
class gromacs.tools.G_insert_molecules
class gromacs.tools.Current
class gromacs.tools.G_velacc
class gromacs.tools.Potential
class gromacs.tools.Dipoles
class gromacs.tools.Tcaf
class gromacs.tools.G_rotmat
class gromacs.tools.G_polystat
class gromacs.tools.Wheel
class gromacs.tools.G_bundle
class gromacs.tools.G_dyndom
class gromacs.tools.Covar
class gromacs.tools.G_msd
class gromacs.tools.Dielectric
class gromacs.tools.G_cluster
class gromacs.tools.Distance
class gromacs.tools.G_saltbr
class gromacs.tools.Rotacf
class gromacs.tools.G_freevolume
class gromacs.tools.Do_dssp
class gromacs.tools.G_bar
class gromacs.tools.Nmeig
class gromacs.tools.Hbond
class gromacs.tools.Traj
class gromacs.tools.G_wheel
class gromacs.tools.G_analyze
class gromacs.tools.Make_ndx
class gromacs.tools.Dos
class gromacs.tools.Order
class gromacs.tools.View
class gromacs.tools.Genconf
class gromacs.tools.G_tune_pme
class gromacs.tools.G_saxs
class gromacs.tools.G_mk_angndx
class gromacs.tools.G_trajectory
class gromacs.tools.G_morph
class gromacs.tools.G_chi
class gromacs.tools.G_awh
class gromacs.tools.G_sorient
class gromacs.tools.G_rmsf
class gromacs.tools.Principal