molecular_simulations.simulate.reporters module

Custom OpenMM reporters for molecular simulations.

class molecular_simulations.simulate.reporters.RCReporter(file, report_interval, atom_indices, rc0)[source]

Bases: object

Custom reaction-coordinate reporter for OpenMM. Computes reaction coordinate progress for a given frame, and reports the target, rc0, current state, rc, and both distances that comprise the reaction coordinate, d_ik, d_ij.

Initialize the reaction coordinate reporter.

Parameters:
  • file (Path) – Path to the output file for reaction coordinate data.

  • report_interval (int) – Number of simulation steps between reports.

  • atom_indices (list[int]) – List of three atom indices [i, j, k] defining the reaction coordinate as dist(i,k) - dist(j,k).

  • rc0 (float) – Target reaction coordinate value for the current window.

__init__(file, report_interval, atom_indices, rc0)[source]

Initialize the reaction coordinate reporter.

Parameters:
  • file (Path) – Path to the output file for reaction coordinate data.

  • report_interval (int) – Number of simulation steps between reports.

  • atom_indices (list[int]) – List of three atom indices [i, j, k] defining the reaction coordinate as dist(i,k) - dist(j,k).

  • rc0 (float) – Target reaction coordinate value for the current window.

__del__()[source]

Close the output file when the reporter is destroyed.

describeNextReport(simulation)[source]

Describe when the next report will be generated.

Parameters:

simulation – The OpenMM Simulation object being reported on.

Returns:

A tuple containing (steps_until_next_report, need_positions, need_velocities, need_forces, need_energy, wrapped_positions).

report(simulation, state)[source]

Generate a report for the current simulation state.

Computes the reaction coordinate as the difference between two distances and writes the target rc0, current rc, and individual distances to the output file.

Parameters:
  • simulation – The OpenMM Simulation object being reported on.

  • state – The current State of the simulation containing positions.