Skip to content

Commit

Permalink
Removed TypeSerializer boilerplate made redundant by jsonio updates
Browse files Browse the repository at this point in the history
  • Loading branch information
timbernat committed Apr 13, 2024
1 parent d7d8740 commit 3d5bb98
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions polymerist/openmmtools/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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'''
Expand Down

0 comments on commit 3d5bb98

Please sign in to comment.