BioSimSpace.Process.Gromacs

class BioSimSpace.Process.Gromacs(system, protocol, exe=None, name='gromacs', work_dir=None, seed=None, property_map={}, ignore_warnings=False, show_errors=True, checkpoint_file=None)

A class for running simulations using GROMACS.

__init__(system, protocol, exe=None, name='gromacs', work_dir=None, seed=None, property_map={}, ignore_warnings=False, show_errors=True, checkpoint_file=None)

Constructor.

Parameters
  • system (System) – The molecular system.

  • protocol (Protocol) – The protocol for the GROMACS process.

  • exe (str) – The full path to the GROMACS executable.

  • name (str) – The name of the process.

  • work_dir – The working directory for the process.

  • seed (int) – A random number seed.

  • property_map (dict) – A dictionary that maps system “properties” to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }

  • ignore_warnings (bool) – Whether to ignore warnings when generating the binary run file with ‘gmx grompp’. By default, these warnings are elevated to errors and will halt the program.

  • show_errors (bool) – Whether to show warning/error messages when generating the binary run file.

  • checkpoint_file (str) – The path to a checkpoint file from a previous run. This can be used to continue an existing simulation. Currently we only support the use of checkpoint files for Equilibration protocols.

Methods

__init__(system, protocol[, exe, name, …])

Constructor.

addArgs(args)

Append additional command-line arguments.

addToConfig(config)

Add a string to the configuration list.

clearArgs()

Clear all of the command-line arguments.

command()

Return the command-line string used to run the process.

deleteArg(arg)

Delete an argument from the dictionary.

exe()

Return the executable.

getAngleEnergy([time_series, block])

Get the angle energy.

getArgString()

Get the command-line arguments string.

getArgStringList()

Convert the argument dictionary into a list of strings.

getArgs()

Get the dictionary of command-line arguments.

getBondEnergy([time_series, block])

Get the bond energy.

getConfig()

Get the list of configuration file strings.

getConservedEnergy([time_series, block])

Get the conserved energy.

getConstraintRMSD([time_series, block])

Get the RMSD of the constrained atoms.

getCoulomb14([time_series, block])

Get the Coulomb energy between atoms 1 and 4.

getCoulombReciprocal([time_series, block])

Get the reciprocal space Coulomb energy.

getCoulombSR([time_series, block])

Get the short-range Coulomb energy.

getCurrentAngleEnergy([time_series])

Get the current angle energy.

getCurrentBondEnergy([time_series])

Get the current bond energy.

getCurrentConservedEnergy([time_series])

Get the current conserved energy.

getCurrentConstraintRMSD([time_series])

Get the current RMSD of the constrained atoms.

getCurrentCoulomb14([time_series])

Get the current Coulomb energy between atoms 1 and 4.

getCurrentCoulombReciprocal([time_series])

Get the current reciprocal space Coulomb energy.

getCurrentCoulombSR([time_series])

Get the current short-range Coulomb energy.

getCurrentDihedralEnergy([time_series])

Get the current total dihedral energy (proper + improper).

getCurrentDispersionCorrection([time_series])

Get the current dispersion correction.

getCurrentImproperEnergy([time_series])

Get the current improper energy.

getCurrentKineticEnergy([time_series])

Get the current kinetic energy.

getCurrentLennardJones14([time_series])

Get the current Lennard-Jones energy between atoms 1 and 4.

getCurrentLennardJonesSR([time_series])

Get the current short-range Lennard-Jones energy.

getCurrentPotentialEnergy([time_series])

Get the current potential energy.

getCurrentPressure([time_series])

Get the current pressure.

getCurrentPressureDC([time_series])

Get the current DC pressure.

getCurrentProperEnergy([time_series])

Get the current proper dihedral energy.

getCurrentRecord(record[, time_series, unit])

Get a current record from the stdout dictionary.

getCurrentRecords()

Return the current dictionary of stdout time-series records.

getCurrentRestraintEnergy([time_series])

Get the current position restraint energy.

getCurrentStep([time_series])

Get the current number of integration steps.

getCurrentSystem()

Get the latest molecular system.

getCurrentTemperature([time_series])

Get the current temperature.

getCurrentTime([time_series])

Get the current simulation time.

getCurrentTotalEnergy([time_series])

Get the current total energy.

getDihedralEnergy([time_series, block])

Get the total dihedral energy (proper + improper).

getDispersionCorrection([time_series, block])

Get the dispersion correction.

getFrame(index)

Return a specific trajectory frame.

getImproperEnergy([time_series, block])

Get the improper energy.

getInput([name, file_link])

Return a link to a zip file containing the input files used by the process.

getKineticEnergy([time_series, block])

Get the kinetic energy.

getLennardJones14([time_series, block])

Get the Lennard-Jones energy between atoms 1 and 4.

getLennardJonesSR([time_series, block])

Get the short-range Lennard-Jones energy.

getName()

Return the process name.

getOutput([name, block, file_link])

Return a link to a zip file of the working directory.

getPackageName()

Return the package name.

getPotentialEnergy([time_series, block])

Get the potential energy.

getPressure([time_series, block])

Get the pressure.

getPressureDC([time_series, block])

Get the DC pressure.

getProperEnergy([time_series, block])

Get the proper dihedral energy.

getRecord(record[, time_series, unit, block])

Get a record from the stdout dictionary.

getRecords([block])

Return the dictionary of stdout time-series records.

getRestraintEnergy([time_series, block])

Get the position restraint energy.

getSeed()

Return the random number seed.

getStderr([block])

Return the entire stderr for the process as a list of strings.

getStdout([block])

Return the entire stdout for the process as a list of strings.

getStep([time_series, block])

Get the number of integration steps.

getSystem([block])

Get the latest molecular system.

getTemperature([time_series, block])

Get the temperature.

getTime([time_series, block])

Get the simulation time.

getTotalEnergy([time_series, block])

Get the total energy.

getTrajectory([block])

Return a trajectory object.

inputFiles()

Return the list of input files.

insertArg(arg, value, index)

Insert a command-line argument at a specific index.

isError()

Return whether the process exited with an error.

isQueued()

Return whether the process is queued.

isRunning()

Return whether the process is running.

kill()

Kill the running process.

resetArgs()

Reset the command-line arguments.

resetConfig()

Reset the configuration parameters.

run([system, protocol, auto_start, restart])

Create and run a new process.

runTime()

Return the running time for the process (in minutes).

setArg(arg, value)

Set a specific command-line argument.

setArgs(args)

Set the dictionary of command-line arguments.

setConfig(config)

Set the list of configuration file strings.

setName(name)

Set the process name.

setSeed(seed)

Set the random number seed.

start()

Start the GROMACS process.

stderr([n])

Print the last n lines of the stderr buffer.

stdout([n])

Print the last n lines of the stdout buffer.

wait([max_time])

Wait for the process to finish.

workDir()

Return the working directory.

writeConfig(file)

Write the configuration to file.

addArgs(args)

Append additional command-line arguments.

Parameters

args (dict, collections.OrderedDict) – A dictionary of command line arguments.

addToConfig(config)

Add a string to the configuration list.

Parameters

config (str, [str]) – A configuration string, a list of configuration strings, or a path to a configuration file.

clearArgs()

Clear all of the command-line arguments.

command()

Return the command-line string used to run the process.

Returns

command – The command string.

Return type

str

deleteArg(arg)

Delete an argument from the dictionary.

Parameters

arg (str) – The argument to delete.

exe()

Return the executable.

Returns

exe – The path to the executable.

Return type

str

getAngleEnergy(time_series=False, block='AUTO')

Get the angle energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The angle energy.

Return type

Energy

getArgString()

Get the command-line arguments string.

Returns

arg_string – The command-line argument string.

Return type

str

getArgStringList()

Convert the argument dictionary into a list of strings.

Returns

arg_string_list – The list of command-line arguments.

Return type

[str]

getArgs()

Get the dictionary of command-line arguments.

Returns

args – The dictionary of command-line arguments.

Return type

collections.OrderedDict

getBondEnergy(time_series=False, block='AUTO')

Get the bond energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The bond energy.

Return type

Energy

getConfig()

Get the list of configuration file strings.

Returns

config – The list of configuration strings.

Return type

[str]

getConservedEnergy(time_series=False, block='AUTO')

Get the conserved energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The conserved energy.

Return type

Energy

getConstraintRMSD(time_series=False, block='AUTO')

Get the RMSD of the constrained atoms.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

length – The constrained RMSD.

Return type

Length

getCoulomb14(time_series=False, block='AUTO')

Get the Coulomb energy between atoms 1 and 4.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The Coulomb energy.

Return type

Energy

getCoulombReciprocal(time_series=False, block='AUTO')

Get the reciprocal space Coulomb energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The Coulomb energy.

Return type

Energy

getCoulombSR(time_series=False, block='AUTO')

Get the short-range Coulomb energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The Coulomb energy.

Return type

Energy

getCurrentAngleEnergy(time_series=False)

Get the current angle energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The angle energy.

Return type

Energy

getCurrentBondEnergy(time_series=False)

Get the current bond energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The bond energy.

Return type

Energy

getCurrentConservedEnergy(time_series=False)

Get the current conserved energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The conserved energy.

Return type

Energy

getCurrentConstraintRMSD(time_series=False)

Get the current RMSD of the constrained atoms.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

length – The current constrained RMSD.

Return type

Length

getCurrentCoulomb14(time_series=False)

Get the current Coulomb energy between atoms 1 and 4.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The Coulomb energy.

Return type

Energy

getCurrentCoulombReciprocal(time_series=False)

Get the current reciprocal space Coulomb energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The Coulomb energy.

Return type

Energy

getCurrentCoulombSR(time_series=False)

Get the current short-range Coulomb energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The Coulomb energy.

Return type

Energy

getCurrentDihedralEnergy(time_series=False)

Get the current total dihedral energy (proper + improper).

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The dihedral energy.

Return type

Energy

getCurrentDispersionCorrection(time_series=False)

Get the current dispersion correction.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The dispersion correction.

Return type

Energy

getCurrentImproperEnergy(time_series=False)

Get the current improper energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The improper energy.

Return type

Energy

getCurrentKineticEnergy(time_series=False)

Get the current kinetic energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The kinetic energy.

Return type

Energy

getCurrentLennardJones14(time_series=False)

Get the current Lennard-Jones energy between atoms 1 and 4.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The Lennard-Jones energy.

Return type

Energy

getCurrentLennardJonesSR(time_series=False)

Get the current short-range Lennard-Jones energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The Lennard-Jones energy.

Return type

Energy

getCurrentPotentialEnergy(time_series=False)

Get the current potential energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The potential energy.

Return type

Energy

getCurrentPressure(time_series=False)

Get the current pressure.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

pressure – The current pressure.

Return type

Pressure

getCurrentPressureDC(time_series=False)

Get the current DC pressure.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

pressure – The current pressure.

Return type

Pressure

getCurrentProperEnergy(time_series=False)

Get the current proper dihedral energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The proper dihedral energy.

Return type

Energy

getCurrentRecord(record, time_series=False, unit=None)

Get a current record from the stdout dictionary.

Parameters
  • record (str) – The record key.

  • time_series (bool) – Whether to return a list of time series records.

  • unit (Unit) – The unit to convert the record to.

Returns

record – The matching record.

Return type

Type

getCurrentRecords()

Return the current dictionary of stdout time-series records.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

records – The dictionary of time-series records.

Return type

MultiDict

getCurrentRestraintEnergy(time_series=False)

Get the current position restraint energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The dispersion correction.

Return type

Energy

getCurrentStep(time_series=False)

Get the current number of integration steps.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

step – The current number of integration steps.

Return type

int

getCurrentSystem()

Get the latest molecular system.

Returns

system – The latest molecular system.

Return type

System

getCurrentTemperature(time_series=False)

Get the current temperature.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

temperature – The current temperature.

Return type

Temperature

getCurrentTime(time_series=False)

Get the current simulation time.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

time – The current simulation time in nanoseconds.

Return type

Time

getCurrentTotalEnergy(time_series=False)

Get the current total energy.

Parameters

time_series (bool) – Whether to return a list of time series records.

Returns

energy – The total energy.

Return type

Energy

getDihedralEnergy(time_series=False, block='AUTO')

Get the total dihedral energy (proper + improper).

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The total dihedral energy.

Return type

Energy

getDispersionCorrection(time_series=False, block='AUTO')

Get the dispersion correction.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The dispersion correction.

Return type

Energy

getFrame(index)

Return a specific trajectory frame.

Parameters

index (int) – The index of the frame.

Returns

frame – The System object of the corresponding frame.

Return type

System

getImproperEnergy(time_series=False, block='AUTO')

Get the improper energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The improper energy.

Return type

Energy

getInput(name=None, file_link=False)

Return a link to a zip file containing the input files used by the process.

Parameters
  • name (str) – The name of the zip file.

  • file_link (bool) – Whether to return a FileLink when working in Jupyter.

Returns

output – A path, or file link, to an archive of the process input.

Return type

str, IPython.display.FileLink

getKineticEnergy(time_series=False, block='AUTO')

Get the kinetic energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The kinetic energy.

Return type

Energy

getLennardJones14(time_series=False, block='AUTO')

Get the Lennard-Jones energy between atoms 1 and 4.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The Lennard-Jones energy.

Return type

Energy

getLennardJonesSR(time_series=False, block='AUTO')

Get the short-range Lennard-Jones energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The short-range Lennard-Jones energy.

Return type

Energy

getName()

Return the process name.

Returns:

namestr

The name of the process.

getOutput(name=None, block='AUTO', file_link=False)

Return a link to a zip file of the working directory.

Parameters
  • name (str) – The name of the zip file.

  • block (bool) – Whether to block until the process has finished running.

  • file_link (bool) – Whether to return a FileLink when working in Jupyter.

Returns

output – A path, or file link, to an archive of the process output.

Return type

str, IPython.display.FileLink

getPackageName()

Return the package name.

Returns

name – The name of the package.

Return type

str

getPotentialEnergy(time_series=False, block='AUTO')

Get the potential energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The potential energy.

Return type

Energy

getPressure(time_series=False, block='AUTO')

Get the pressure.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

pressure – The pressure.

Return type

Pressure

getPressureDC(time_series=False, block='AUTO')

Get the DC pressure.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

pressure – The DC pressure.

Return type

Pressure

getProperEnergy(time_series=False, block='AUTO')

Get the proper dihedral energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The proper dihedral energy.

Return type

Energy

getRecord(record, time_series=False, unit=None, block='AUTO')

Get a record from the stdout dictionary.

Parameters
  • record (str) – The record key.

  • time_series (bool) – Whether to return a list of time series records.

  • unit (Unit) – The unit to convert the record to.

  • block (bool) – Whether to block until the process has finished running.

Returns

record – The matching record.

Return type

Type

getRecords(block='AUTO')

Return the dictionary of stdout time-series records.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

records – The dictionary of time-series records.

Return type

MultiDict

getRestraintEnergy(time_series=False, block='AUTO')

Get the position restraint energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The dispersion correction.

Return type

Energy

getSeed()

Return the random number seed.

Returns

seed – The random number seed.

Return type

int

getStderr(block='AUTO')

Return the entire stderr for the process as a list of strings.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

error – The list of stderror strings.

Return type

[str]

getStdout(block='AUTO')

Return the entire stdout for the process as a list of strings.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

output – The list of stdout strings.

Return type

[str]

getStep(time_series=False, block='AUTO')

Get the number of integration steps.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

step – The current number of integration steps.

Return type

int

getSystem(block='AUTO')

Get the latest molecular system.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

system – The latest molecular system.

Return type

System

getTemperature(time_series=False, block='AUTO')

Get the temperature.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

temperature – The temperature.

Return type

Temperature

getTime(time_series=False, block='AUTO')

Get the simulation time.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

time – The current simulation time in nanoseconds.

Return type

Time

getTotalEnergy(time_series=False, block='AUTO')

Get the total energy.

Parameters
  • time_series (bool) – Whether to return a list of time series records.

  • block (bool) – Whether to block until the process has finished running.

Returns

energy – The total energy.

Return type

Energy

getTrajectory(block='AUTO')

Return a trajectory object.

Parameters

block (bool) – Whether to block until the process has finished running.

Returns

trajectory – The latest trajectory object.

Return type

System

inputFiles()

Return the list of input files.

Returns

input_files – The list of autogenerated input files.

Return type

[str]

insertArg(arg, value, index)

Insert a command-line argument at a specific index.

Parameters
  • arg (str) – The argument to set.

  • value – The value of the argument.

  • index (int) – The index in the dictionary.

isError()

Return whether the process exited with an error.

Returns

is_error – Whether the process exited with an error.

Return type

bool

isQueued()

Return whether the process is queued.

Returns

is_queued – Whether the process is queued.

Return type

bool

isRunning()

Return whether the process is running.

Returns

is_running – Whether the process is running.

Return type

bool

kill()

Kill the running process.

resetArgs()

Reset the command-line arguments.

resetConfig()

Reset the configuration parameters.

run(system=None, protocol=None, auto_start=True, restart=False)

Create and run a new process.

Parameters
  • system (System) – The molecular system.

  • protocol (Protocol) – The simulation protocol.

  • auto_start (bool) – Whether to start the process automatically.

  • restart (bool) – Whether to restart the simulation, i.e. use the original system.

Returns

process – The new process object.

Return type

Procees

runTime()

Return the running time for the process (in minutes).

Returns

runtime – The runtime in minutes.

Return type

Time

setArg(arg, value)

Set a specific command-line argument.

For command-line flags, i.e. boolean arguments, the key should specify whether the flag is enabled (True) or not (False).

Parameters
  • arg (str) – The argument to set.

  • value (bool, str) – The value of the argument.

setArgs(args)

Set the dictionary of command-line arguments.

Parameters

args (dict, collections.OrderedDict) – A dictionary of command-line arguments.

setConfig(config)

Set the list of configuration file strings.

Parameters

config (str, [str]) – The list of configuration strings, or a path to a configuration file.

setName(name)

Set the process name.

Parameters

name (str) – The process name.

setSeed(seed)

Set the random number seed.

Parameters

seed (int) – The random number seed.

start()

Start the GROMACS process.

Returns

process – A handle to the GROMACS process.

Return type

Process.Gromacs

stderr(n=10)

Print the last n lines of the stderr buffer.

Parameters

n (int) – The number of lines to print.

stdout(n=10)

Print the last n lines of the stdout buffer.

Parameters

n (int) – The number of lines to print.

wait(max_time=None)

Wait for the process to finish.

Parameters

max_time (Time, int, float) – The maximum time to wait (in minutes).

workDir()

Return the working directory.

Returns

work_dir – The path of the working directory.

Return type

str

writeConfig(file)

Write the configuration to file.

Parameters

file (str) – The path to a file.