From 3d5bb98dc0bcfeb936a580a479a2be43ffa59805 Mon Sep 17 00:00:00 2001 From: Timotej Bernat Date: Fri, 12 Apr 2024 18:46:50 -0600 Subject: [PATCH] Removed TypeSerializer boilerplate made redundant by jsonio updates --- polymerist/openmmtools/parameters.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/polymerist/openmmtools/parameters.py b/polymerist/openmmtools/parameters.py index 51891e2..6367ed9 100644 --- a/polymerist/openmmtools/parameters.py +++ b/polymerist/openmmtools/parameters.py @@ -8,7 +8,7 @@ from .thermo import ThermoParameters from .reporters import ReporterParameters -from ..genutils.fileutils.jsonio.jsonify import make_jsonifiable, jsonifiable_serializer_factory +from ..genutils.fileutils.jsonio.jsonify import make_jsonifiable, dataclass_serializer_factory from ..genutils.fileutils.jsonio.serialize import PathSerializer, QuantitySerializer, MultiTypeSerializer @@ -42,19 +42,7 @@ def time_points(self) -> np.ndarray[int]: return (np.arange(0, self.num_steps, step=self.report_interval) + self.report_interval)* self.time_step # extra offset by recording frequency need to align indices (not 0-indexed) # UNIFIED SIMULATION PARAMETER SETS -ThermoParametersSerializer = jsonifiable_serializer_factory(ThermoParameters) -ReporterParametersSerializer = jsonifiable_serializer_factory(ReporterParameters) -IntegratorParametersSerializer = jsonifiable_serializer_factory(IntegratorParameters) - -SimulationParametersSerializer = MultiTypeSerializer( # create unified serializer for Simulation parameter sets - PathSerializer, - QuantitySerializer, - ThermoParametersSerializer, - ReporterParametersSerializer, - IntegratorParametersSerializer, -) - -@make_jsonifiable(type_serializer=SimulationParametersSerializer) +@make_jsonifiable @dataclass class SimulationParameters: '''Unified class for storing simulation parameters'''