Source code for irradiapy.lammps.commands.reset_timestep

"""This module contains the ResetTimestep class for LAMMPS reset_timestep commands."""

from dataclasses import dataclass, field

from irradiapy.lammps.commands.command import Command


[docs] @dataclass(kw_only=True) class ResetTimestep(Command): """Class representing a LAMMPS reset_timestep command. Reference --------- https://docs.lammps.org/reset_timestep.html """ n: str kw_vals: dict[str, str] = field(default_factory=dict) def __post_init__(self) -> None: self.n = str(self.n) self.kw_vals = {str(key): str(value) for key, value in self.kw_vals.items()}
[docs] def command(self) -> str: """Generate the LAMMPS command.""" kw_vals_str = ( " " + " ".join(f"{key} {value}" for key, value in self.kw_vals.items()) if self.kw_vals else "" ) return f"reset_timestep {self.n}{kw_vals_str}"