tfep.potentials.gromacs.GmxMdrun

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

Bases: CLITool

The mdrun 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 “mdrun” 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.

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

  • rerun_traj_file_path (str, optional) – Tells mdrun to re-compute properties (e.g., energies, forces) for the configurations in this trajectory file.

  • traj_file_path (str, optional) – The name of the output trajectory file created by mdrun.

  • edr_file_path (str, optional) – The name of the output edr file created by mdrun to log energies.

  • default_file_name (str, optional) – Default file name used for all other files.

  • n_ranks_pme (int, optional) – Number of separate ranks used for PME.

  • n_thread_mpi_ranks (int, optional) – Number of thread-MPI ranks.

  • n_omp_threads_per_mpi_rank (int, optional) – Number of OpenMP threads per MPI rank.

Examples

>>> cmd = GmxMdrun(default_file_name='mysimulation', n_omp_threads_per_mpi_rank=4)
>>> cmd.to_subprocess()
['gmx', 'mdrun', '-deffnm', 'mysimulation', '-ntomp', '4']

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

>>> cmd = GmxMdrun(executable_path='gmx_mpi', default_file_name='mysimulation')
>>> cmd.to_subprocess()
['gmx_mpi', 'mdrun', '-deffnm', 'mysimulation']
__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

default_file_name

A generic command line key-value option.

edr_file_path

A generic command line key-value option.

executable_path

The path to the command executable to run.

n_omp_threads_per_mpi_rank

A generic command line key-value option.

n_ranks_pme

A generic command line key-value option.

n_thread_mpi_ranks

A generic command line key-value option.

rerun_traj_file_path

A generic command line key-value option.

tpr_file_path

A generic command line key-value option.

traj_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]