tfep.potentials.gromacs.GmxGrompp

class tfep.potentials.gromacs.GmxGrompp(*args, executable_path=None, **kwargs)[source]

Bases: CLITool

The grompp subprogram of gmx from the GROMACS suite.

The executable path variable only specifies the path to the gmx executable. The class takes care of adding the “grompp” subprogram after “gmx” so it does not have to be passed when the command is instantiated.

Relative file paths must be relative to the working directory used for executing the command (i.e., they are not converted to absolute paths before changing the working directory). This is to enable executing multiple instances of the command in parallel in different working directories.

Parameters:
  • executable_path (str, optional) – The executable path associated to the instance of the command. If this is not specified, the EXECUTABLE_PATH class variable is used instead.

  • mdp_input_file_path (str, optional) – Path to input .mdp file. If a relative path is given, this must be relative to the working directory when the command is executed, not when GmxGrompp is initialized.

  • structure_input_file_path (str, optional) – The file including the structure and (if trajectory_input_file_path is not provided) the starting coordinates of the calculation (e.g., in .gro or .pdb format).

  • top_input_file_path (str, optional) – The path to the input .top topology file.

  • trajectory_input_file_path (str, optional) – If given, the last frame is used to determine the starting coordinates (e.g., in .trr or .cpt) file.

  • index_input_file_path (str, optional) – The path to the input .ndx file with the atom group indices.

  • tpr_output_file_path (str, optional) – The path to the output .tpr file.

  • n_max_warnings (int, optional) – The maximum number of warnings after which an error is raised.

Examples

>>> cmd = GmxGrompp(mdp_input_file_path='mysimulation.mdp', n_max_warnings=2)
>>> cmd.to_subprocess()
['gmx', 'grompp', '-f', 'mysimulation.mdp', '-maxwarn', '2']

If the executable is called differently, simply specify the executable path as a keyword argument.

>>> cmd = GmxGrompp(executable_path='gmx_mpi', mdp_input_file_path='mysimulation.mdp')
>>> cmd.to_subprocess()
['gmx_mpi', 'grompp', '-f', 'mysimulation.mdp']
__init__(*args, executable_path=None, **kwargs)

Methods

__init__(*args[, executable_path])

to_subprocess()

Convert the command to a list that can be run with the subprocess module.

Attributes

EXECUTABLE_PATH

SUBPROGRAM

executable_path

The path to the command executable to run.

index_input_file_path

A generic command line key-value option.

mdp_input_file_path

A generic command line key-value option.

n_max_warnings

A generic command line key-value option.

structure_input_file_path

A generic command line key-value option.

top_input_file_path

A generic command line key-value option.

tpr_output_file_path

A generic command line key-value option.

trajectory_input_file_path

A generic command line key-value option.

property executable_path

The path to the command executable to run.

to_subprocess()

Convert the command to a list that can be run with the subprocess module.

Returns:

subprocess_cmd – The command in subprocess format. For example ['grep', '-v'].

Return type:

List[str]