topo.reporter package

Submodules

topo.reporter.topo_reporter module

topo.reporter.topo_reporter.readOpenMMReporterFile(reporter_file)[source]

Read a fixed-width TOPO/OpenMM log into a {column_name: [values...]} dict.

The first line is the #-commented header. Columns are separated by runs of two or more spaces (so multi-word headers like Potential Energy (kJ/mole) stay intact), and numeric data rows are split on whitespace.

Parameters:

reporter_file (str) – Path to the reporter output file.

class topo.reporter.topo_reporter.topoReporter(file, reportInterval, sbmObject=None, precision=4, width=14, **kwargs)[source]

Bases: StateDataReporter

A StateDataReporter that writes a clean, fixed-width log.

Compared with OpenMM’s reporter this adds:

  • precision – floating-point columns are written with a fixed number of decimals instead of full repr precision.

  • width – every column is padded to a fixed width so the columns line up (each column uses max(len(header), width), so long headers still fit).

  • sbmObject – optionally append one energy column per force group of a TOPO system object.

The header line is written as a # comment, and columns are separated by the separator string (use two spaces for a readable, machine-parsable log; see readOpenMMReporterFile()).

For background on custom reporters see: http://docs.openmm.org/latest/userguide/application/04_advanced_sim_examples.html#extracting-and-reporting-forces-and-other-data

_constructHeaders()[source]

Headers from the base reporter, plus one per force group when requested.

_constructReportValues(simulation, state)[source]

Base report values, plus per-force-group energies when requested.

_format_header(headers)[source]

Format the header line, marked as a comment.

Parameters:

headers (list of str) – Column header names.

Returns:

An OpenMM-style quoted, separator-joined comment line when no width is set; otherwise a right-justified fixed-width line whose leading space is replaced by #.

Return type:

str

_format_row(fields)[source]

Format one data row.

Parameters:

fields (list of str) – Pre-stringified field values for the row.

Returns:

The separator-joined row; right-justified to the column widths when a fixed width is set, otherwise plainly joined.

Return type:

str

_value_to_str(v)[source]

Format one value: floats to fixed precision, everything else via str.

report(simulation, state)[source]

Generate a report (fixed-width when width is set).

Module contents

reporter package of the TOPO package that contains the topoReporter class.

The topo.reporter package contains the topoReporter class.

topoReporter is a special class of the OpenMM StateDataReporter class, that additionally accepts a topo system object to print the force group energies.