Coverage for cvpack/reporting/custom_writer.py: 75%
8 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-16 00:10 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-16 00:10 +0000
1"""
2.. class:: CustomWriter
3 :platform: Linux, MacOS, Windows
4 :synopsis: An abstract class for StateDataReporter writers
6.. moduleauthor:: Charlles Abreu <craabreu@gmail.com>
8"""
10import typing as t
12from openmm import app as mmapp
15@t.runtime_checkable
16class CustomWriter(t.Protocol):
17 """
18 An abstract class for StateDataReporter writers
20 A writer may also define ``initialize(simulation)``, which is called once before
21 the first report and can be used to perform any necessary setup.
22 """
24 def getHeaders(self) -> list[str]:
25 """
26 Gets a list of strings containing the headers to be added to the report.
27 """
28 raise NotImplementedError("Method 'getHeaders' not implemented")
30 def getValues(self, simulation: mmapp.Simulation) -> list[float]:
31 """
32 Gets a list of floats containing the values to be added to the report.
34 Parameters
35 ----------
36 simulation
37 The simulation object.
38 """
39 raise NotImplementedError("Method 'getValues' not implemented")