openpathsampling.engines.gromacs.engine.GromacsEngine

class openpathsampling.engines.gromacs.engine.GromacsEngine(gro, mdp, top, options, base_dir='', prefix='gmx')[source]

External engine wrapper for Gromacs (using indirect API).

This provides Gromacs support, using our indirect engine API (TODO link).

OPS runs Gromacs based on the mdp file that you provide. This mdp file MUST output in the TRR format, and the velocity and position save frequency in the TRR must be the same (that is, you need to have nstxout = nstvout, and they must not be 0).

Parameters:
  • gro (string) – File for the grompp -c flag. This is often a .gro, but note that you may get better support with other integrations (e.g., MDTraj) if you use a PDB.

  • mdp (string) – .mdp file

  • top (string) – .top file

  • options (dict) –

    Dictionary of option name to value. Gromacs-specific option names are

    • gmx_executable: Prefix to gromacs commands, which are run as {gmx_prefix}command. Default is ‘gmx ‘ (note the space). This allows you to use either Gromacs 4 or Gromacs 5, as well as specifying the path to your version of Gromacs.

    • grompp_args: Additional arguments to grompp. The defaults take -c {self.gro} -f {self.mdp} -p {self.top} -t {self.input_file}, where the input filename is set by set_filenames(). Default is the empty string.

    • mdrun_args: Additional arguments to mdrun. The defaults take -s topol.top -o self.output_file -e self.edr_file -g self.log_file, where the topol.top is generated by prepare(), and the other filenames are set by set_filenames(). Default is the empty string.

    • snapshot_timestep: time between frames analysed by ops. You keep track of the unit, I’d advise ps so the output rates will be in ps. Example. 2 fs timestep in the mdp with nstxout of 30 would give snapshot_timestep of 60 fs = 0.06 ps

  • base_dir (string) – root directory where all files will be found (defaults to pwd)

  • prefix (string) – prefix within base_dir for output folders (defaults to gmx)

__init__(gro, mdp, top, options, base_dir='', prefix='gmx')[source]

Create an empty DynamicsEngine object

Notes

The purpose of an engine is to create trajectories and keep track of the results. The main method is ‘generate’ to create a trajectory, which is a list of snapshots and then can store the in the associated storage. In the initialization this storage is created as well as the related Trajectory and Snapshot classes are initialized.

Methods

__init__(gro, mdp, top, options[, base_dir, ...])

Create an empty DynamicsEngine object

args()

Return a list of args of the __init__ function of a class

base()

Return the most parent class actually derived from StorableObject

check_snapshot_type(snapshot)

cleanup()

Any cleanup actions to do after the subprocess dies.

count_weaks()

Return number of objects subclassed from StorableObject still in memory

descendants()

Return a list of all subclassed objects

engine_command()

Generates a string for the command to run the engine.

fix_name()

Set the objects name to be immutable.

from_dict(dct)

Reconstruct an object from a dictionary representaiton

generate(snapshot[, running, direction])

Generate a trajectory consisting of ntau segments of tau_steps in between storage of Snapshots.

generate_n_frames([n_frames])

Generates n_frames, from but not including the current snapshot.

generate_next_frame()

get_uuid()

idx(store)

Return the index which is used for the object in the given store.

is_valid_snapshot(snapshot)

Test the snapshot to be valid.

iter_generate(initial[, running, direction, ...])

Return a generator that will generate a trajectory, returning the current trajectory in given intervals

named(name)

Name an unnamed object.

objects()

Returns a dictionary of all storable objects

prepare()

Any preparation between writing snapshot and running command

read_frame_data(filename, frame_num)

Returns pos, vel, box or raises error

read_frame_from_file(file_name, frame_num)

Reads given frame number from file, and returns snapshot.

restart_at_step(step)

Restart the filecounter (if used) to the right number.

reverse_uuid()

ruuid(uid)

set_as_default()

set_filenames(number)

Sets names for files associated with trajectory number

set_observer(active)

(De-)Activate observing creation of storable objects

start([snapshot])

stop(trajectory)

Nothing special needs to be done for direct-control simulations when you hit a stop condition.

stop_conditions(trajectory[, ...])

Test whether we can continue; called by generate a couple of times, so the logic is separated here.

to_dict()

Convert object into a dictionary representation

trajectory_filename(number)

who_to_kill()

Returns psutil.Process object to send kill signal to.

write_frame_to_file(filename, snapshot[, mode])

Writes given snapshot to file.

Attributes

ACTIVE_LONG

BACKWARD

CREATION_COUNT

FORWARD

GROMPP_CMD

INSTANCE_UUID

MDRUN_CMD

base_cls

Return the base class

base_cls_name

Return the name of the base class

clear_snapshot_cache

cls

Return the class name as a string

current_snapshot

default_name

Return the default name.

default_options

dimensions

grompp_command

is_named

True if this object has a custom name.

killsig

mdtraj_topology

name

Return the current name of the object.

observe_objects

units