feat: improved implementation and validations of configs

This commit is contained in:
2026-02-26 08:35:59 -03:00
parent e5c6282c86
commit c51d07cff2
11 changed files with 84 additions and 57 deletions

View File

@@ -1,7 +1,7 @@
from pydantic import BaseModel, Field
from diceplayer.shared.utils.dataclass_protocol import Dataclass
from pydantic import BaseModel, Field
from dataclasses import dataclass, fields
from typing import List, Literal
@@ -12,16 +12,33 @@ class DiceConfig(BaseModel):
"""
ljname: str = Field(..., description="Name of the Lennard-Jones potential file")
outname: str = Field(..., description="Name of the output file for the simulation results")
outname: str = Field(
..., description="Name of the output file for the simulation results"
)
dens: float = Field(..., description="Density of the system")
nmol: List[int] = Field(..., description="List of the number of molecules for each component")
nstep: List[int] = Field(..., description="List of the number of steps for each component", min_length=2, max_length=3)
nmol: List[int] = Field(
..., description="List of the number of molecules for each component"
)
nstep: List[int] = Field(
...,
description="List of the number of steps for each component",
min_length=2,
max_length=3,
)
upbuf: int = Field(360, description="Buffer size for the potential energy calculations")
combrule: Literal["+", "*"] = Field("*", description="Combination rule for the Lennard-Jones potential")
upbuf: int = Field(
360, description="Buffer size for the potential energy calculations"
)
combrule: Literal["+", "*"] = Field(
"*", description="Combination rule for the Lennard-Jones potential"
)
isave: int = Field(1000, description="Frequency of saving the simulation results")
press: float = Field(1.0, description="Pressure of the system")
temp: float = Field(300.0, description="Temperature of the system")
progname: str = Field("dice", description="Name of the program to run the simulation")
randominit: str = Field("first", description="Method for initializing the random number generator")
progname: str = Field(
"dice", description="Name of the program to run the simulation"
)
randominit: str = Field(
"first", description="Method for initializing the random number generator"
)
seed: int | None = Field(None, description="Seed for the random number generator")